A text redrawing method and rich text editor device
By introducing low-frequency and high-frequency drawing layers in the rich text editor to separate text and cursor redrawing task, the problem of Canvas-based rich text editor slowing down when text volume is large, improving the efficiency and writing experience of text redrawing.
Patent Information
- Application Number
- CN202210356250.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-06
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2042-04-06
AI Technical Summary
Canvas-based rich text editors are slow to redraw when the text volume is large, which affects the writing experience.
By designing the rich text editor as a low-frequency drawing layer and a high-frequency drawing layer, the low-frequency drawing layer is responsible for obtaining text coordinates and redrawing text on the first canvas, the high-frequency drawing layer is responsible for drawing the cursor and selection, and displaying the redrawn text on the second canvas.
This layered design improves the efficiency of text redrawing, solves the problem of slow redrawing speed, and improves the writing experience.
Smart Images

Figure CN114742020B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of text processing, and in particular, relates to a text redrawing method and a rich text editor. Background Art
[0002] Existing rich text editors usually use the c / s architecture, but with the advent of the mobile Internet era, rich text editors based on the c / s architecture do not conform to the trend of mobile web development. Therefore, most rich text editors currently use the Canvas version.
[0003] The cursor of a Canvas-based rich text editor needs to flash while writing, and when selecting text, the selection needs to be drawn along the range selected by the mouse. This kind of drawing requires a high redrawing speed. However, when the selected document content does not need to be changed, there is no need to redraw the flashing cursor following the changes in the selection. Because when the amount of text to be drawn is large, the redrawing speed will be very slow, affecting the writing speed. Summary of the invention
[0004] The present application provides a text redrawing method, which solves the problem of slow redrawing speed of rich text editors by redrawing the cursor and text separately, and improves the text redrawing efficiency.
[0005] In a first aspect, a method for redrawing text is provided, the method being applied to a rich text editor, the rich text editor comprising: a low-frequency drawing layer and a high-frequency drawing layer, the low-frequency drawing layer comprising a first canvas, the high-frequency drawing layer comprising a second canvas, the method comprising: the low-frequency drawing layer obtaining text coordinates of a text to be edited; the low-frequency drawing layer determining a text editing cursor position of the high-frequency drawing layer on the second canvas according to the text coordinates; a user inputting text information at the text editing cursor position on the second canvas of the high-frequency drawing layer; the low-frequency drawing layer redrawing the text to be edited on the first canvas according to the text information.
[0006] The method provided in the first aspect designs a rich text editor in layers, so that a low-frequency drawing layer obtains the text coordinates of the text to be edited and sends the text coordinates to a high-frequency drawing layer, and then uses the high-frequency drawing layer to draw the text editing cursor position of the text to be edited. The user can enter text information at the text editing cursor position, and then the low-frequency drawing layer redraws the text to be edited according to the text information entered by the user. This method of separately redrawing the cursor and the text solves the problem of slow redrawing of the rich text editor and improves the efficiency of text redrawing.
[0007] In a possible implementation, the method further includes: the low-frequency drawing layer obtains the text coordinates of the text to be edited at the click coordinates according to the click coordinates of the user. In this implementation, the low-frequency drawing layer can obtain the text coordinates of the text to be edited according to the click coordinates of the user on the high-frequency drawing layer.
[0008] In a possible implementation, the low-frequency drawing layer determines the text editing cursor position of the high-frequency drawing layer on the second canvas according to the text coordinates, including: the low-frequency drawing layer sends the text coordinates of the text to be edited to the high-frequency drawing layer; the high-frequency drawing layer determines the text editing cursor position on the second canvas according to the text coordinates of the text to be edited. In this implementation, the low-frequency drawing layer sends the text coordinates of the text to be edited to the high-frequency drawing layer, and the high-frequency drawing layer redraws the text editing cursor, so that the cursor redrawing and the text redrawing can be separated, thereby improving the redrawing speed.
[0009] In a possible implementation, the low-frequency drawing layer redraws the text to be edited on the first canvas according to the text information, including: the low-frequency drawing layer redraws the text to be edited on the first canvas according to the received first instruction, and the first instruction is the text information sent by the high-frequency drawing layer to the low-frequency drawing layer. In this implementation, the low-frequency drawing layer redraws the text to be edited according to the received text information sent by the high-frequency drawing layer, and also implements the redrawing of the cursor and the text through different layers, thereby improving the redrawing speed.
[0010] In a possible implementation, the high-frequency drawing layer is a transparent layer, and the method further includes: displaying the redrawn text information through the high-frequency drawing layer. In this implementation, the high-frequency drawing layer is set as a transparent layer, ensuring that the text information redrawn through the low-frequency redrawing layer can be displayed to the user through the high-frequency drawing layer.
[0011] In a possible implementation, the method further includes: the high-frequency drawing layer moves the cursor position according to the edited text to be edited. In this implementation, when the redrawing is completed, the cursor position should also change accordingly, so that the user can intuitively see the text position after the redrawing is completed from the editor.
[0012] In a second aspect, a communication device is provided, which includes a unit for executing each step in the above first aspect or any possible implementation manner of the first aspect.
[0013] According to a third aspect, a communication device is provided, comprising at least one processor and a memory, wherein the at least one processor is used to execute the method in the above first aspect or any possible implementation manner of the first aspect.
[0014] In a fourth aspect, a communication device is provided, comprising at least one processor and an interface circuit, wherein the at least one processor is used to execute the method in the above first aspect or any possible implementation of the first aspect.
[0015] In a fifth aspect, a rich text editor is provided, the rich text editor comprising a low-frequency drawing layer and a high-frequency drawing layer, the low-frequency drawing layer comprising a first canvas, the high-frequency drawing layer comprising a second canvas, the rich text editor being used to execute the method in the above first aspect or any possible implementation of the first aspect.
[0016] In a possible implementation, the first canvas is located at the bottom layer of the second canvas, the first canvas and the second canvas are located in the same coordinate system, and the second canvas is a transparent layer. In this implementation, the first canvas is set at the bottom layer of the second canvas, and the first canvas and the second canvas are located in the same coordinate system. When the user clicks on the high-frequency drawing layer, the low-frequency drawing layer can obtain the click coordinates, and the second canvas is set as a transparent layer. When the low-frequency drawing layer completes the text redrawing, it can be displayed on the rich text editor through the transparent second canvas.
[0017] According to a sixth aspect, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the computer program is used to execute the method in the first aspect or any possible implementation of the first aspect.
[0018] In a seventh aspect, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed, it is used to execute the method in the first aspect or any possible implementation of the first aspect.
[0019] In an eighth aspect, a chip or an integrated circuit is provided, which includes: a processor, configured to call and run a computer program from a memory, so that a device equipped with the chip or the integrated circuit executes the method in the first aspect or any possible implementation of the first aspect.
[0020] It can be understood that the beneficial effects of the second to eighth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.
[0021] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0022] The text redrawing method provided by the present application designs a rich text editor in layers, so that the low-frequency drawing layer obtains the text coordinates of the text to be edited and sends the text coordinates to the high-frequency drawing layer, and then uses the high-frequency drawing layer to draw the text editing cursor position of the text to be edited. The user can enter text information at the text editing cursor position, and then the low-frequency drawing layer redraws the text to be edited according to the text information entered by the user. This method of separately redrawing the cursor and the text solves the problem of slow redrawing speed of the rich text editor and improves the text redrawing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0024] Figure 1 is a schematic flow chart of text redrawing provided in an embodiment of the present application;
[0025] Figure 2 is a schematic diagram of a rich text editor provided in an embodiment of the present application;
[0026] Figure 3 It is a schematic block diagram of a text redrawing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0028] First, before introducing the method and system provided by the present application, it is necessary to explain some of the terms that will be mentioned below. When the present application mentions the terms "first" or "second" and other ordinal numbers, unless they do express the meaning of order according to the context, it should be understood that they are only used for distinction.
[0029] The terms "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other implementations or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0030] Unless otherwise specified, the " / " in this document generally indicates that the objects before and after the association are in an "or" relationship. For example, A / B can mean A or B. The term "and / or" is only a description of the association relationship between the objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of this application, "multiple" means two or more.
[0031] Rich Text Editor (RTE) is a text editor that can be embedded in a browser and is WYSIWYG. Rich text editors can be used to edit articles and other content and save them in Html format. Html is Hyper Text Markup Language, which is an application standard under the standard universal markup language. Html is not a programming language, but a markup language, which is essential for web page production. When rendering the saved content of the rich text editor (such as an article), all APP article content is currently rendered in the form of webview components, that is, the web page renders the content of the editor. Since webview is a component carried in the APP, it is used to display the results after the network request, that is, the results of the url network request are displayed in it. Therefore, the existing rich text editor content is output to the outside in the form of a string, that is, when the editor inputs content / inserts pictures and other operations, the final output content cannot be WYSIWYG on the APP Native side, and can only be parsed in a targeted manner on the html business side of the web page to achieve the WYSIWYG mode.
[0032] Existing rich text editors usually use c / s architecture, but with the advent of the mobile Internet era, rich text editors based on c / s architecture do not conform to the trend of mobile web development. Therefore, most of the rich text editors currently used are dom version editors. There is also a Canvas version rich text editor on the market, which can realize pagination and rich text editing with headers and footers.
[0033] Canvas is a new tag in HTML5. The Canvas tag is a graphic container. Simply put, it is a canvas on which you can draw rectangles, circles, triangles, polylines, etc.
[0034] Canvas-based rich text editors usually need to have a blinking cursor when writing. When selecting a text block, the selection needs to be drawn along the range selected by the mouse. This drawing requires a high redrawing speed, but when the document content has not changed, there is no need to track the changes in the selection and redraw with the blinking cursor. In the current existing Canvas editors, when drawing the entire content and when the amount of text is small, the overall redrawing will not affect writing, but when the amount of text is large, the redrawing is very slow and cannot meet the writing requirements.
[0035] For example, as hospitals' requirements for informatization become higher and higher, Canvas-based rich text editors are becoming more and more widely used when writing medical records. When the medical record text to be written is small, the overall redrawing will not affect the writing, but when the amount of medical record text is large, the redrawing will be very stuck, causing unnecessary trouble to medical staff.
[0036] In view of this, the present application provides a text editing method, which is applied to a rich text editor, wherein the rich text editor includes a low-frequency drawing part and a high-frequency drawing part. By separating the text drawn in the low-frequency drawing part and the cursor and selection area drawn in the high-frequency drawing part, when the document content needs to be changed, only the changed area of the underlying canvas needs to be redrawn. Such a text drawing method does not need to occupy more resources, thereby making the rich text editor have a higher drawing efficiency.
[0037] The following is a brief introduction to the scenarios to which the text redrawing method provided in the embodiments of the present application is applicable.
[0038] In a possible application scenario, when a doctor is writing an electronic medical record, he or she may use the text drawing method of the rich text editor provided in the embodiment of the present application.
[0039] In another possible scenario, a teacher may use the text drawing method of the rich text editor provided in the embodiment of the present application when writing courseware during teaching.
[0040] The text redrawing method provided by the present application is exemplarily described below with reference to specific examples. Figure 1 FIG. 4 shows a schematic flow chart of text redrawing provided by an embodiment of the present application. Figure 1 As shown, the text redrawing method includes: S110 to S150.
[0041] S110 , determining text coordinates of the text to be edited in the low-frequency redrawing layer according to the click coordinates of the user in the high-frequency redrawing layer.
[0042] In the embodiment of the present application, the text coordinates of the text to be edited in the low-frequency redrawing layer can be determined according to the click coordinates of the user in the high-frequency redrawing layer.
[0043] Specifically, when the user needs to edit the text to be edited, he first clicks on the editing area on the rich text editor provided in the embodiment of the present application. Since the upper layer of the rich text editor is the high-frequency redrawing layer, the high-frequency redrawing layer will first receive the user's click coordinates. Since the coordinates of the low-frequency redrawing layer and the high-frequency redrawing layer coincide with each other, when the user clicks on the high-frequency redrawing layer, the low-frequency redrawing layer will also obtain the user's click coordinates. Then, the low-frequency redrawing layer obtains the text coordinates of the text to be edited at the click location according to the click coordinates.
[0044] For example, if the text to be edited by the user is the two characters "User", when the click coordinates of the user are between the characters "Disease" and "Case", the low-frequency redrawing layer can obtain the text coordinates of "Medical Record" according to the click coordinates.
[0045] S120: The high-frequency redrawing layer moves the cursor position according to the text coordinates of the text to be edited.
[0046] It is understandable that after the user clicks on the editing area on the editor, the cursor may not be displayed at the text coordinates of the text to be edited, so the cursor needs to be moved to the text coordinates of the text to be edited.
[0047] In an embodiment of the present application, the low-frequency redrawing layer notifies the high-frequency redrawing layer to move the cursor to the coordinate position of the text to be edited, and the high-frequency redrawing layer moves the cursor to the new position after receiving the information of moving the cursor.
[0048] It is worth noting that the low-frequency redrawing layer is only responsible for redrawing the text, not the cursor. Therefore, the low-frequency redrawing layer needs to send the information of moving the cursor to the high-frequency redrawing layer, and the high-frequency redrawing layer is responsible for redrawing the cursor.
[0049] Exemplarily, the low-frequency redrawing layer sends the acquired text coordinates of “Medical Records” to the high-frequency redrawing layer, and the high-frequency redrawing layer moves the cursor to the front of the text coordinates of “Medical Records”.
[0050] S130 : re-editing the text to be edited based on the cursor position of the high-frequency redrawing layer.
[0051] In an embodiment of the present application, when the user obtains a cursor position at which text can be redrawn, the text to be edited can be re-edited based on the cursor position.
[0052] Specifically, when the cursor is displayed on the high-frequency redrawing layer, the user can see that the cursor is located before the text to be edited on the rich text editor, and then the user can re-enter the text on the editor to edit the text.
[0053] S140: The low-frequency redrawing layer redraws text according to the text entered by the high-frequency redrawing layer.
[0054] It is understandable that since the upper layer of the editor is the high-frequency redrawing layer, which is a transparent layer, and the high-frequency redrawing layer is only responsible for redrawing the cursor, not for redrawing the text, when the user redraws the text to be edited on the high-frequency redrawing layer, the re-editing of the text to be edited is not completed, and the low-frequency redrawing layer is needed to re-edit the text to be edited according to the text entered in the high-frequency redrawing layer.
[0055] In an embodiment of the present application, the high-frequency redrawing layer notifies the low-frequency redrawing layer of the entered text information, and then the low-frequency redrawing layer redraws the text to be edited according to the entered text information.
[0056] S150, the high-frequency redrawing layer moves the cursor position according to the coordinates of the edited text.
[0057] In the embodiment of the present application, after the low-frequency redrawing layer completes re-editing of the text to be edited, the high-frequency redrawing layer is notified to move the cursor to a new position.
[0058] Finally, after the high-frequency redrawing layer receives the information from the low-frequency redrawing layer, it moves the cursor behind the redrawn text, and then the text of the low-frequency redrawing layer is displayed on the editor through the transparent high-frequency layer, completing the editing of the text to be edited.
[0059] The text redrawing method provided in the embodiment of the present application designs a rich text editor in layers, so that the low-frequency drawing layer obtains the text coordinates of the text to be edited and sends the text coordinates to the high-frequency drawing layer, and then uses the high-frequency drawing layer to draw the text editing cursor position of the text to be edited. The user can enter text information at the text editing cursor position, and then the low-frequency drawing layer redraws the text to be edited according to the text information entered by the user. This method of separately redrawing the cursor and the text solves the problem of slow redrawing speed of the rich text editor and improves the text redrawing efficiency.
[0060] The rich text editor provided in the embodiment of the present application is described in detail below. Figure 2 A schematic diagram of a rich text editor provided by an embodiment of the present application is shown, such as Figure 2 As shown, the rich text editor includes: a low-frequency drawing layer 210 and a high-frequency drawing layer 220. The low-frequency drawing layer 210 includes a first canvas, and the high-frequency drawing layer 220 includes a second canvas.
[0061] Optionally, the first canvas is located at the bottom layer of the second canvas, the first canvas and the second canvas are located in the same coordinate system, and the high-frequency drawing layer is a transparent layer.
[0062] The low-frequency drawing layer 210 is used to obtain text coordinates of the text to be edited; determine the text editing cursor position of the high-frequency drawing layer on the second canvas according to the text coordinates; and redraw the text to be edited on the first canvas according to the text information.
[0063] Optionally, the low-frequency drawing layer 210 is further used to obtain text coordinates of the to-be-edited text at the click coordinates according to the click coordinates of the user.
[0064] Optionally, the low-frequency drawing layer 210 is further used to send the text coordinates of the text to be edited to the high-frequency drawing layer.
[0065] Optionally, the low-frequency drawing layer 210 is further configured to redraw the text to be edited on the first canvas according to the received first instruction.
[0066] The high-frequency drawing layer 220 is used to move the cursor position on the second canvas to the text editing cursor position.
[0067] Optionally, the high-frequency drawing layer 220 is further used to determine the text editing cursor position on the second canvas according to the text coordinates of the text to be edited;
[0068] Optionally, the high-frequency drawing layer 220 is also used to display the redrawn text information.
[0069] Optionally, the high-frequency drawing layer 220 is also used to move the cursor position according to the edited text to be edited.
[0070] Figure 3 Schematic diagram of a text redrawing device provided in an embodiment of the present application. Figure 3 As shown, the text redrawing device 300 provided in this embodiment includes: a processor 310, a memory 320, and a computer program 330 stored in the memory 320 and executable on the processor 310. When the processor 310 executes the computer program 330, the steps in the above-mentioned various text redrawing method embodiments are implemented, such as Figure 1 Alternatively, when the processor 310 executes the computer program 330, the functions of each module / unit in the above-mentioned device embodiments are implemented, for example Figure 2 The functions of modules 210-220 are shown.
[0071] Exemplarily, the computer program 330 may be divided into one or more modules / units, which are stored in the memory 320 and executed by the processor 310 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 330 in the text redrawing device 300.
[0072] The text redrawing device 300 may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server or a host computer. The text redrawing device may include, but is not limited to, a processor 310 and a memory 320. Those skilled in the art will understand that Figure 3 It is only an example of a text redrawing device and does not constitute a limitation of the text redrawing device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the text redrawing device may also include input and output devices, network access devices, buses, etc.
[0073] The processor 310 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0074] The memory 320 may be an internal storage unit of the text redrawing device 300, such as a hard disk or memory of the text redrawing device 300. The memory 320 may also be an external storage device of the text redrawing device 300, such as a plug-in hard disk, a memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the text redrawing device 300. Further, the memory 320 may also include both an internal storage unit of the text redrawing device 300 and an external storage device. The memory 320 is used to store the computer program and other programs and data required by the text redrawing device. The memory 320 may also be used to temporarily store data that has been output or is to be output.
[0075] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0076] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned text redrawing method can be implemented.
[0077] An embodiment of the present application provides a computer program product. When the computer program product runs on a text redrawing device, the text redrawing device implements the above-mentioned text redrawing method when executing the computer program product.
[0078] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0079] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0080] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0081] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0082] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0083] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0084] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0085] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for redrawing text, It is characterized in that The method is applied to a rich text editor, the rich text editor comprising: a low-frequency drawing layer and a high-frequency drawing layer, the low-frequency drawing layer comprising a first canvas, the high-frequency drawing layer comprising a second canvas, and the method comprising: The low-frequency drawing layer obtains text coordinates of the text to be edited at the click coordinates according to the click coordinates of the user; The low-frequency drawing layer sends the text coordinates of the text to be edited to the high-frequency drawing layer; The high-frequency drawing layer determines the position of the text editing cursor on the second canvas according to the text coordinates of the text to be edited, and redraws the text editing cursor; The user inputs text information at the text editing cursor position on the second canvas of the high-frequency drawing layer; The low-frequency drawing layer redraws the text to be edited on the first canvas according to the received first instruction, where the first instruction is text information sent by the high-frequency drawing layer to the low-frequency drawing layer.
2. The method according to claim 1, It is characterized in that The high-frequency drawing layer is a transparent layer, and the method further includes: The redrawn text information is displayed through the high-frequency drawing layer.
3. The method according to claim 1 or 2, It is characterized in that The method further comprises: The high-frequency drawing layer moves the cursor position according to the edited text to be edited.
4. A rich text editor device, It is characterized in that The rich text editor device comprises: a low-frequency drawing layer module and a high-frequency drawing layer module, the low-frequency drawing layer module comprises a first canvas, the high-frequency drawing layer module comprises a second canvas, and the rich text editor device is used to execute the method according to any one of claims 1 to 3.
5. The rich text editor device according to claim 4, It is characterized in that The first canvas is located at the bottom layer of the second canvas, the first canvas and the second canvas are located in the same coordinate system, and the second canvas is a transparent canvas.
6. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.
7. A chip, It is characterized in that include: A processor, configured to call and run a computer program from a memory, so that a device equipped with the chip executes a method as claimed in any one of claims 1 to 3.
Citation Information
Patent Citations
General canvas input interface design method and device
CN105630939A