CN116226563A - Rich text editing method, rich text editing device, electronic equipment and computer readable storage medium - Google Patents

Rich text editing method, rich text editing device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN116226563A
CN116226563A CN202211648116.7A CN202211648116A CN116226563A CN 116226563 A CN116226563 A CN 116226563A CN 202211648116 A CN202211648116 A CN 202211648116A CN 116226563 A CN116226563 A CN 116226563A
Authority
CN
China
Prior art keywords
rich text
type
editing
format
rich
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211648116.7A
Other languages
Chinese (zh)
Inventor
王颖奇
冯斌
张其纲
魏拾俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Fulin Technology Co Ltd
Original Assignee
Shenzhen Fulin Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Fulin Technology Co Ltd filed Critical Shenzhen Fulin Technology Co Ltd
Priority to CN202211648116.7A priority Critical patent/CN116226563A/en
Publication of CN116226563A publication Critical patent/CN116226563A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to a text editing technology, and discloses a rich text editing method, which comprises the following steps: identifying a rich text type in a rich text input signal generated in a rich text editor in response to the rich text input signal; initializing an editing page of the rich text editor according to the rich text type, receiving and identifying rich text content input by a user on the editing page, converting the rich text content into a preset data format, and storing the data format into a corresponding preset data container; acquiring and activating a pre-loaded rich text editing script in a rich text editor corresponding to the rich text type; and rendering the rich text content in each corresponding data container according to the preset data format by utilizing the rich text editing script. The invention also provides a rich text editing device, electronic equipment and a computer readable storage medium. The method and the device can improve the efficiency and the user experience of the rich text editing.

Description

Rich text editing method, rich text editing device, electronic equipment and computer readable storage medium
Technical Field
The present invention relates to the field of text editing technologies, and in particular, to a rich text editing method, a rich text editing device, an electronic device, and a computer readable storage medium.
Background
Rich text is a document that is rendered and calculated by a rich text editor and then presented to the user, what you see is. Currently, a relatively widely used rich text editor mostly adopts an HTML (Hypertext Markup Language ) data format, and the rich text editor can be embedded in a browser to support a user to write, typeset and release contents in a webpage.
But typically such rich text editors have relatively poor expansion capabilities and limited types of rich text supported. For example, the rich text editor does not support a chart editing function, and cannot generate a histogram, pie chart, etc. of the response from the table data content. In this case, the user can only complete drawing of the chart by using the icon drawing tool alone, save the drawn image in a picture format, and then insert the picture into the rich text document. Thus, the operation user needs to maintain the chart data and the corresponding rich text document, which brings inconvenience to the subsequent maintenance and use of the user and reduces the user experience.
Disclosure of Invention
The invention provides a rich text editing method, a rich text editing device, electronic equipment and a computer readable storage medium, and mainly aims to improve the efficiency and user experience of rich text editing.
In order to achieve the above object, the present invention provides a rich text editing method, including:
identifying a rich text type in a rich text input signal generated in a rich text editor in response to the rich text input signal;
initializing an editing page of the rich text editor according to the rich text type, receiving and identifying rich text content input by a user on the editing page, converting the rich text content into a preset data format, and storing the data format into a corresponding preset data container;
acquiring and activating a pre-loaded rich text editing script in a rich text editor corresponding to the rich text type;
and rendering the rich text content in each corresponding data container according to the preset data format by utilizing the rich text editing script.
Optionally, the rich text type is identified by:
judging whether the generation mode of the rich text input signal is a menu mode or a special character input mode;
when the generation mode is a menu mode, acquiring a rich text type corresponding to each menu mode according to a preset menu and a rich text type mapping table;
and when the generation mode is a special input character mode, identifying special input characters in the special input character mode, and judging corresponding rich text types according to the special input characters.
Optionally, the judging the corresponding rich text type according to the special input character includes:
when the special input character contains "/math", judging the corresponding rich text type as a mathematical formula type;
when the special input character contains "" mermatid "", judging that the corresponding rich text type is a common drawing type;
when the special input character contains "/uml", the corresponding rich text type is judged to be the advanced drawing type.
Optionally, the rich text content is identified by:
when the rich text type is a common chart type, marking the data in each cell in the input form in turn according to a preset form data rule to obtain a label corresponding to each cell, and taking the data in each cell and the corresponding label as the rich text content of the input form;
and when the rich text type is a mathematical formula type, extracting character strings among preset formula wild cards as corresponding rich text contents.
Optionally, the activating the rich text editing script preloaded by the rich text editor corresponding to the rich text type includes:
acquiring rich text attributes corresponding to each rich text type;
Registering the rich text attribute in the rich text editor.
Optionally, the rendering the rich text in each corresponding data container according to the preset data format by using the rich text editing script includes:
when a preset data format corresponding to rich text in the data container is a table format, obtaining a graph type corresponding to the table format, and converting rich text content in the corresponding data container into a graph corresponding to the graph type by utilizing a rich text editing script corresponding to the common chart type;
when the preset data format corresponding to the rich text in the data container is a formula format, identifying a formula type corresponding to the formula format, and converting the rich text content in the corresponding data container into a text of a data structure corresponding to the formula type by utilizing a rich text editing script corresponding to the mathematical formula type;
when a preset data format corresponding to rich text in the data container is a common primitive format, generating an editing layer corresponding to the common primitive format, analyzing a data grammar corresponding to rich text content in the editing layer by utilizing a rich text editing script corresponding to the common drawing type, and generating a common drawing corresponding to the rich text content in the data container according to the data grammar;
When the preset data format corresponding to the rich text in the data container is the high-level primitive format, a floating frame page corresponding to the high-level primitive format is created, and a drawing editing plug-in corresponding to the high-level primitive format is loaded in the floating frame page by utilizing a rich text editing script corresponding to the high-level drawing type, so that high-level drawing corresponding to rich text content in the data container is generated.
Optionally, after the rich text in each corresponding content container is rendered according to the preset data format by using the rich text editing script, the method further includes:
generating a picture in a preset format corresponding to the rendered rich text content, and storing the picture in the preset format;
and responding to the message of browsing the rich text content, and displaying the picture in the preset format corresponding to the rich text content.
In order to solve the above problems, the present invention also provides a rich text editing apparatus, the apparatus comprising:
a rich text type identifying module for identifying a rich text type in a rich text input signal generated in a rich text editor in response to the rich text input signal;
the content conversion and storage module is used for initializing an editing page of the rich text editor according to the rich text type, receiving and identifying rich text content input by a user on the editing page, converting the rich text content into a preset data format and storing the data format into a corresponding preset data container;
The rich text editing script activating module is used for acquiring and activating a rich text editing script preloaded by a rich text editor corresponding to the rich text type;
and the rich text rendering module is used for rendering the rich text content in each corresponding data container according to the preset data format by utilizing the rich text editing script.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
a memory storing at least one computer program; a kind of electronic device with high-pressure air-conditioning system
And a processor executing the program stored in the memory to implement the above-described rich text editing method.
In order to solve the above-described problems, the present invention also provides a computer-readable storage medium having stored therein at least one computer program that is executed by a processor in an electronic device to implement the above-described rich text editing method.
According to the embodiment of the invention, corresponding rich text content is converted into a preset data format according to the type of the rich text content input by a user, the preset data format is stored in a preset data container, then a rich text editing script corresponding to the rich text type preloaded by a rich text editor is called, the rich text content in each data container is rendered according to the preset data format, multiple rich text types are supported to be independently edited in the same rich text editor, and the user does not need to independently use editing software corresponding to other rich text types except the rich text editor, so that the editing efficiency and user experience of rich text are improved.
Drawings
FIG. 1 is a flowchart illustrating a method for editing rich text according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating a detailed implementation flow of one of the steps in the method for editing rich text according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating another step of the method for editing rich text according to an embodiment of the present invention;
FIG. 4 is a functional block diagram of a rich text editing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device for implementing the rich text editing method according to an embodiment of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the application provides a rich text editing method. The main execution body of the rich text editing method includes, but is not limited to, at least one of a server, a terminal and the like, which can be configured to execute the method provided by the embodiment of the application. In other words, the rich text editing method may be performed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (ContentDelivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Referring to fig. 1, a flowchart of a rich text editing method according to an embodiment of the invention is shown. In this embodiment, the method for editing rich text includes:
s1, responding to a rich text input signal generated in a rich text editor, and identifying a rich text type in the rich text input signal;
compared with the prior widely applied rich text editor developed based on HMTL (Hypertext Markup Language ), the rich text editor in the embodiment of the invention can be developed by adopting JSON technology (JavaScript Object Notation), and documents finally generated by using the rich text editor are all saved in the JSON format.
Illustratively, the markup pairs used by the rich text editor developed in HTML language are:
<div>aaa</div><div>bbb</div>
the markup pairs used by the rich text editor developed in JSON language are:
{blocks:[
{type:'text',text:[{insert:'aaa'}]},
{type:'text',text:[{insert:'bbb'}]}
]}
in the embodiment of the invention, the rich text input signal refers to a signal generated by inputting rich text content by a common user according to the guidance of a menu or a shortcut key of the rich text editor, wherein the rich text content can be rich text such as a table, a mathematical formula, a drawing primitive and the like.
In detail, referring to fig. 2, the identifying the rich text type in the rich text input signal includes:
S11, judging whether the generation mode of the rich text input signal is a menu mode or a special character input mode;
when the generation mode is a menu mode, executing S12, and acquiring a rich text type corresponding to each menu mode according to a preset menu and a rich text type mapping table;
and when the generation mode is a special input character mode, executing S13, identifying the special input characters in the special input character mode, and judging the corresponding rich text types according to the special input characters.
In the embodiment of the invention, the menu mode comprises a common menu, a shortcut menu or a shortcut key mode provided by the rich text editor, for example, in the process of using the rich text editor, a shortcut menu for inserting a certain type of rich text data is selected by right clicking a mouse, and a rich text editing page of the type is accessed.
In the embodiment of the present invention, the preset menu and rich text type mapping table is used to define a comparison relationship between each menu item and a corresponding rich text type.
In the embodiment of the invention, the rich text type includes but is not limited to a common chart type, a mathematical formula type, a common drawing type and an advanced drawing type, wherein the common chart type refers to data organized according to a two-dimensional data table, and a line graph, a bar graph and a pie graph data generated by the two-dimensional data table. The mathematical formula type may be a LaTex mathematical expression, for example, $x+y=z$; the general drawing type may be a Gantt chart, a flow chart, a time chart, a class chart, and other drawing data based on a MarkDown text grammar, and the advanced drawing type may be a graphic data generated by supporting manual drawing software or script, for example, drawIO data.
Further, the judging the corresponding rich text type according to the special input character includes:
when the special input character contains "/math", judging that the corresponding rich text type is the mathematical formula type;
when the special input character contains 'mermatid', judging that the corresponding rich text type is the common drawing type;
when the special input character contains "/uml", the corresponding rich text type is judged to be the advanced drawing type.
In the embodiment of the invention, after the rich text type corresponding to the input rich text information is identified, the corresponding rich text content is required to be extracted.
The embodiment of the invention acquires the rich text type input by the user, is beneficial to editing corresponding rich text content by adopting a corresponding method aiming at different rich text types, and improves the rich text editing efficiency.
S2, initializing an editing page of the rich text editor according to the rich text type, receiving and identifying rich text content input by a user on the editing page, converting the rich text content into a preset data format, and storing the data format into a corresponding preset data container;
in the embodiment of the invention, the editing page refers to an operation interface for the user to input the rich text content, and the editing page comprises a toolbar, a status bar, a text input box and other areas. It can be understood that, in the process of inputting or editing, the rich text corresponding to different rich text types depends on different tool menus, editing area sizes and the like, so that the editing page of the rich text editor is initialized according to the rich text types, and customization of the editing page corresponding to each rich text type can be realized.
In detail, referring to fig. 3, the receiving and identifying the rich text content input by the user on the editing page includes:
s21, acquiring the rich text type;
when the rich text type is a common chart type, executing S22, marking the data in each cell in the input form according to a preset form data rule in turn to obtain a label corresponding to each cell, and taking the data in each cell and the corresponding label as the rich text content of the input form;
and when the rich text type is a mathematical formula type, executing S23, and extracting character strings between preset formula wild cards as corresponding rich text contents.
Illustratively, each cell K (i, j) of the input form is labeled in turn by the following preset form data rules, where K represents any cell in the input form, i represents the number of rows, and j represents the number of columns:
1. when i=1 and j=1, the label labeled K (i, j) is a chart type, wherein the chart type includes, but is not limited to, line graph, bar graph, pie graph and the like;
2. when i=1, j is not equal to 1, the label labeled K (i, j) is a numerical class, e.g., staff a, staff B;
3. When i is not equal to 1, j=1, the label labeled K (i, j) is a serial name, for example, a serial name label such as income, age, working years, etc.;
4. when i is not equal to 1 and j is not equal to 1, the label marked with K (i, j) is a common value.
For example, when the rich text type is a mathematical formula type, the preset formula wild card may refer to $or $by finding paired $or $for text between $and $, or text between $and $as the rich text content.
In the embodiment of the present invention, the preset data format includes, but is not limited to, a table format for representing common table data, for example, a pie chart format, a line chart format, a histogram format, and the like; a formula format for characterizing mathematical formula data, e.g., formulas containing integral symbols, formulas containing root numbers, cosine formulas, etc.; a common primitive format for characterizing common drawing data, e.g., a judgment primitive format, a start primitive format, etc.; and a high-level primitive format, e.g., parent primitive format, child primitive format, etc., for characterizing high-level drawing data.
In the embodiment of the invention, the data container is used for storing rich text content of a specific rich text type or a preset data format, namely, rich text belonging to one rich text type can be stored in the same data container, and data of each data format corresponding to the same rich text type can be respectively stored in different data containers, so that the operation is helpful for ensuring that the rich text editor supports concurrent editing of multiple types of rich text.
S3, acquiring and activating a rich text editing script preloaded by a rich text editor corresponding to the rich text type;
in the embodiment of the invention, the rich text editor supports the editing of the rich text of the type by preloading different rich text editing scripts.
In detail, the activating the rich text editing script preloaded by the rich text editor corresponding to the rich text type includes:
acquiring rich text attributes corresponding to each rich text type;
registering the rich text attribute in the rich text editor.
In the embodiment of the invention, the rich text editor allocates different text attributes to each rich text of the rich text types, for example, the rich text attribute of the ordinary chart type is chart, the rich text attribute of the mathematical formula type is math, the rich text attribute of the ordinary drawing type is embedType: meracid, and the rich text attribute of the advanced drawing type is embedType: drawio.
Illustratively, adding the following record in the rich text editor, and completing registration of the character attribute in the rich text editor:
{blocks:[
{type:'table',chart:boolean}
]}
in the embodiment of the invention, the rich text editing script corresponding to each rich text type is activated or started by finishing registering the rich text attribute corresponding to each rich text type in the rich text editor.
And S4, rendering the rich text content in each corresponding data container according to the preset data format by utilizing the rich text editing script. .
In the embodiment of the invention, corresponding rich text rendering processes are also different aiming at different rich text types and different preset data formats.
In detail, the rendering the rich text content in each corresponding data container according to the preset data format by using the rich text editing script comprises the following steps:
when a preset data format corresponding to rich text in the data container is a table format, obtaining a graph type corresponding to the table format, and converting rich text content in the corresponding data container into a graph corresponding to the graph type by utilizing a rich text editing script corresponding to the common chart type;
when the preset data format corresponding to the rich text in the data container is a formula format, identifying a formula type corresponding to the formula format, and converting the rich text content in the corresponding data container into a text of a data structure corresponding to the formula type by utilizing a rich text editing script corresponding to the mathematical formula type;
When a preset data format corresponding to rich text in the data container is a common primitive format, generating an editing layer corresponding to the common primitive format, analyzing a data grammar corresponding to rich text content in the editing layer by utilizing a rich text editing script corresponding to the common drawing type, and generating a common drawing corresponding to the rich text content in the data container according to the data grammar;
when the preset data format corresponding to the rich text in the data container is the high-level primitive format, a floating frame page corresponding to the high-level primitive format is created, and a drawing editing plug-in corresponding to the high-level primitive format is loaded in the floating frame page by utilizing a rich text editing script corresponding to the high-level drawing type, so that high-level drawing corresponding to rich text content in the data container is generated.
In an alternative embodiment of the present invention, the graphic types corresponding to the table format include, but are not limited to, a line graph type, a bar graph type, or a pie graph type.
In an alternative embodiment of the present invention, when the rich text type is a mathematical formula type, a rich text editing script corresponding to the mathematical formula type is used to convert paired text between $and $or 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 a corresponding mathematical formula based on a LaTeX grammar.
In an alternative embodiment of the present invention, taking a rich text corresponding to a mermatid drawing tool as an example, an editing method of a rich text corresponding to the common drawing type is described. And generating an editing layer by using a corresponding rich text editing script, converting rich text content input by a user in the editing layer into a text structure conforming to a Markdown grammar, and further rendering the converted text by using the rich text script.
In an alternative embodiment of the present invention, taking a rich text corresponding to a drawtio drawing tool as an example, an editing method of a rich text corresponding to the advanced drawing type is described. Considering that DrawIO cannot be simply embedded into the rich text editing, support for DrawIO can be implemented using an iframe floating framework. 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 a DrawIO editing page is loaded in the floating frame page for the user to operate.
In another optional embodiment of the present invention, after the rich text in each corresponding data container is rendered according to the preset data format by using the rich text editing script, the loading efficiency of the pages corresponding to the rich text content may be further improved by the following method:
Generating a picture in a preset format corresponding to the rendered rich text content, and storing the picture in the preset format;
and responding to the message of browsing the rich text content, and displaying the picture in the preset format corresponding to the rich text content.
In the embodiment of the present invention, the preset format may be set according to actual service requirements, for example, svg format. For example, the rendered rich text content is stored as a svg picture and uploaded to a designated server for storage, when a corresponding page needs to be loaded, the svg picture of the corresponding page can be directly loaded without calling a corresponding rich text editing script to render the rich text content in the page again, and thus the loading efficiency of the rich text editing page can be improved.
In another optional embodiment of the present invention, the support of the rich text editor to the change operation of the rich text is implemented by the following method:
generating an editing layer corresponding to the rich text when the rich text editor generates a rich text change signal;
and identifying the change data in the editing layer, and calling the corresponding rich text editing script to render the change data.
According to the embodiment of the invention, corresponding rich text content is converted into a preset data format according to the type of the rich text content input by a user, the preset data format is stored in a preset data container, then a rich text editing script corresponding to the rich text type preloaded by a rich text editor is called, the rich text content in each data container is rendered according to the preset data format, multiple rich text types are supported to be independently edited in the same rich text editor, and the user does not need to independently use editing software corresponding to other rich text types except the rich text editor, so that the editing efficiency and user experience of rich text are improved.
Fig. 4 is a functional block diagram of a rich text editing apparatus according to an embodiment of the present invention.
The rich text editing apparatus 100 of the present invention may be installed in an electronic device. According to the implemented functions, the rich text editing apparatus 100 includes: a rich text type identification 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 of the invention, which may also be referred to as a unit, refers to a series of computer program segments, which are stored in the memory of the electronic device, capable of being executed by the processor of the electronic device and of performing a fixed function.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the rich text type identifying module 101 is configured to identify a rich text type in a rich text input signal generated in a rich text editor in response to the rich text input signal;
the content conversion and storage module 102 is configured to initialize an editing page of the rich text editor according to the rich text type, receive and identify rich text content input by a user on the editing page, convert the rich text content into a preset data format, and store the data format in a corresponding preset data container;
The rich text editing script activating module 103 is configured to obtain and activate a rich text editing script preloaded by a rich text editor corresponding to the rich text type;
the rich text rendering module 104 is configured to render, according to the preset data format, the rich text content in each corresponding data container by using the rich text editing script.
In detail, the specific embodiments of the modules of the rich text editing apparatus 100 are as follows:
step one, responding to a rich text input signal generated in a rich text editor, and identifying the rich text type in the rich text input signal;
compared with the prior widely applied rich text editor developed based on HMTL (Hypertext Markup Language ), the rich text editor in the embodiment of the invention can be developed by adopting JSON technology (JavaScript Object Notation), and documents finally generated by using the rich text editor are all saved in the JSON format.
Illustratively, the markup pairs used by the rich text editor developed in HTML language are:
<div>aaa</div><div>bbb</div>
the markup pairs used by the rich text editor developed in JSON language are:
{blocks:[
{type:'text',text:[{insert:'aaa'}]},
{type:'text',text:[{insert:'bbb'}]}
]}
in the embodiment of the invention, the rich text input signal refers to a signal generated by inputting rich text content by a common user according to the guidance of a menu or a shortcut key of the rich text editor, wherein the rich text content can be rich text such as a table, a mathematical formula, a drawing primitive and the like.
In detail, the identifying the rich text type in the rich text input signal includes:
judging whether the generation mode of the rich text input signal is a menu mode or a special character input mode;
when the generation mode is a menu mode, acquiring a rich text type corresponding to each menu mode according to a preset menu and a rich text type mapping table;
and when the generation mode is a special input character mode, identifying special input characters in the special input character mode, and judging corresponding rich text types according to the special input characters.
In the embodiment of the invention, the menu mode comprises a common menu, a shortcut menu or a shortcut key mode provided by the rich text editor, for example, in the process of using the rich text editor, a shortcut menu for inserting a certain type of rich text data is selected by right clicking a mouse, and a rich text editing page of the type is accessed.
In the embodiment of the present invention, the preset menu and rich text type mapping table is used to define a comparison relationship between each menu item and a corresponding rich text type.
In the embodiment of the invention, the rich text type includes but is not limited to a common chart type, a mathematical formula type, a common drawing type and an advanced drawing type, wherein the common chart type refers to data organized according to a two-dimensional data table, and a line graph, a bar graph and a pie graph data generated by the two-dimensional data table. The mathematical formula type may be a LaTex mathematical expression, for example, $x+y=z$; the general drawing type may be a Gantt chart, a flow chart, a time chart, a class chart, and other drawing data based on a MarkDown text grammar, and the advanced drawing type may be a graphic data generated by supporting manual drawing software or script, for example, drawIO data.
Further, the judging the corresponding rich text type according to the special input character includes:
when the special input character contains "/math", judging that the corresponding rich text type is the mathematical formula type;
when the special input character contains 'mermatid', judging that the corresponding rich text type is the common drawing type;
when the special input character contains "/uml", the corresponding rich text type is judged to be the advanced drawing type.
The embodiment of the invention acquires the rich text type input by the user, is beneficial to editing corresponding rich text content by adopting a corresponding method aiming at different rich text types, and improves the rich text editing efficiency.
S2, initializing an editing page of the rich text editor according to the rich text type, receiving and identifying rich text content input by a user on the editing page, converting the rich text content into a preset data format, and storing the data format into a corresponding preset data container;
in the embodiment of the invention, the editing page refers to an operation interface for the user to input the rich text content, and the editing page comprises a toolbar, a status bar, a text input box and other areas. It can be understood that, in the process of inputting or editing, the rich text corresponding to different rich text types depends on different tool menus, editing area sizes and the like, so that the editing page of the rich text editor is initialized according to the rich text types, and customization of the editing page corresponding to each rich text type can be realized.
In detail, the receiving and identifying the rich text content input by the user on the editing page comprises the following steps:
when the rich text type is a common chart type, marking data in each cell in an input form in sequence according to a preset form data rule to obtain a label corresponding to each cell, and storing the data in each cell and the corresponding label as a preset form format text to serve as rich text content of the input form;
and when the rich text type is a mathematical formula type, extracting character strings among preset formula wild cards as corresponding rich text contents.
Illustratively, each cell K (i, j) of the input form is labeled in turn by the following preset form data rules, where K represents any cell in the input form, i represents the number of rows, and j represents the number of columns:
1. when i=1 and j=1, the label labeled K (i, j) is a chart type, wherein the chart type includes, but is not limited to, line graph, bar graph, pie graph and the like;
2. when i=1, j is not equal to 1, the label labeled K (i, j) is a numerical class, e.g., staff a, staff B;
3. when i is not equal to 1, j=1, the label labeled K (i, j) is a serial name, for example, a serial name label such as income, age, working years, etc.;
4. When i is not equal to 1 and j is not equal to 1, the label marked with K (i, j) is a common value.
For example, when the rich text type is a mathematical formula type, the preset formula wild card may refer to $or $by finding paired $or $for text between $and $, or text between $and $as the rich text content.
In the embodiment of the present invention, the preset data format includes, but is not limited to, a table format for representing common table data, for example, a pie chart format, a line chart format, a histogram format, and the like; a formula format for characterizing mathematical formula data, e.g., formulas containing integral symbols, formulas containing root numbers, cosine formulas, etc.; a common primitive format for characterizing common drawing data, e.g., a judgment primitive format, a start primitive format, etc.; and a high-level primitive format, e.g., parent primitive format, child primitive format, etc., for characterizing high-level drawing data.
In the embodiment of the invention, the data container is used for storing rich text content of a specific rich text type or a preset data format, namely, rich text belonging to one rich text type can be stored in the same data container, and data of each data format corresponding to the same rich text type can be respectively stored in different data containers, so that the operation is helpful for ensuring that the rich text editor supports concurrent editing of multiple types of rich text.
Step three, acquiring and activating a rich text editing script preloaded by a rich text editor corresponding to the rich text type;
in the embodiment of the invention, the rich text editor supports the editing of the rich text of the type by preloading different rich text editing scripts.
In detail, the activating the rich text editing script preloaded by the rich text editor corresponding to the rich text type includes:
acquiring rich text attributes corresponding to each rich text type;
registering the rich text attribute in the rich text editor.
In the embodiment of the invention, the rich text editor allocates different text attributes to each rich text of the rich text types, for example, the rich text attribute of the ordinary chart type is chart, the rich text attribute of the mathematical formula type is math, the rich text attribute of the ordinary drawing type is embedType: meracid, and the rich text attribute of the advanced drawing type is embedType: drawio.
Illustratively, adding the following record in the rich text editor, and completing registration of the character attribute in the rich text editor:
{blocks:[
{type:'table',chart:boolean}
]}
in the embodiment of the invention, the rich text editing script corresponding to each rich text type is activated or started by finishing registering the rich text attribute corresponding to each rich text type in the rich text editor.
And step four, rendering the rich text content in each corresponding data container according to the preset data format by utilizing the rich text editing script. .
In the embodiment of the invention, corresponding rich text rendering processes are also different aiming at different rich text types and different preset data formats.
In detail, the rendering the rich text content in each corresponding data container according to the preset data format by using the rich text editing script comprises the following steps:
when a preset data format corresponding to rich text in the data container is a table format, obtaining a graph type corresponding to the table format, and converting rich text content in the corresponding data container into a graph corresponding to the graph type by utilizing a rich text editing script corresponding to the common chart type;
when the preset data format corresponding to the rich text in the data container is a formula format, identifying a formula type corresponding to the formula format, and converting the rich text content in the corresponding data container into a text of a data structure corresponding to the formula type by utilizing a rich text editing script corresponding to the mathematical formula type;
When a preset data format corresponding to rich text in the data container is a common primitive format, generating an editing layer corresponding to the common primitive format, analyzing a data grammar corresponding to rich text content in the editing layer by utilizing a rich text editing script corresponding to the common drawing type, and generating a common drawing corresponding to the rich text content in the data container according to the data grammar;
when the preset data format corresponding to the rich text in the data container is the high-level primitive format, a floating frame page corresponding to the high-level primitive format is created, and a drawing editing plug-in corresponding to the high-level primitive format is loaded in the floating frame page by utilizing a rich text editing script corresponding to the high-level drawing type, so that high-level drawing corresponding to rich text content in the data container is generated.
In an alternative embodiment of the present invention, the graphic types corresponding to the table format include, but are not limited to, a line graph type, a bar graph type, or a pie graph type.
In an alternative embodiment of the present invention, when the rich text type is a mathematical formula type, a rich text editing script corresponding to the mathematical formula type is used to convert paired text between $and $or 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 a corresponding mathematical formula based on a LaTeX grammar.
In an alternative embodiment of the present invention, taking a rich text corresponding to a mermatid drawing tool as an example, an editing method of a rich text corresponding to the common drawing type is described. And generating an editing layer by using a corresponding rich text editing script, converting rich text content input by a user in the editing layer into a text structure conforming to a Markdown grammar, and further rendering the converted text by using the rich text script.
In an alternative embodiment of the present invention, taking a rich text corresponding to a drawtio drawing tool as an example, an editing method of a rich text corresponding to the advanced drawing type is described. Considering that DrawIO cannot be simply embedded into the rich text editing, support for DrawIO can be implemented using an iframe floating framework. 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 a DrawIO editing page is loaded in the floating frame page for the user to operate.
In another optional embodiment of the present invention, after the rich text in each corresponding data container is rendered according to the preset data format by using the rich text editing script, the loading efficiency of the pages corresponding to the rich text content may be further improved by the following method:
Generating a picture in a preset format corresponding to the rendered rich text content, and storing the picture in the preset format;
and responding to the message of browsing the rich text content, and displaying the picture in the preset format corresponding to the rich text content.
In the embodiment of the present invention, the preset format may be set according to actual service requirements, for example, svg format. For example, the rendered rich text content is stored as a svg picture and uploaded to a designated server for storage, when a corresponding page needs to be loaded, the svg picture of the corresponding page can be directly loaded without calling a corresponding rich text editing script to render the rich text content in the page again, and thus the loading efficiency of the rich text editing page can be improved.
In another optional embodiment of the present invention, the support of the rich text editor to the change operation of the rich text is implemented by the following method:
generating an editing layer corresponding to the rich text when the rich text editor generates a rich text change signal;
and identifying the change data in the editing layer, and calling the corresponding rich text editing script to render the change data.
According to the embodiment of the invention, corresponding rich text content is converted into a preset data format according to the type of the rich text content input by a user, the preset data format is stored in a preset data container, and then the rich text editing script corresponding to the rich text type preloaded by the rich text editor is called, the rich text content in each data container is rendered according to the preset data format, so that multiple rich text types are supported to be independently edited in the same rich text editor, and the user does not need to independently use editing software corresponding to other rich text types except the rich text editor.
Fig. 5 is a schematic structural diagram of an electronic device for implementing a rich text editing method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as a rich text editing program, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, including flash memory, a mobile hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may in other embodiments also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only for storing application software installed in the electronic device 1 and various types of data, such as codes of a rich text editing program, but also for temporarily storing data that has been output or is to be output.
The processor 10 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing Unit, CPU), microprocessors, digital processing chips, graphics processors, combinations of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects respective components of the entire electronic device using various interfaces and lines, and executes various functions of the electronic device 1 and processes data by running or executing programs or modules (e.g., a rich text editing program, etc.) stored in the memory 11, and calling data stored in the memory 11.
The bus may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc.
Fig. 5 shows only an electronic device with components, it being understood by a person skilled in the art that the structure shown in fig. 5 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or may combine certain components, or may be arranged in different components.
For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for supplying power to each component, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device 1 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which will not be described herein.
Further, the electronic device 1 may also comprise a network interface, optionally the network interface may comprise a wired interface and/or a wireless interface (e.g. WI-FI interface, bluetooth interface, etc.), typically used for establishing a communication connection between the electronic device 1 and other electronic devices.
The electronic device 1 may optionally further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device 1 and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The rich text editing program stored in the memory 11 in the electronic device 1 is a combination of instructions that, when executed in the processor 10, may implement:
identifying a rich text type in a rich text input signal generated in a rich text editor in response to the rich text input signal;
initializing an editing page of the rich text editor according to the rich text type, receiving and identifying rich text content input by a user on the editing page, converting the rich text content into a preset data format, and storing the data format into a corresponding preset data container;
Acquiring and activating a pre-loaded rich text editing script in a rich text editor corresponding to the rich text type;
and rendering the rich text content in each corresponding data container according to the preset data format by utilizing the rich text editing script.
Further, the modules/units integrated in the electronic device 1 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. The computer readable storage medium may be volatile or nonvolatile. For example, the computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
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 implement:
identifying a rich text type in a rich text input signal generated in a rich text editor in response to the rich text input signal;
Initializing an editing page of the rich text editor according to the rich text type, receiving and identifying rich text content input by a user on the editing page, converting the rich text content into a preset data format, and storing the data format into a corresponding preset data container;
acquiring and activating a pre-loaded rich text editing script in a rich text editor corresponding to the rich text type;
and rendering the rich text content in each corresponding data container according to the preset data format by utilizing the rich text editing script.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The embodiment of the application can acquire and process the related data based on the holographic projection technology. Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (10)

1. A method of rich text editing, the method comprising:
identifying a rich text type in a rich text input signal generated in a rich text editor in response to the rich text input signal;
initializing an editing page of the rich text editor according to the rich text type, receiving and identifying rich text content input by a user on the editing page, converting the rich text content into a preset data format, and storing the data format into a corresponding preset data container;
Acquiring and activating a pre-loaded rich text editing script in a rich text editor corresponding to the rich text type;
and rendering the rich text content in each corresponding data container according to the preset data format by utilizing the rich text editing script.
2. The rich text editing method of claim 1, wherein the rich text type is identified by:
judging whether the generation mode of the rich text input signal is a menu mode or a special character input mode;
when the generation mode is a menu mode, acquiring a rich text type corresponding to each menu mode according to a preset menu and a rich text type mapping table;
and when the generation mode is a special input character mode, identifying special input characters in the special input character mode, and judging corresponding rich text types according to the special input characters.
3. The rich text editing method as claimed in claim 1, wherein said judging a corresponding rich text type based on said special input character comprises:
when the special input character contains "/math", judging the corresponding rich text type as a mathematical formula type;
When the special input character contains "" mermatid "", judging that the corresponding rich text type is a common drawing type;
when the special input character contains "/uml", the corresponding rich text type is judged to be the advanced drawing type.
4. The rich text editing method as claimed in claim 2, wherein the rich text content is identified by:
when the rich text type is a common chart type, marking the data in each cell in the input form in turn according to a preset form data rule to obtain a label corresponding to each cell, and taking the data in each cell and the corresponding label as the rich text content of the input form;
and when the rich text type is a mathematical formula type, extracting character strings among preset formula wild cards as corresponding rich text contents.
5. The rich text editing method of claim 1, wherein said activating a rich text editing script preloaded by a rich text editor corresponding to said rich text type comprises:
acquiring rich text attributes corresponding to each rich text type;
registering the rich text attribute in the rich text editor.
6. The rich text editing method as claimed in any one of claims 2 to 5, wherein said rendering rich text in each corresponding data container according to said preset data format using said rich text editing script comprises:
when a preset data format corresponding to rich text in the data container is a table format, obtaining a graph type corresponding to the table format, and converting rich text content in the corresponding data container into a graph corresponding to the graph type by utilizing a rich text editing script corresponding to the common chart type;
when the preset data format corresponding to the rich text in the data container is a formula format, identifying a formula type corresponding to the formula format, and converting the rich text content in the corresponding data container into a text of a data structure corresponding to the formula type by utilizing a rich text editing script corresponding to the mathematical formula type;
when a preset data format corresponding to rich text in the data container is a common primitive format, generating an editing layer corresponding to the common primitive format, analyzing a data grammar corresponding to rich text content in the editing layer by utilizing a rich text editing script corresponding to the common drawing type, and generating a common drawing corresponding to the rich text content in the data container according to the data grammar;
When the preset data format corresponding to the rich text in the data container is the high-level primitive format, a floating frame page corresponding to the high-level primitive format is created, and a drawing editing plug-in corresponding to the high-level primitive format is loaded in the floating frame page by utilizing a rich text editing script corresponding to the high-level drawing type, so that high-level drawing corresponding to rich text content in the data container is generated.
7. The rich text editing method of claim 1, wherein after said rendering rich text in each corresponding one of said content containers according to said preset data format using said rich text editing script, said method further comprises:
generating a picture in a preset format corresponding to the rendered rich text content, and storing the picture in the preset format;
and responding to the message of browsing the rich text content, and displaying the picture in the preset format corresponding to the rich text content.
8. A rich text editing apparatus, the apparatus comprising:
a rich text type identifying module for identifying a rich text type in a rich text input signal generated in a rich text editor in response to the rich text input signal;
The content conversion and storage module is used for initializing an editing page of the rich text editor according to the rich text type, receiving and identifying rich text content input by a user on the editing page, converting the rich text content into a preset data format and storing the data format into a corresponding preset data container;
the rich text editing script activating module is used for acquiring and activating a rich text editing script preloaded by a rich text editor corresponding to the rich text type;
and the rich text rendering module is used for rendering the rich text content in each corresponding data container according to the preset data format by utilizing the rich text editing script.
9. An electronic device, the electronic device comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the rich text editing method of any of claims 1 to 7.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the rich text editing method according to any one of claims 1 to 7.
CN202211648116.7A 2022-12-21 2022-12-21 Rich text editing method, rich text editing device, electronic equipment and computer readable storage medium Pending CN116226563A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211648116.7A CN116226563A (en) 2022-12-21 2022-12-21 Rich text editing method, rich text editing device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211648116.7A CN116226563A (en) 2022-12-21 2022-12-21 Rich text editing method, rich text editing device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN116226563A true CN116226563A (en) 2023-06-06

Family

ID=86570568

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211648116.7A Pending CN116226563A (en) 2022-12-21 2022-12-21 Rich text editing method, rich text editing device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN116226563A (en)

Similar Documents

Publication Publication Date Title
CN113095995B (en) Webpage watermark adding method and device, electronic equipment and storage medium
CN113704429A (en) Semi-supervised learning-based intention identification method, device, equipment and medium
CN113961584A (en) Method and device for analyzing field blood relationship, electronic equipment and storage medium
CN115048111B (en) Code generation method, device, equipment and medium based on metadata
CN112486490B (en) Front-end code packaging method and device, electronic equipment and storage medium
CN113468175A (en) Data compression method and device, electronic equipment and storage medium
CN115496166A (en) Multitasking method and device, electronic equipment and storage medium
CN113139145B (en) Page generation method and device, electronic equipment and readable storage medium
CN116226563A (en) Rich text editing method, rich text editing device, electronic equipment and computer readable storage medium
CN114780688A (en) Text quality inspection method, device and equipment based on rule matching and storage medium
CN114185522A (en) Page theme customizing method and device, electronic equipment and storage medium
CN114637866A (en) Information management method and device for digital new media
CN114004209A (en) PDF format data export method and device, electronic equipment and readable storage medium
CN114398282A (en) Test script generation method, device, equipment and storage medium
CN113822215A (en) Equipment operation guide file generation method and device, electronic equipment and storage medium
CN113657076B (en) Page operation record table generation method and device, electronic equipment and storage medium
CN112527282B (en) Front-end page verification method and device, electronic equipment and storage medium
CN112559919B (en) Method and device for checking online document uploading, electronic equipment and storage medium
CN114942758A (en) Native component generation method and device, electronic equipment and storage medium
CN114610807A (en) Data import template configuration method, device, equipment and storage medium
CN113885984A (en) Operation guide generation method, device, equipment and medium based on image recognition
CN114840210A (en) Data drive view realization method and device, electronic equipment and storage medium
CN116542221A (en) PDF file analysis preview method, device, equipment and storage medium
CN115268980A (en) Method, device, equipment and storage medium for judging optimization of act component
CN114491007A (en) Data exposure method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination