Rich text editing methods, devices, electronic devices, and computer-readable storage media

By recognizing and initializing rich text input signals and using preloaded editing scripts to render different types of rich text content, the problem of insufficient scalability of existing rich text editors is solved, enabling efficient editing of various types of content and improving user experience.

CN116226563BActive Publication Date: 2026-03-03SHENZHEN FULIN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-21
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing rich text editors have poor extensibility and cannot support chart editing functions, forcing users to use separate chart drawing tools, which reduces the user experience.

Method used

By recognizing the type in the rich text input signal, the editing page is initialized, and pre-loaded rich text editing scripts are used to render different types of rich text content, supporting editing of various types such as tables, mathematical formulas, and plots.

Benefits of technology

It enables independent editing of multiple types of rich text content within the same rich text editor, improving editing efficiency and user experience, and reducing reliance on other editing software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116226563B_ABST
    Figure CN116226563B_ABST
Patent Text Reader

Abstract

This invention relates to text editing technology and discloses a rich text editing method, comprising: responding to a rich text input signal generated in a rich text editor, identifying the rich text type in the rich text input signal; initializing the editing page of the rich text editor according to the rich text type, receiving and identifying rich text content entered by a user on the editing page, converting the rich text content into a preset data format and storing it in a corresponding preset data container; acquiring and activating a pre-loaded rich text editing script in the rich text editor corresponding to the rich text type; and using the rich text editing script to render the rich text content in each of the corresponding data containers according to the preset data format. This invention also proposes a rich text editing device, an electronic device, and a computer-readable storage medium. This invention can improve the efficiency of rich text editing and the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of text editing technology, and in particular to a rich text editing method, apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] Rich text is a document rendered and calculated by a rich text editor before being presented to the user, providing a WYSIWYG (What You See Is What You Get) experience. Currently, most widely used rich text editors employ HTML (Hypertext Markup Language) data format. These editors can be embedded in browsers, allowing users to write, format, and publish content within web pages.

[0003] However, these rich text editors typically have limited extensibility and support a limited number of rich text types. For example, this particular rich text editor may not support chart editing and cannot generate corresponding bar charts, pie charts, etc., based on the table data. In such cases, users can only use chart drawing tools to create the chart, save the image as an image file, and then insert the image into the rich text document. This process requires users to maintain both the chart data and the corresponding rich text document, causing inconvenience for subsequent maintenance and use, and reducing the user experience. Summary of the Invention

[0004] This invention provides a rich text editing method, apparatus, electronic device, and computer-readable storage medium, the main purpose of which is to improve the efficiency and user experience of rich text editing.

[0005] To achieve the above objectives, the present invention provides a rich text editing method, comprising:

[0006] In response to a rich text input signal generated in a rich text editor, the rich text type in the rich text input signal is identified;

[0007] The rich text editor's editing page is initialized according to the rich text type, the rich text content entered by the user on the editing page is received and recognized, the rich text content is converted into a preset data format and stored in the corresponding preset data container;

[0008] Retrieve and activate the preloaded rich text editing script in the rich text editor corresponding to the rich text type;

[0009] Using the rich text editing script, the rich text content in each of the corresponding data containers is rendered according to the preset data format.

[0010] Optionally, the rich text type is identified by the following method:

[0011] Determine whether the rich text input signal is generated via a menu or a special input character method;

[0012] When the generation method is a menu method, the rich text type corresponding to each menu method is obtained according to the preset menu and rich text type mapping table;

[0013] When the generation method is a special input character method, the special input character in the special input character method is identified, and the corresponding rich text type is determined based on the special input character.

[0014] Optionally, determining the corresponding rich text type based on the special input character includes:

[0015] When the special input character contains " / math", the corresponding rich text type is determined to be a mathematical formula type;

[0016] When the special input character contains "```mermaid", the corresponding rich text type is determined to be a normal drawing type;

[0017] When the special input character contains " / uml", the corresponding rich text type is determined to be the advanced drawing type.

[0018] Optionally, the rich text content is identified using the following method:

[0019] When the rich text type is a normal chart type, according to the preset table data rules, the data in each cell of the input table is labeled in turn to obtain the label corresponding to each cell, and the data in each cell and the corresponding label are used as the rich text content of the input table;

[0020] When the rich text type is a mathematical formula type, the string between the preset formula wildcards is extracted as the corresponding rich text content.

[0021] Optionally, activating the rich text editing script preloaded by the rich text editor corresponding to the rich text type includes:

[0022] Obtain the rich text attributes corresponding to each of the rich text types;

[0023] Register the rich text attribute in the rich text editor.

[0024] Optionally, the step of using the rich text editing script to render the rich text in each of the corresponding data containers according to the preset data format includes:

[0025] When the preset data format corresponding to the rich text in the data container is a table format, the graphic type corresponding to the table format is obtained, and the rich text editing script corresponding to the ordinary chart type is used to convert the rich text content in the corresponding data container into the graphic corresponding to the graphic type.

[0026] When the preset data format corresponding to the rich text in the data container is a formula format, the formula type corresponding to the formula format is identified, and the rich text editing script corresponding to the mathematical formula type is used to convert the rich text content in the corresponding data container into text of the data structure corresponding to the formula type.

[0027] When the preset data format corresponding to the rich text in the data container is a normal graphic element format, an editing layer corresponding to the normal graphic element format is generated, and the rich text editing script corresponding to the normal drawing type is used to parse the data syntax corresponding to the rich text content in the editing layer, and generate a normal drawing of the rich text content in the corresponding data container according to the data syntax.

[0028] When the preset data format corresponding to the rich text in the data container is an advanced primitive format, a floating frame page corresponding to the advanced primitive format is created, and the rich text editing script corresponding to the advanced drawing type is used to load the drawing editing plugin corresponding to the advanced primitive format in the floating frame page to generate an advanced drawing of the rich text content in the corresponding data container.

[0029] Optionally, after rendering the rich text in each content container according to the preset data format using the rich text editing script, the method further includes:

[0030] Generate an image in a preset format corresponding to the rendered rich text content, and save the image in the preset format;

[0031] In response to a message about browsing rich text content, display an image in a preset format corresponding to the rich text content.

[0032] To address the above problems, the present invention also provides a rich text editing device, the device comprising:

[0033] A rich text type recognition module is used to identify the rich text type in the rich text input signal in response to the rich text input signal generated in the rich text editor;

[0034] The content conversion and storage module is used to initialize the editing page of the rich text editor according to the rich text type, receive and recognize the rich text content entered by the user on the editing page, convert the rich text content into a preset data format and store it in the corresponding preset data container;

[0035] The rich text editing script activation module is used to obtain and activate the rich text editing script preloaded by the rich text editor corresponding to the rich text type.

[0036] The rich text rendering module is used to render the rich text content in each of the corresponding data containers according to the preset data format using the rich text editing script.

[0037] To address the above problems, the present invention also provides an electronic device, the electronic device comprising:

[0038] Memory, storing at least one computer program; and

[0039] The processor executes the program stored in the memory to implement the rich text editing method described above.

[0040] To address the aforementioned problems, the present invention also provides a computer-readable storage medium storing at least one computer program, which is executed by a processor in an electronic device to implement the rich text editing method described above.

[0041] According to the rich text content type input by the user, the corresponding rich text content is converted into a preset data format and stored in a preset data container. Then, the rich text editing script corresponding to the rich text type, which is preloaded by the rich text editor, is invoked to render the rich text content in each data container according to the preset data format. This supports independent editing of multiple rich text types in the same rich text editor. In addition to using the rich text editor, users do not need to use other editing software corresponding to the rich text types, thereby improving the editing efficiency and user experience of rich text. Attached Figure Description

[0042] Figure 1 This is a flowchart illustrating a rich text editing method provided in an embodiment of the present invention;

[0043] Figure 2 A detailed implementation flowchart of one step in a rich text editing method provided in an embodiment of the present invention is shown below;

[0044] Figure 3 A detailed implementation flowchart of another step in a rich text editing method provided in an embodiment of the present invention is shown below;

[0045] Figure 4 This is a functional block diagram of a rich text editing device provided in an embodiment of the present invention;

[0046] Figure 5This is a schematic diagram of the structure of an electronic device that implements the rich text editing method according to an embodiment of the present invention.

[0047] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0048] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0049] This application provides a rich text editing method. The executing entity of the rich text editing method includes, but is not limited to, at least one of the following: a server, a terminal, or an electronic device that can be configured to execute the method provided in this application. In other words, the rich text editing method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0050] Reference Figure 1 The diagram shown is a flowchart illustrating a rich text editing method according to an embodiment of the present invention. In this embodiment, the rich text editing method includes:

[0051] S1. In response to a rich text input signal generated in a rich text editor, identify the rich text type in the rich text input signal;

[0052] Compared to the currently widely used rich text editors based on HMTL (Hypertext Markup Language), the rich text editor described in this embodiment of the invention can be developed using JSON technology (JavaScript Object Notation), and the documents generated by using this rich text editor will all be saved in JSON format.

[0053] For example, the tag pairs used by a rich text editor developed using the HTML language are:

[0054] aaa bbb

[0055] The tag pairs used by rich text editors developed using JSON are:

[0056] {blocks:[

[0057] {type:'text',text:[{insert:'aaa'}]},

[0058] {type:'text',text:[{insert:'bbb'}]}

[0059] ]}

[0060] In this embodiment of the invention, the rich text input signal refers to the signal generated when an ordinary user inputs rich text content according to the menu or shortcut keys of the rich text editor. The rich text content can be rich text such as tables, mathematical formulas, and drawing primitives.

[0061] For details, please refer to Figure 2 As shown, identifying the rich text type in the rich text input signal includes:

[0062] S11. Determine whether the rich text input signal is generated via a menu or a special input character method;

[0063] When the generation method is a menu method, then execute S12 and obtain the rich text type corresponding to each menu method according to the preset menu and rich text type mapping table;

[0064] When the generation method is a special input character method, then S13 is executed to identify the special input character in the special input character method and determine the corresponding rich text type based on the special input character.

[0065] In this embodiment of the invention, the menu method includes the normal menu, shortcut menu, or shortcut key method provided by the rich text editor. For example, when using the rich text editor, one can right-click the mouse and select the shortcut menu to insert a certain type of rich text data to enter the rich text editing page of that type.

[0066] In this embodiment of the invention, the preset menu and rich text type mapping table is used to define the correspondence between each menu item and the corresponding rich text type.

[0067] In this embodiment of the invention, the rich text types include, but are not limited to, ordinary chart types, mathematical formula types, ordinary plot types, and advanced plot types. The ordinary chart type refers to data organized according to a two-dimensional data table and line charts, bar charts, and pie charts generated from that two-dimensional table. The mathematical formula type can be a LaTeX mathematical expression, for example, $x+y=z$. The ordinary plot type can be plot data such as Gantt charts, flowcharts, sequence diagrams, and class diagrams based on Markdown text syntax. The advanced plot type can be text and image data generated by software or scripts that support manual plotting, such as DrawIO data.

[0068] Furthermore, the step of determining the corresponding rich text type based on the special input character includes:

[0069] When the special input character contains " / math", the corresponding rich text type is determined to be the mathematical formula type;

[0070] When the special input character contains "```mermaid", the corresponding rich text type is determined to be the ordinary drawing type;

[0071] When the special input character contains " / uml", the corresponding rich text type is determined to be the advanced drawing type.

[0072] In this embodiment of the invention, after identifying the rich text type corresponding to the input rich text information, it is also necessary to extract the corresponding rich text content.

[0073] The present invention obtains the rich text type input by the user, which is beneficial for subsequently using appropriate methods to edit the corresponding rich text content for different rich text types, thereby improving the efficiency of rich text editing.

[0074] S2. Initialize the editing page of the rich text editor according to the rich text type, receive and recognize the rich text content entered by the user on the editing page, convert the rich text content into a preset data format and store it in the corresponding preset data container;

[0075] In this embodiment of the invention, the editing page refers to the user interface for inputting rich text content. The editing page includes, but is not limited to, areas such as toolbars, status bars, and text input boxes. It is understood that different rich text types require different tools, menus, and editing area sizes during input or editing. Therefore, initializing the rich text editor's editing page according to the rich text type allows for customization of the editing page for each rich text type.

[0076] For details, please refer to Figure 3As shown, receiving and recognizing the rich text content entered by the user on the editing page includes:

[0077] S21. Obtain the rich text type;

[0078] When the rich text type is a normal chart type, then execute S22: according to the preset table data rules, label the data in each cell of the input table in turn to obtain the label corresponding to each cell, and use the data in each cell and the corresponding label as the rich text content of the input table;

[0079] When the rich text type is a mathematical formula type, then S23 is executed to extract the string between the preset formula wildcards as the corresponding rich text content.

[0080] For example, each cell K(i,j) of the input table is labeled sequentially according to the following preset tabular data rules, where K represents any cell in the input table, i represents the row number, and j represents the column number:

[0081] 1. When i=1 and j=1, the label for K(i,j) is the chart type, wherein the chart type includes, but is not limited to, line chart, bar chart and pie chart;

[0082] 2. When i = 1 and j is not equal to 1, the label K(i, j) is a numerical category, for example, employee A, employee B;

[0083] 3. When i is not equal to 1 and j = 1, the label for K(i, j) is a series name, such as income, age, years of service, etc.

[0084] 4. When i is not equal to 1 and j is not equal to 1, the label of K(i, j) is a normal value.

[0085] For example, when the rich text type is a mathematical formula type, the preset formula wildcard can be $ or $$. By searching for the matching $ or $$, the text between $ and $, or the text between $$ and $$, is used as the rich text content.

[0086] In this embodiment of the invention, the preset data format includes, but is not limited to, table formats for representing ordinary tabular data, such as pie chart table formats, line chart table formats, and bar chart table formats; formula formats for representing mathematical formula data, such as formulas containing integral symbols, formulas containing square roots, cosine formulas, etc.; ordinary primitive formats for representing ordinary plotting data, such as judgment primitive formats, start primitive formats, etc.; and advanced primitive formats for representing advanced plotting data, such as parent primitive formats, child primitive formats, etc.

[0087] In this embodiment of the invention, the data container is used to store rich text content of a specific rich text type or a preset data format. That is, rich text belonging to the same rich text type can be stored in the same data container, or data of each data format corresponding to the same rich text type can be stored in different data containers. This operation helps to ensure that the rich text editor supports concurrent editing of multiple types of rich text.

[0088] S3. Obtain and activate the rich text editing script preloaded by the rich text editor corresponding to the rich text type;

[0089] In this embodiment of the invention, the rich text editor supports the editing of the aforementioned types of rich text by pre-loading different rich text editing scripts.

[0090] Specifically, activating the rich text editing script preloaded by the rich text editor corresponding to the rich text type includes:

[0091] Obtain the rich text attributes corresponding to each of the rich text types;

[0092] Register the rich text attribute in the rich text editor.

[0093] In this embodiment of the invention, the rich text editor assigns different text attributes to each type of rich text. For example, the rich text attribute for ordinary chart type is chart, the rich text attribute for mathematical formula type is math, the rich text attribute for ordinary drawing type is embedType:mermaid, and the rich text attribute for advanced drawing type is embedType:drawio.

[0094] For example, add the following record to the rich text editor to complete the registration of the chart attribute in the rich text editor:

[0095] {blocks:[

[0096] {type:'table',chart:boolean}

[0097] ]}

[0098] In this embodiment of the invention, by registering the rich text attributes corresponding to each rich text type in the rich text editor, the rich text editing script corresponding to each rich text type is activated or started.

[0099] S4. Using the rich text editing script, render the rich text content in each of the corresponding data containers according to the preset data format.

[0100] In this embodiment of the invention, the rich text rendering process differs depending on the rich text type and the preset data format.

[0101] In detail, the step of using the rich text editing script to render the rich text content in each of the corresponding data containers according to the preset data format includes:

[0102] When the preset data format corresponding to the rich text in the data container is a table format, the graphic type corresponding to the table format is obtained, and the rich text editing script corresponding to the ordinary chart type is used to convert the rich text content in the corresponding data container into the graphic corresponding to the graphic type.

[0103] When the preset data format corresponding to the rich text in the data container is a formula format, the formula type corresponding to the formula format is identified, and the rich text editing script corresponding to the mathematical formula type is used to convert the rich text content in the corresponding data container into text of the data structure corresponding to the formula type.

[0104] When the preset data format corresponding to the rich text in the data container is a normal graphic element format, an editing layer corresponding to the normal graphic element format is generated, and the rich text editing script corresponding to the normal drawing type is used to parse the data syntax corresponding to the rich text content in the editing layer, and generate a normal drawing of the rich text content in the corresponding data container according to the data syntax.

[0105] When the preset data format corresponding to the rich text in the data container is an advanced primitive format, a floating frame page corresponding to the advanced primitive format is created, and the rich text editing script corresponding to the advanced drawing type is used to load the drawing editing plugin corresponding to the advanced primitive format in the floating frame page to generate an advanced drawing of the rich text content in the corresponding data container.

[0106] In one optional embodiment of the present invention, the graphic type corresponding to the table format includes, but is not limited to, line chart, bar chart, or pie chart.

[0107] In an optional embodiment of the present invention, when the rich text type is a mathematical formula type, the rich text editing script corresponding to the mathematical formula type is used to convert the text between paired $ and $ or the text between $$ and $$ into a MathBox data structure in the rich text editor, and then the text of the MathBox data structure is converted into the corresponding mathematical formula based on LaTeX syntax.

[0108] In an optional embodiment of the present invention, taking the rich text corresponding to the Mermaid drawing tool as an example, the method for editing the rich text corresponding to the ordinary drawing type is described. An editing layer is generated using a corresponding rich text editing script, and the rich text content entered by the user in the editing layer is converted into a text structure conforming to Markdown syntax. Then, the rich text script is used to render the converted text.

[0109] In an optional embodiment of the present invention, taking the rich text corresponding to the DrawIO drawing tool as an example, the method for editing the rich text corresponding to the advanced drawing type is described. Considering that DrawIO cannot be simply embedded into the rich text editor, support for DrawIO can be achieved using an iframe floating frame. When the user inputs the rich text corresponding to the advanced drawing type, an iframe floating frame page is created through the corresponding rich text script, and the DrawIO editing page is loaded in the floating frame page for user operation.

[0110] In another optional embodiment of the present invention, after rendering the rich text in each of the corresponding data containers according to the preset data format using the rich text editing script, the loading efficiency of the page corresponding to the rich text content can be improved by the following method:

[0111] Generate an image in a preset format corresponding to the rendered rich text content, and save the image in the preset format;

[0112] In response to a message about browsing rich text content, display an image in a preset format corresponding to the rich text content.

[0113] In this embodiment of the invention, the preset format can be set according to actual business needs, such as SVG format. For example, the rendered rich text content can be saved as an SVG image and uploaded to a designated server for storage. When the corresponding page needs to be loaded, the SVG image of the corresponding page can be loaded directly without calling the corresponding rich text editing script to render the rich text content on the page again. This operation can improve the loading efficiency of the rich text editing page.

[0114] In another optional embodiment of the present invention, the rich text editor supports changes to rich text through the following method:

[0115] When a rich text editor generates a rich text change signal, a corresponding rich text editing layer is generated;

[0116] The changed data in the editing layer is identified, and the corresponding rich text editing script is invoked to render the changed data.

[0117] According to the rich text content type input by the user, the corresponding rich text content is converted into a preset data format and stored in a preset data container. Then, the rich text editing script corresponding to the rich text type, which is preloaded by the rich text editor, is invoked to render the rich text content in each data container according to the preset data format. This supports independent editing of multiple rich text types in the same rich text editor. In addition to using the rich text editor, users do not need to use other editing software corresponding to the rich text types, thereby improving the editing efficiency and user experience of rich text.

[0118] like Figure 4 The diagram shown is a functional block diagram of a rich text editing device provided in an embodiment of the present invention.

[0119] The rich text editing device 100 of this invention can be installed in an electronic device. Depending on the functions implemented, the rich text editing device 100 includes: a rich text type recognition module 101, a content conversion and storage module 102, a rich text editing script activation module 103, and a rich text rendering module 104. The module described in this invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and which are stored in the memory of the electronic device.

[0120] In this embodiment, the functions of each module / unit are as follows:

[0121] The rich text type recognition module 101 is used to recognize the rich text type in the rich text input signal in response to the rich text input signal generated in the rich text editor.

[0122] The content conversion and storage module 102 is used to initialize the editing page of the rich text editor according to the rich text type, receive and recognize the rich text content entered by the user on the editing page, convert the rich text content into a preset data format and store it in the corresponding preset data container;

[0123] The rich text editing script activation module 103 is used to obtain and activate the rich text editing script preloaded by the rich text editor corresponding to the rich text type.

[0124] The rich text rendering module 104 is used to render the rich text content in each of the corresponding data containers according to the preset data format using the rich text editing script.

[0125] The specific implementation methods of each module of the rich text editing device 100 are as follows:

[0126] Step 1: In response to the rich text input signal generated in the rich text editor, identify the rich text type in the rich text input signal;

[0127] Compared to the currently widely used rich text editors based on HMTL (Hypertext Markup Language), the rich text editor described in this embodiment of the invention can be developed using JSON technology (JavaScript Object Notation), and the documents generated by using this rich text editor will all be saved in JSON format.

[0128] For example, the tag pairs used by a rich text editor developed using the HTML language are:

[0129] aaa bbb

[0130] The tag pairs used by rich text editors developed using JSON are:

[0131] {blocks:[

[0132] {type:'text',text:[{insert:'aaa'}]},

[0133] {type:'text',text:[{insert:'bbb'}]}

[0134] ]}

[0135] In this embodiment of the invention, the rich text input signal refers to the signal generated when an ordinary user inputs rich text content according to the menu or shortcut keys of the rich text editor. The rich text content can be rich text such as tables, mathematical formulas, and drawing primitives.

[0136] Specifically, identifying the rich text type in the rich text input signal includes:

[0137] Determine whether the rich text input signal is generated via a menu or a special input character method;

[0138] When the generation method is a menu method, the rich text type corresponding to each menu method is obtained according to the preset menu and rich text type mapping table;

[0139] When the generation method is a special input character method, the special input character in the special input character method is identified, and the corresponding rich text type is determined based on the special input character.

[0140] In this embodiment of the invention, the menu method includes the normal menu, shortcut menu, or shortcut key method provided by the rich text editor. For example, when using the rich text editor, one can right-click the mouse and select the shortcut menu to insert a certain type of rich text data to enter the rich text editing page of that type.

[0141] In this embodiment of the invention, the preset menu and rich text type mapping table is used to define the correspondence between each menu item and the corresponding rich text type.

[0142] In this embodiment of the invention, the rich text types include, but are not limited to, ordinary chart types, mathematical formula types, ordinary plot types, and advanced plot types. The ordinary chart type refers to data organized according to a two-dimensional data table and line charts, bar charts, and pie charts generated from that two-dimensional table. The mathematical formula type can be a LaTeX mathematical expression, for example, $x+y=z$. The ordinary plot type can be plot data such as Gantt charts, flowcharts, sequence diagrams, and class diagrams based on Markdown text syntax. The advanced plot type can be text and image data generated by software or scripts that support manual plotting, such as DrawIO data.

[0143] Furthermore, the step of determining the corresponding rich text type based on the special input character includes:

[0144] When the special input character contains " / math", the corresponding rich text type is determined to be the mathematical formula type;

[0145] When the special input character contains "```mermaid", the corresponding rich text type is determined to be the ordinary drawing type;

[0146] When the special input character contains " / uml", the corresponding rich text type is determined to be the advanced drawing type.

[0147] The present invention obtains the rich text type input by the user, which is beneficial for subsequently using appropriate methods to edit the corresponding rich text content for different rich text types, thereby improving the efficiency of rich text editing.

[0148] S2. Initialize the editing page of the rich text editor according to the rich text type, receive and recognize the rich text content entered by the user on the editing page, convert the rich text content into a preset data format and store it in the corresponding preset data container;

[0149] In this embodiment of the invention, the editing page refers to the user interface for inputting rich text content. The editing page includes, but is not limited to, areas such as toolbars, status bars, and text input boxes. It is understood that different rich text types require different tools, menus, and editing area sizes during input or editing. Therefore, initializing the rich text editor's editing page according to the rich text type allows for customization of the editing page for each rich text type.

[0150] Specifically, receiving and recognizing the rich text content entered by the user on the editing page includes:

[0151] When the rich text type is a normal chart type, according to the preset table data rules, the data in each cell of the input table is labeled in turn to obtain the label corresponding to each cell, and the data in each cell and the corresponding label are saved as preset table format text as the rich text content of the input table;

[0152] When the rich text type is a mathematical formula type, the string between the preset formula wildcards is extracted as the corresponding rich text content.

[0153] For example, each cell K(i,j) of the input table is labeled sequentially according to the following preset tabular data rules, where K represents any cell in the input table, i represents the row number, and j represents the column number:

[0154] 1. When i=1 and j=1, the label for K(i,j) is the chart type, wherein the chart type includes, but is not limited to, line chart, bar chart and pie chart;

[0155] 2. When i = 1 and j is not equal to 1, the label K(i, j) is a numerical category, for example, employee A, employee B;

[0156] 3. When i is not equal to 1 and j = 1, the label for K(i, j) is a series name, such as income, age, years of service, etc.

[0157] 4. When i is not equal to 1 and j is not equal to 1, the label of K(i, j) is a normal value.

[0158] For example, when the rich text type is a mathematical formula type, the preset formula wildcard can be $ or $$. By searching for the matching $ or $$, the text between $ and $, or the text between $$ and $$, is used as the rich text content.

[0159] In this embodiment of the invention, the preset data format includes, but is not limited to, table formats for representing ordinary tabular data, such as pie chart table formats, line chart table formats, and bar chart table formats; formula formats for representing mathematical formula data, such as formulas containing integral symbols, formulas containing square roots, cosine formulas, etc.; ordinary primitive formats for representing ordinary plotting data, such as judgment primitive formats, start primitive formats, etc.; and advanced primitive formats for representing advanced plotting data, such as parent primitive formats, child primitive formats, etc.

[0160] In this embodiment of the invention, the data container is used to store rich text content of a specific rich text type or a preset data format. That is, rich text belonging to the same rich text type can be stored in the same data container, or data of each data format corresponding to the same rich text type can be stored in different data containers. This operation helps to ensure that the rich text editor supports concurrent editing of multiple types of rich text.

[0161] Step 3: Obtain and activate the rich text editing script preloaded by the rich text editor corresponding to the rich text type;

[0162] In this embodiment of the invention, the rich text editor supports the editing of the aforementioned types of rich text by pre-loading different rich text editing scripts.

[0163] Specifically, activating the rich text editing script preloaded by the rich text editor corresponding to the rich text type includes:

[0164] Obtain the rich text attributes corresponding to each of the rich text types;

[0165] Register the rich text attribute in the rich text editor.

[0166] In this embodiment of the invention, the rich text editor assigns different text attributes to each type of rich text. For example, the rich text attribute for ordinary chart type is chart, the rich text attribute for mathematical formula type is math, the rich text attribute for ordinary drawing type is embedType:mermaid, and the rich text attribute for advanced drawing type is embedType:drawio.

[0167] For example, add the following record to the rich text editor to complete the registration of the chart attribute in the rich text editor:

[0168] {blocks:[

[0169] {type:'table',chart:boolean}

[0170] ]}

[0171] In this embodiment of the invention, by registering the rich text attributes corresponding to each rich text type in the rich text editor, the rich text editing script corresponding to each rich text type is activated or started.

[0172] Step 4: Using the rich text editing script, render the rich text content in each of the corresponding data containers according to the preset data format.

[0173] In this embodiment of the invention, the rich text rendering process differs depending on the rich text type and the preset data format.

[0174] In detail, the step of using the rich text editing script to render the rich text content in each of the corresponding data containers according to the preset data format includes:

[0175] When the preset data format corresponding to the rich text in the data container is a table format, the graphic type corresponding to the table format is obtained, and the rich text editing script corresponding to the ordinary chart type is used to convert the rich text content in the corresponding data container into the graphic corresponding to the graphic type.

[0176] When the preset data format corresponding to the rich text in the data container is a formula format, the formula type corresponding to the formula format is identified, and the rich text editing script corresponding to the mathematical formula type is used to convert the rich text content in the corresponding data container into text of the data structure corresponding to the formula type.

[0177] When the preset data format corresponding to the rich text in the data container is a normal graphic element format, an editing layer corresponding to the normal graphic element format is generated, and the rich text editing script corresponding to the normal drawing type is used to parse the data syntax corresponding to the rich text content in the editing layer, and generate a normal drawing of the rich text content in the corresponding data container according to the data syntax.

[0178] When the preset data format corresponding to the rich text in the data container is an advanced primitive format, a floating frame page corresponding to the advanced primitive format is created, and the rich text editing script corresponding to the advanced drawing type is used to load the drawing editing plugin corresponding to the advanced primitive format in the floating frame page to generate an advanced drawing of the rich text content in the corresponding data container.

[0179] In one optional embodiment of the present invention, the graphic type corresponding to the table format includes, but is not limited to, line chart, bar chart, or pie chart.

[0180] In an optional embodiment of the present invention, when the rich text type is a mathematical formula type, the rich text editing script corresponding to the mathematical formula type is used to convert the text between paired $ and $ or the text between $$ and $$ into a MathBox data structure in the rich text editor, and then the text of the MathBox data structure is converted into the corresponding mathematical formula based on LaTeX syntax.

[0181] In an optional embodiment of the present invention, taking the rich text corresponding to the Mermaid drawing tool as an example, the method for editing the rich text corresponding to the ordinary drawing type is described. An editing layer is generated using a corresponding rich text editing script, and the rich text content entered by the user in the editing layer is converted into a text structure conforming to Markdown syntax. Then, the rich text script is used to render the converted text.

[0182] In an optional embodiment of the present invention, taking the rich text corresponding to the DrawIO drawing tool as an example, the method for editing the rich text corresponding to the advanced drawing type is described. Considering that DrawIO cannot be simply embedded into the rich text editor, support for DrawIO can be achieved using an iframe floating frame. When the user inputs the rich text corresponding to the advanced drawing type, an iframe floating frame page is created through the corresponding rich text script, and the DrawIO editing page is loaded in the floating frame page for user operation.

[0183] In another optional embodiment of the present invention, after rendering the rich text in each of the corresponding data containers according to the preset data format using the rich text editing script, the loading efficiency of the page corresponding to the rich text content can be improved by the following method:

[0184] Generate an image in a preset format corresponding to the rendered rich text content, and save the image in the preset format;

[0185] In response to a message about browsing rich text content, display an image in a preset format corresponding to the rich text content.

[0186] In this embodiment of the invention, the preset format can be set according to actual business needs, such as SVG format. For example, the rendered rich text content can be saved as an SVG image and uploaded to a designated server for storage. When the corresponding page needs to be loaded, the SVG image of the corresponding page can be loaded directly without calling the corresponding rich text editing script to render the rich text content on the page again. This operation can improve the loading efficiency of the rich text editing page.

[0187] In another optional embodiment of the present invention, the rich text editor supports changes to rich text through the following method:

[0188] When a rich text editor generates a rich text change signal, a corresponding rich text editing layer is generated;

[0189] The changed data in the editing layer is identified, and the corresponding rich text editing script is invoked to render the changed data.

[0190] According to the embodiments of the present invention, the rich text content input by the user is converted into a preset data format and stored in a preset data container. Then, the rich text editing script corresponding to the rich text type preloaded by the rich text editor is invoked to render the rich text content in each data container according to the preset data format. This supports independent editing of multiple rich text types in the same rich text editor. In addition to using the rich text editor, the user does not need to use other editing software corresponding to the rich text types. Therefore, the rich text editing device provided by the present invention can improve the editing efficiency and user experience of rich text.

[0191] like Figure 5 The diagram shown is a structural schematic of an electronic device that implements a rich text editing method according to an embodiment of the present invention.

[0192] The electronic device 1 may include a processor 10, a memory 11, and a bus, and may also include a computer program, such as a rich text editing program, stored in the memory 11 and capable of running on the processor 10.

[0193] The memory 11 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as a portable hard drive. In other embodiments, the memory 11 can be an external storage device of the electronic device 1, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory 11 can include both internal and external storage units of the electronic device 1. The memory 11 can be used not only to store application software and various types of data installed on the electronic device 1, such as the code of a rich text editor, but also to temporarily store data that has been output or will be output.

[0194] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules (such as rich text editing programs) stored in the memory 11 and calls data stored in the memory 11 to perform various functions of the electronic device 1 and process data.

[0195] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 11 and at least one processor 10, etc.

[0196] Figure 5 Only electronic devices with components are shown; it will be understood by those skilled in the art that... Figure 5 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0197] For example, although not shown, the electronic device 1 may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.

[0198] Furthermore, the electronic device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the electronic device 1 and other electronic devices.

[0199] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 1 and to display a visual user interface.

[0200] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.

[0201] The rich text editing program stored in the memory 11 of the electronic device 1 is a combination of multiple instructions, which, when run in the processor 10, can achieve the following:

[0202] In response to a rich text input signal generated in a rich text editor, the rich text type in the rich text input signal is identified;

[0203] The rich text editor's editing page is initialized according to the rich text type, the rich text content entered by the user on the editing page is received and recognized, the rich text content is converted into a preset data format and stored in the corresponding preset data container;

[0204] Retrieve and activate the preloaded rich text editing script in the rich text editor corresponding to the rich text type;

[0205] Using the rich text editing script, the rich text content in each of the corresponding data containers is rendered according to the preset data format.

[0206] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).

[0207] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor of an electronic device, can perform the following:

[0208] In response to a rich text input signal generated in a rich text editor, the rich text type in the rich text input signal is identified;

[0209] The rich text editor's editing page is initialized according to the rich text type, the rich text content entered by the user on the editing page is received and recognized, the rich text content is converted into a preset data format and stored in the corresponding preset data container;

[0210] Retrieve and activate the preloaded rich text editing script in the rich text editor corresponding to the rich text type;

[0211] Using the rich text editing script, the rich text content in each of the corresponding data containers is rendered according to the preset data format.

[0212] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0213] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0214] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.

[0215] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.

[0216] The embodiments of this application can acquire and process relevant data based on holographic projection technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0217] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The term "second class" is used to indicate names and does not indicate any specific order.

[0218] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A rich text editing method, characterized in that, The method includes: In response to a rich text input signal generated in a rich text editor, the rich text type in the rich text input signal is identified; The rich text editor's editing page is initialized according to the rich text type, the rich text content entered by the user on the editing page is received and recognized, the rich text content is converted into a preset data format and stored in the corresponding preset data container; Retrieve and activate the preloaded rich text editing script in the rich text editor corresponding to the rich text type; Using the rich text editing script, the rich text content in each of the corresponding data containers is rendered according to the preset data format, including: When the preset data format corresponding to the rich text in the data container is a table format, the graphic type corresponding to the table format is obtained, and the rich text editing script corresponding to the ordinary chart type is used to convert the rich text content in the corresponding data container into the graphic corresponding to the graphic type. When the preset data format corresponding to the rich text in the data container is a formula format, the formula type corresponding to the formula format is identified, and the rich text editing script corresponding to the mathematical formula type is used to convert the rich text content in the corresponding data container into text of the data structure corresponding to the formula type. When the preset data format corresponding to the rich text in the data container is a normal graphic element format, an editing layer corresponding to the normal graphic element format is generated, and the data syntax corresponding to the rich text content in the editing layer is parsed using the rich text editing script corresponding to the normal drawing type. Based on the data syntax, a normal drawing of the rich text content in the corresponding data container is generated. When the preset data format corresponding to the rich text in the data container is an advanced primitive format, a floating frame page corresponding to the advanced primitive format is created, and the rich text editing script corresponding to the advanced drawing type is used to load the drawing editing plugin corresponding to the advanced primitive format in the floating frame page to generate an advanced drawing of the rich text content in the corresponding data container.

2. The rich text editing method as described in claim 1, characterized in that, The rich text type is identified using the following method: Determine whether the rich text input signal is generated via a menu or a special input character method; When the generation method is a menu method, the rich text type corresponding to each menu method is obtained according to the preset menu and rich text type mapping table; When the generation method is a special input character method, the special input character in the special input character method is identified, and the corresponding rich text type is determined based on the special input character.

3. The rich text editing method as described in claim 2, characterized in that, The step of determining the corresponding rich text type based on the special input character includes: When the special input character contains " / math", the corresponding rich text type is determined to be a mathematical formula type; When the special input character contains "```mermaid", the corresponding rich text type is determined to be a normal drawing type; When the special input character contains " / uml", the corresponding rich text type is determined to be an advanced drawing type.

4. The rich text editing method as described in claim 2, characterized in that, The rich text content is identified using the following method: When the rich text type is a normal chart type, according to the preset table data rules, the data in each cell of the input table is labeled in turn to obtain the label corresponding to each cell, and the data in each cell and the corresponding label are used as the rich text content of the input table; When the rich text type is a mathematical formula type, the string between the preset formula wildcards is extracted as the corresponding rich text content.

5. The rich text editing method as described in claim 1, characterized in that, The activation of the rich text editing script preloaded by the rich text editor corresponding to the rich text type includes: Obtain the rich text attributes corresponding to each of the rich text types; Register the rich text attribute in the rich text editor.

6. The rich text editing method as described in claim 1, characterized in that, After rendering the rich text in each data container according to the preset data format using the rich text editing script, the method further includes: Generate an image in a preset format corresponding to the rendered rich text content, and save the image in the preset format; In response to a message about browsing rich text content, display an image in a preset format corresponding to the rich text content.

7. A rich text editing apparatus for implementing the rich text editing method as described in any one of claims 1 to 6, characterized in that, The device includes: A rich text type recognition module is used to identify the rich text type in the rich text input signal in response to the rich text input signal generated in the rich text editor; The content conversion and storage module is used to initialize the editing page of the rich text editor according to the rich text type, receive and recognize the rich text content entered by the user on the editing page, convert the rich text content into a preset data format and store it in the corresponding preset data container; The rich text editing script activation module is used to obtain and activate the rich text editing script preloaded by the rich text editor corresponding to the rich text type. The rich text rendering module is used to render the rich text content in each of the corresponding data containers according to the preset data format using the rich text editing script.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the rich text editing method as described in any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the rich text editing method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • A generation method and device of a rich text editor

    CN109299444A

  • Content editing method and device, electronic equipment and storage medium

    CN113705174A