Canvas element copying and pasting method and apparatus, electronic device and storage medium

By converting canvas element data into custom and alternative types, and parsing and pasting the data according to the support of the target location, the problems of large data volume and long processing time in the existing technology are solved, thus improving the user experience.

WO2026103584A1PCT designated stage Publication Date: 2026-05-21WUHAN JINGCHEN INTELLIGENT IDENTIFICATION TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
WUHAN JINGCHEN INTELLIGENT IDENTIFICATION TECH CO LTD
Filing Date
2025-11-05
Publication Date
2026-05-21

AI Technical Summary

Technical Problem

Existing technologies result in a large amount of clipboard data and a long time to parse mixed data when copying and pasting canvas elements, which affects the user experience.

Method used

The method encodes the canvas element data to be copied into custom type data, and then parses the custom type data or alternative type data according to the support of the target paste location for pasting operations. This includes canvas element encoded data, image type data, and text type data.

Benefits of technology

It effectively reduces the amount of clipboard data and the time spent parsing data, thus improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025132679_21052026_PF_FP_ABST
    Figure CN2025132679_21052026_PF_FP_ABST
Patent Text Reader

Abstract

A canvas element copying and pasting method and apparatus, an electronic device and a storage medium. The method comprises: performing data coding to obtain custom-type data; performing data type conversion to obtain alternative-type data; storing the custom-type data and the alternative-type data in a pasting board; and, if the custom-type data is supported, analyzing the custom-type data or, if not, analyzing the alternative-type data.
Need to check novelty before this filing date? Find Prior Art

Description

A method, apparatus, electronic device, and storage medium for copying and pasting canvas elements.

[0001] Related applications

[0002] This application claims priority to Chinese patent application filed on November 12, 2024, with application number 202411610255.X, entitled "A method, apparatus, electronic device and storage medium for copying and pasting canvas elements", the entire contents of which are contained herein. Technical Field

[0003] This application relates to the field of data copy and paste technology, and in particular to a method, apparatus, electronic device and storage medium for copying and pasting canvas elements. Background Technology

[0004] In the printing industry, when editing print content, it is often necessary to copy and paste elements on the canvas. The copied elements can be pasted as a new element with the same content within the software itself, or they can be pasted as images in other software that supports pasting images.

[0005] However, current technologies typically mix element data with graphic data when copying and pasting elements on a canvas, parsing the graphic data and element data simultaneously during the pasting process. This copy-and-paste method results in a large amount of clipboard data and takes a long time to parse the mixed data, negatively impacting the user experience.

[0006] Therefore, existing technologies suffer from problems such as large amounts of clipboard data during copy-paste processes and long processing times for mixed data, which negatively impact user experience and require improvement. Summary of the Invention

[0007] In view of this, it is necessary to provide a method, apparatus, electronic device and storage medium for copying and pasting canvas elements, in order to solve the technical problems in the prior art where the amount of clipboard data is large and the parsing of mixed data takes a long time, which affects the user experience.

[0008] To address the aforementioned problems, this application provides a method for copying and pasting canvas elements, including:

[0009] Get the data of the canvas element to be copied, encode the data of the canvas element to be copied to obtain custom type data, convert the data type of the canvas element to be copied to obtain alternative type data, and save the custom type data and alternative type data to the clipboard.

[0010] Upon receiving a paste request, determine whether the target paste location supports custom data types. If it does, parse the custom data and perform the paste operation. If it does not support custom data types, parse alternative data types and perform the paste operation.

[0011] In one possible implementation, the custom type data includes canvas element encoding data and an encoding type field.

[0012] In one possible implementation, the data of the canvas element to be copied is encoded to obtain custom type data, including:

[0013] The data of the canvas element to be copied is converted to JSON format data, and the JSON format data is then encoded into bytecode to obtain the canvas element encoded data.

[0014] Encode the data of the canvas element by marking the encoding type to obtain the encoding type field.

[0015] In one possible implementation, the alternative data type includes image type data. The alternative data type is obtained by performing data type conversion on the canvas element data to be copied, including:

[0016] The image type data is generated by parsing the data of the canvas elements to be copied based on the preset image library.

[0017] One possible implementation involves parsing custom type data and performing a paste operation, including:

[0018] The corresponding decoding method is determined based on the encoding type field, and the encoded data of the canvas element is decoded according to the decoding method to obtain JSON string data.

[0019] Serialize the JSON string data to obtain the data object to be pasted;

[0020] Paste the data object to be pasted into the target paste location.

[0021] In one possible implementation, parsing the alternative type data and performing the paste operation includes:

[0022] Determine if the target paste location supports image data. If it does, parse the image data and perform the paste operation.

[0023] In one possible implementation, the alternative data type also includes text data, and the method further includes:

[0024] Upon receiving a paste request, if the clipboard does not contain custom type data or image type data, parse the text type data and perform the paste operation.

[0025] On the other hand, this application also provides a canvas element copying and pasting device, including:

[0026] The canvas element copying unit is used to obtain the data of the canvas element to be copied, encode the data of the canvas element to be copied to obtain custom type data, convert the data type of the canvas element to be copied to obtain alternative type data, and save the custom type data and alternative type data to the clipboard.

[0027] The Canvas Element Paste Unit is used to determine whether the target paste location supports custom data types after receiving a paste request. If it supports custom data types, it parses the custom data types and performs the paste operation. If it does not support custom data types, it parses alternative data types and performs the paste operation.

[0028] On the other hand, this application also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the above-described canvas element copy and paste method.

[0029] On the other hand, this application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described method for copying and pasting canvas elements.

[0030] The beneficial effects of this application are as follows: In the canvas element copy and paste method provided in this application, the canvas element data to be copied is first obtained, then the data to be copied is encoded to obtain custom type data, and then the data type of the canvas element data to be copied is converted to obtain alternative type data. The custom type data and alternative type data are stored in the clipboard. Then, upon receiving a paste request, it is determined whether the target paste location supports custom type data. If it supports custom type data, the custom type data is parsed and the paste operation is performed; if it does not support custom type data, the alternative type data is parsed and the paste operation is performed. This application reduces the amount of clipboard data by encoding the canvas element data to be copied into custom type data, and effectively reduces the data parsing time and improves the user experience by converting the canvas element data to be copied into custom type data and alternative type data respectively, and performing the corresponding paste operation according to the data type supported by the target paste location. Attached Figure Description

[0031] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0032] Figure 1 is a flowchart illustrating an embodiment of the canvas element copy and paste method provided in this application;

[0033] Figure 2 is a schematic diagram of the process of obtaining custom type data by data encoding according to an embodiment of this application;

[0034] Figure 3 is a schematic diagram of the custom data parsing and pasting process according to an embodiment of this application;

[0035] Figure 4 is a schematic diagram of an embodiment of the canvas element copy and paste device provided in this application;

[0036] Figure 5 is a schematic diagram of an embodiment of the electronic device provided in this application. Detailed Implementation

[0037] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0038] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.

[0039] The terms "first," "second," etc., used in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature.

[0040] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0041] Before demonstrating the embodiments, the following terms will be explained.

[0042] Custom data types: These refer to data types stored in the clipboard as custom arrays. Common types include text and bytecode. Text types generally do not require encoding or decoding during use, while bytecode types require encoding or decoding during use.

[0043] This application provides a method, apparatus, electronic device, and storage medium for copying and pasting canvas elements, which are described below.

[0044] Figure 1 is a flowchart illustrating an embodiment of the canvas element copying and pasting method provided in this application. As shown in Figure 1, the canvas element copying and pasting method includes:

[0045] S101. Obtain the data of the canvas element to be copied, encode the data of the canvas element to be copied to obtain custom type data, convert the data type of the canvas element to be copied to obtain alternative type data, and save the custom type data and alternative type data to the clipboard.

[0046] S102. Upon receiving a paste request, determine whether the target paste location supports custom data types. If it supports custom data types, parse the custom data types and perform the paste operation. If it does not support custom data types, parse the alternative data types and perform the paste operation.

[0047] Compared with existing technologies, the canvas element copy and paste method provided in this application first obtains the canvas element data to be copied, encodes the data to obtain custom type data, converts the data type of the canvas element data to obtain alternative type data, and stores the custom type data and alternative type data in the clipboard. Then, upon receiving a paste request, it determines whether the target paste location supports custom type data. If it supports custom type data, it parses the custom type data and performs the paste operation; if it does not support custom type data, it parses the alternative type data and performs the paste operation. This application reduces the amount of clipboard data by encoding the canvas element data to be copied into custom type data, and effectively reduces data parsing time and improves user experience by converting the canvas element data to be copied into custom type data and alternative type data respectively, and performing the corresponding paste operation according to the data type supported by the target paste location.

[0048] In some embodiments of this application, custom type data includes canvas element encoding data and encoding type field.

[0049] Specifically, to reduce the amount of data on the clipboard and facilitate data encoding and decoding operations, the custom type data in this embodiment includes canvas element encoded data and an encoding type field. The canvas element encoded data is bytecode formatted data obtained by encoding the canvas element data to be copied. The encoding type field stores the encoding type so that the data can be accurately identified and parsed during data decoding.

[0050] In some embodiments of this application, Figure 2 is a schematic diagram of the process of obtaining custom type data through data encoding in an embodiment of this application. As shown in Figure 2, the process of obtaining custom type data by data encoding of the canvas element data to be copied includes:

[0051] S201. Convert the data format of the canvas element to be copied to obtain JSON format data, and encode the JSON format data into bytecode to obtain the canvas element encoded data.

[0052] S202. Mark the encoding type of the canvas element encoding data to obtain the encoding type field.

[0053] Specifically, during the data encoding process, in order to effectively reduce the bytecode size, the embodiment first converts the canvas element data to be copied into JSON format data, and then the software performs bytecode encoding on the JSON format data to obtain the canvas element encoded data. Simultaneously, to facilitate subsequent decoding operations, an encoding type field needs to be generated based on the encoding type during the bytecode encoding process.

[0054] In some embodiments of this application, the alternative data type includes image data. The alternative data type is obtained by performing data type conversion on the canvas element data to be copied, including:

[0055] The image type data is generated by parsing the data of the canvas elements to be copied based on the preset image library.

[0056] Specifically, in addition to encoding the canvas element data to be copied into custom type data, the embodiment also converts the canvas element data to be copied into alternative type data, so as to use the alternative type data for pasting operation when the target pasting location does not support custom type data.

[0057] Among them, the alternative data types include image data. In the process of generating image data, the embodiment passes the canvas element data to be copied to a preset image library, and uses the preset image library to parse the element data to generate image data.

[0058] In some embodiments of this application, Figure 3 is a flowchart illustrating the custom data parsing and pasting process of an embodiment of this application. As shown in Figure 3, parsing custom type data and performing the paste operation includes:

[0059] S301. Determine the corresponding decoding method based on the encoding type field, and decode the encoded data of the canvas element according to the decoding method to obtain JSON string data;

[0060] S302. Serialize the JSON string data to obtain the data object to be pasted;

[0061] S303. Paste the data object to be pasted to the target paste location.

[0062] Specifically, upon receiving a paste request, it is necessary to first determine whether the target paste location supports custom data types. In this embodiment, generally, if the target paste location is within the same software, custom data types are supported; if the target paste location is within another software, custom data types are typically not supported. The embodiment parses the corresponding data according to the data format supported by the target paste location and performs the paste operation.

[0063] In the process of parsing and pasting custom type data, the example first determines the decoding method corresponding to the custom type data based on the encoding type field, and decodes the canvas element encoded data into JSON string data according to the determined decoding method. Then, the JSON string data is serialized to obtain the data object to be pasted, and finally the data object to be pasted is pasted into the target pasting position.

[0064] In some embodiments of this application, parsing alternative type data and performing a paste operation includes:

[0065] Determine if the target paste location supports image data. If it does, parse the image data and perform the paste operation.

[0066] Specifically, when the target paste location does not support custom data type, the embodiment first determines whether the target paste location supports image data type. If image data type is supported, the embodiment parses the image data saved in the clipboard and pastes it into the corresponding location; if not, the paste operation ends.

[0067] In some embodiments of this application, the alternative data type also includes text data, and the method further includes:

[0068] Upon receiving a paste request, if the clipboard does not contain custom type data or image type data, parse the text type data and perform the paste operation.

[0069] Specifically, to ensure that the clipboard can quickly copy and paste canvas element data while still retaining the original text copy and paste functionality, text type data is included as a backup data type. During the pasting process, if it is determined that neither custom type data nor image type data exists in the clipboard, then text type data is parsed and the paste operation is performed, thus completing the regular text copy and paste operation.

[0070] In summary, to reduce the amount of clipboard data and improve data parsing speed during pasting, the canvas element copy and paste method provided in this application first obtains the data of the canvas element to be copied, encodes it to obtain custom type data, and converts it to alternative type data. The custom type data and alternative type data are then stored in the clipboard. Upon receiving a paste request, it determines whether the target paste location supports custom type data. If it does, the custom type data is parsed and the paste operation is performed; otherwise, the alternative type data is parsed and the paste operation is performed. This application reduces the amount of clipboard data by encoding the canvas element data to be copied into custom type data, and by converting the canvas element data to be copied into custom type data and alternative type data respectively, and performing the corresponding paste operation according to the data type supported by the target paste location, effectively reducing data parsing time and improving user experience.

[0071] To better implement the canvas element copying and pasting method in this application embodiment, based on the canvas element copying and pasting method, as shown in Figure 4, this application also provides a canvas element copying and pasting device. The canvas element copying and pasting device 400 includes:

[0072] The canvas element copying unit 401 is used to obtain the canvas element data to be copied, encode the canvas element data to be copied to obtain custom type data, convert the data type of the canvas element data to be copied to obtain alternative type data, and store the custom type data and alternative type data into the clipboard.

[0073] The canvas element pasting unit 402 is used to determine whether the target pasting location supports custom type data after receiving a pasting request. If it supports custom type data, it parses the custom type data and performs the pasting operation. If it does not support custom type data, it parses the alternative type data and performs the pasting operation.

[0074] The canvas element copy and paste device 400 provided in the above embodiments can realize the technical solutions described in the above canvas element copy and paste method embodiments. The specific implementation principles of each module or unit can be found in the corresponding content in the above canvas element copy and paste method embodiments, and will not be repeated here.

[0075] As shown in Figure 5, this application also provides an electronic device 500. The electronic device 500 includes a processor 501, a memory 502, and a display 503. Figure 5 only shows some components of the electronic device 500; however, it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented alternatively.

[0076] In some embodiments, processor 501 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 502 or process data, such as the canvas element copy and paste method in this application.

[0077] In some embodiments, processor 501 may be a single server or a group of servers. The server group may be centralized or distributed. In some embodiments, processor 501 may be local or remote. In some embodiments, processor 501 may be implemented on a cloud platform. In one embodiment, the cloud platform may include a private cloud, public cloud, hybrid cloud, community cloud, distributed cloud, internal cloud, multi-cloud, etc., or any combination thereof.

[0078] In some embodiments, memory 502 may be an internal storage unit of electronic device 500, such as a hard disk or memory of electronic device 500. In other embodiments, memory 502 may also be an external storage device of electronic device 500, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 500.

[0079] Furthermore, the memory 502 may include both internal storage units of the electronic device 500 and external storage devices. The memory 502 is used to store application software and various types of data installed on the electronic device 500.

[0080] In some embodiments, display 503 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 503 is used to display information from electronic device 500 and to display a visual user interface. Components 801-803 of electronic device 500 communicate with each other via a system bus.

[0081] In one embodiment, when processor 501 executes the canvas element copy and paste program in memory 502, the following steps can be implemented:

[0082] Get the data of the canvas element to be copied, encode the data of the canvas element to be copied to obtain custom type data, convert the data type of the canvas element to be copied to obtain alternative type data, and save the custom type data and alternative type data to the clipboard.

[0083] Upon receiving a paste request, determine whether the target paste location supports custom data types. If it does, parse the custom data and perform the paste operation. If it does not support custom data types, parse alternative data types and perform the paste operation.

[0084] It should be understood that when the processor 501 executes the canvas element copy and paste program in the memory 502, in addition to the functions mentioned above, it can also perform other functions, as can be found in the description of the corresponding method embodiments above.

[0085] Furthermore, this application does not specifically limit the type of electronic device 500 mentioned in the embodiments. Electronic device 500 can be a mobile phone, tablet computer, personal digital assistant (PDA), wearable device, laptop computer, or other portable electronic device. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices running iOS, Android, Microsoft, or other operating systems. The aforementioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of this application, electronic device 500 may not be a portable electronic device, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).

[0086] Accordingly, this application also provides a computer-readable storage medium for storing computer-readable programs or instructions. When the programs or instructions are executed by a processor, they can implement the steps or functions of the canvas element copy and paste methods provided in the above-described method embodiments.

[0087] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.), and the computer program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0088] The canvas element copying and pasting method, apparatus, electronic device, and storage medium provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A canvas element copy and paste method, wherein, include: Obtain the canvas element data to be copied, and encode the canvas element data to obtain custom type data; The data type of the canvas element data to be copied is converted to obtain alternative type data, and the custom type data and the alternative type data are stored in the clipboard. Upon receiving a paste request, determine whether the target paste location supports the custom data type; if it supports the custom data type, parse the custom data type and perform the paste operation; if it does not support the custom data type, parse the alternative data type and perform the paste operation.

2. The canvas element copy and paste method of claim 1, wherein, The custom type data includes canvas element encoding data and encoding type field.

3. The canvas element copy and paste method of claim 2, wherein, The process of encoding the canvas element data to be copied to obtain custom type data includes: The data format of the canvas element data to be copied is converted to obtain JSON format data, and the JSON format data is encoded into bytecode to obtain canvas element encoded data; The encoding type field is obtained by encoding the data of the canvas element and marking the encoding type.

4. The canvas element copy and paste method of claim 1, wherein, The candidate data types include image data. The process of converting the data type of the canvas element data to be copied to obtain the candidate data types includes: Image type data is generated by parsing the canvas element data to be copied based on a preset image library.

5. The canvas element copy and paste method of claim 2, wherein, The process of parsing the custom type data and performing the paste operation includes: The corresponding decoding method is determined based on the encoding type field, and the encoded data of the canvas element is decoded according to the decoding method to obtain JSON string data. Serialize the JSON string data to obtain the data object to be pasted; Paste the data object to be pasted into the target pasting location.

6. The canvas element copy and paste method of claim 4, wherein, The step of parsing the candidate data type and performing the paste operation includes: Determine whether the target paste location supports image type data. If it does, parse the image type data and perform the paste operation.

7. The canvas element copy and paste method of claim 4, wherein, The alternative data types also include text data, and the method further includes: Upon receiving a paste request, if the clipboard does not contain the custom type data and the image type data, the text type data is parsed and the paste operation is performed.

8. A canvas element copy and paste device, wherein, include: The canvas element copying unit is configured to: acquire canvas element data to be copied, encode the canvas element data to be copied to obtain custom type data, convert the data type of the canvas element data to be copied to obtain alternative type data, and store the custom type data and the alternative type data into the clipboard. The canvas element pasting unit is configured to: upon receiving a pasting request, determine whether the target pasting location supports the custom type data; if it supports the custom type data, parse the custom type data and perform the pasting operation; if it does not support the custom type data, parse the alternative type data and perform the pasting operation.

9. An electronic device comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, wherein, When the processor executes the program, it implements a method for copying and pasting canvas elements, including: Obtain the canvas element data to be copied, encode the canvas element data to be copied to obtain custom type data, convert the data type of the canvas element data to be copied to obtain alternative type data, and store the custom type data and the alternative type data in the clipboard; Upon receiving a paste request, determine whether the target paste location supports the custom data type; if it supports the custom data type, parse the custom data type and perform the paste operation; if it does not support the custom data type, parse the alternative data type and perform the paste operation.

10. The electronic device of claim 9, wherein, When the processor executes the program, it implements a method for copying and pasting canvas elements, wherein the step of encoding the data of the canvas element to be copied to obtain custom type data includes: The data format of the canvas element data to be copied is converted to obtain JSON format data, and the JSON format data is encoded into bytecode to obtain canvas element encoded data; The encoding type field is obtained by marking the encoding type of the encoded data of the canvas element; The custom type data includes canvas element encoding data and encoding type field. 11.The electronic device of claim 9, wherein When the processor executes the program, it implements a method for copying and pasting canvas elements, wherein the step of converting the data type of the canvas element data to be copied to obtain alternative data types includes: Image type data is generated by parsing the canvas element data to be copied according to a preset image library; the alternative type data includes image type data.

12. The electronic device of claim 10, wherein, When the processor executes the program, it implements a method for copying and pasting canvas elements, wherein parsing the custom type data and performing the paste operation includes: The corresponding decoding method is determined based on the encoding type field, and the encoded data of the canvas element is decoded according to the decoding method to obtain JSON string data. Serialize the JSON string data to obtain the data object to be pasted; Paste the data object to be pasted into the target pasting location.

13. The electronic device of claim 11, wherein, When the processor executes the program, it implements a method for copying and pasting canvas elements, wherein parsing the candidate type data and performing the paste operation includes: Determine whether the target paste location supports image type data. If it does, parse the image type data and perform the paste operation.

14. The electronic device of claim 11, wherein, When the processor executes the program, implementing a method for copying and pasting canvas elements also includes: Upon receiving a paste request, if the clipboard does not contain the custom type data and the image type data, the text type data is parsed and the paste operation is performed; the alternative type data also includes text type data.

15. A computer readable storage medium having stored thereon a computer program, wherein, When the computer program is executed by the processor, it implements a method for copying and pasting canvas elements, including: Obtain the canvas element data to be copied, encode the canvas element data to be copied to obtain custom type data, convert the data type of the canvas element data to be copied to obtain alternative type data, and store the custom type data and the alternative type data in the clipboard; Upon receiving a paste request, determine whether the target paste location supports the custom data type; if it supports the custom data type, parse the custom data type and perform the paste operation; if it does not support the custom data type, parse the alternative data type and perform the paste operation.

16. The computer-readable storage medium of claim 15, wherein, When the computer program is executed by the processor, it implements a method for copying and pasting canvas elements, wherein the step of encoding the data of the canvas element to be copied to obtain custom type data includes: The data format of the canvas element data to be copied is converted to obtain JSON format data, and the JSON format data is encoded into bytecode to obtain canvas element encoded data; The encoding type field is obtained by marking the encoding type of the encoded data of the canvas element; The custom type data includes canvas element encoding data and encoding type field.

17. The computer-readable storage medium of claim 15, wherein, When the computer program is executed by the processor, it implements a method for copying and pasting canvas elements, wherein the step of converting the data type of the canvas element data to be copied to obtain alternative data types includes: Image type data is generated by parsing the canvas element data to be copied according to a preset image library; the alternative type data includes image type data.

18. The computer-readable storage medium of claim 16, wherein, When the computer program is executed by the processor, it implements a method for copying and pasting canvas elements, wherein parsing the custom type data and performing the paste operation includes: The corresponding decoding method is determined based on the encoding type field, and the encoded data of the canvas element is decoded according to the decoding method to obtain JSON string data. Serialize the JSON string data to obtain the data object to be pasted; Paste the data object to be pasted into the target pasting location.

19. The computer-readable storage medium of claim 16, wherein, When the computer program is executed by the processor, it implements a method for copying and pasting canvas elements, wherein parsing the candidate type data and performing the paste operation includes: Determine whether the target paste location supports image type data. If it does, parse the image type data and perform the paste operation.

20. The computer-readable storage medium of claim 16, wherein, When the computer program is executed by the processor, the method for copying and pasting canvas elements further includes: Upon receiving a paste request, if the clipboard does not contain the custom type data and the image type data, the text type data is parsed and the paste operation is performed; the alternative type data also includes text type data.