CN116992852A - Method, device, electronic equipment and storage medium for comparing rich text content - Google Patents

Method, device, electronic equipment and storage medium for comparing rich text content Download PDF

Info

Publication number
CN116992852A
CN116992852A CN202310758582.9A CN202310758582A CN116992852A CN 116992852 A CN116992852 A CN 116992852A CN 202310758582 A CN202310758582 A CN 202310758582A CN 116992852 A CN116992852 A CN 116992852A
Authority
CN
China
Prior art keywords
text data
rich text
data
user
plain text
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
CN202310758582.9A
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.)
Great Wall Motor Co Ltd
Original Assignee
Great Wall Motor 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 Great Wall Motor Co Ltd filed Critical Great Wall Motor Co Ltd
Priority to CN202310758582.9A priority Critical patent/CN116992852A/en
Publication of CN116992852A publication Critical patent/CN116992852A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/194Calculation of difference between files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution

Abstract

The application provides a method, a device, electronic equipment and a storage medium for comparing rich text contents, wherein the method comprises the following steps: acquiring first rich text data stored in a database; when the editing operation of the user on the first rich text data is detected, acquiring second rich text data edited by the user; respectively converting the first rich text data and the second rich text data to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data; difference data is determined based on the first plain text data and the second plain text data, and the difference data is marked and presented to the user. The method can compare the rich text data before and after editing and mark the difference data obtained by comparison so as to remind the user of the content modified by the editing operation, and can avoid the user from forgetting to modify the content.

Description

Method, device, electronic equipment and storage medium for comparing rich text content
Technical Field
The present application relates to the field of data processing technology, and more particularly, to a method, an apparatus, an electronic device, and a storage medium for comparing rich text content in the field of data processing technology.
Background
The Rich Text Format (Rich Text Format), also known as RTF Format, is a cross-platform document Format developed by microsoft corporation. Most word processors are capable of reading and saving RTF documents. It is a text and graphic document format that is convenient for viewing by different devices, systems.
At present, a rich text component in a project becomes a necessary scheme for solving the problem of persistent database falling of complex texts by most platforms on the market, and in the use process, a user usually edits the same rich text multiple times. But currently mainstream open-source rich text components do not support comparing content before and after editing. The text comparison tools supporting the rich text extraction comparison function on the market are paid, related tools are installed and are called in the landed project to realize, and the use experience of users is poor.
Disclosure of Invention
The application provides a method, a device, electronic equipment and a storage medium for comparing rich text contents, which can compare the rich text data before and after editing and mark the difference data obtained by comparison so as to remind a user of the contents modified by the editing operation, and can avoid the user from forgetting to modify the contents. And the use experience of the user is improved.
In a first aspect, a method of rich text content comparison is provided, the method comprising: acquiring first rich text data stored in a database; when the editing operation of the user on the first rich text data is detected, acquiring second rich text data edited by the user; respectively converting the first rich text data and the second rich text data to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data; difference data is determined based on the first plain text data and the second plain text data, and the difference data is marked and presented to the user.
In the technical scheme, the rich text data before and after editing are compared and the difference data obtained by comparison are marked out so as to remind the user of editing and modifying the content this time, so that the user can be prevented from forgetting to modify the content, and the situation that the same rich text is edited by different people in the same time period and the edited content is not known by the overlay user in time can be avoided.
With reference to the first aspect, in some possible implementations, before determining the difference data based on the first plain text data and the second plain text data, the method further includes: receiving a configuration instruction input by a user; and determining a comparison rule according to the configuration instruction.
With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, the comparison rule includes a line comparison rule, and determining difference data based on the first plain text data and the second plain text data includes: according to a line comparison rule, performing line comparison on the first plain text data and the second plain text data to determine first difference data; marking and presenting the difference data to a user, including: the first difference data is marked in a first format and presented to the user.
In the technical scheme, the first difference data is determined through row comparison, and marked by using the first format, so that a user can conveniently and quickly determine the position of the first difference data.
With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, the comparing rule includes a character comparing rule, and determining difference data based on the first plain text data and the second plain text data further includes: according to the character comparison rule, performing character comparison on the first plain text data and the second plain text data, and determining second difference data; determining a type of the second difference data; marking and presenting the difference data to a user, including: the second difference data is marked in a different type of associated format and presented to the user.
With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, the types of the difference data include a deletion type and a new addition type, and marking and presenting the second difference data to the user according to formats associated with different types includes: if the second difference data is of a deletion type, marking the second difference data according to a second format; and if the second difference data is of the newly added type, marking the second difference data according to a third format.
In the technical scheme, the first plain text data and the second plain text data are subjected to character comparison to determine the second difference data, and the type of the second difference data is determined, so that different types of difference data can be marked out by using different formats and presented to a user, and the user can conveniently and quickly distinguish the types of the difference data.
With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, the method further includes: displaying the marked difference data and presenting the marked difference data to a target interface of a user; detecting a save-determining operation performed by the user on the target interface, and storing the second rich text data in response to the save-determining operation; or detecting an exit operation executed by the user on the target interface, responding to the exit operation, returning to the editing interface of the user on the first rich text data, and not storing the second rich text data.
In the technical scheme, the marked difference data is presented to the user by the display target interface, so that the user can more intuitively and clearly check the content modified by the editing operation, and the secondary confirmation before the storage is realized.
With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, after storing the second rich text data, the method further includes: and taking the second rich text data as the rich text data of the next editing operation.
With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, performing conversion processing on the first rich text data and the second rich text data to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data, where the method includes: after detecting the storage operation of the user on the second rich text data, responding to the storage operation, and respectively converting the first rich text data and the second rich text data to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data.
In summary, the method and the device can compare the edited rich text content with the rich text content before editing, mark the difference data and present the difference data to the user, remind the user of the content modified this time and improve the use experience of the user. The situation that the same rich text is edited by different people in the same time period, and the edited content is covered and unknown can be avoided. Marking different difference data in different formats can allow the user to quickly locate the modified position and facilitate the user to quickly distinguish the type of modified data. The display target interface is displayed, so that a user can intuitively and clearly know the content of the modification, and the secondary confirmation before the rich text data is stored can be realized.
In a second aspect, there is provided an apparatus for rich text content comparison, the apparatus comprising: the acquisition module is used for acquiring the first rich text data stored in the database; when the editing operation of the user on the first rich text data is detected, acquiring second rich text data edited by the user; the processing module is used for responding to the storage operation after detecting the storage operation of the second rich text data by the user, and converting the first rich text data and the second rich text data through a preset processing rule to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data; and the marking module is used for determining difference data based on the first plain text data and the second plain text data, marking the difference data and presenting the difference data to a user.
With reference to the second aspect, in some possible implementations, the apparatus includes: the determining module is used for receiving a configuration instruction input by a user before determining difference data based on the first plain text data and the second plain text data; and determining a comparison rule according to the configuration instruction.
With reference to the second aspect and the foregoing implementation manner, in some possible implementation manners, the comparison rule includes a row comparison rule, and the marking module is specifically configured to: according to a line comparison rule, performing line comparison on the first plain text data and the second plain text data to determine first difference data; marking and presenting the difference data to a user, including: the first difference data is marked in a first format and presented to the user.
With reference to the second aspect and the foregoing implementation manner, in some possible implementation manners, the comparison rule includes a character comparison rule, and the marking module is further configured to: according to the character comparison rule, performing character comparison on the first plain text data and the second plain text data, and determining second difference data; determining a type of the second difference data; marking and presenting the difference data to a user, including: the second difference data is marked in a different type of associated format and presented to the user.
With reference to the second aspect and the foregoing implementation manner, in some possible implementation manners, the types of the difference data include a deletion type and a new addition type, and marking and presenting the second difference data to the user according to formats associated with different types includes: if the second difference data is of a deletion type, marking the second difference data according to a second format; and if the second difference data is of the newly added type, marking the second difference data according to a third format.
With reference to the second aspect and the foregoing implementation manner, in some possible implementation manners, the apparatus further includes: the display module is used for displaying the marked difference data and presenting the marked difference data to a target interface of a user; the detection module is used for detecting the operation of determining to save, which is executed by a user on the target interface, and storing the second rich text data in response to the operation of determining to save; or detecting an exit operation executed by the user on the target interface, responding to the exit operation, returning to the editing interface of the user on the first rich text data, and not storing the second rich text data.
With reference to the second aspect and the foregoing implementation manner, in some possible implementation manners, the apparatus further includes: and the updating module is used for taking the second rich text data as the rich text data of the next editing operation after storing the second rich text data.
With reference to the second aspect and the foregoing implementation manner, in some possible implementation manners, the processing module is specifically configured to, after detecting a saving operation of the second rich text data by the user, respectively performing conversion processing on the first rich text data and the second rich text data in response to the saving operation, to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data.
In a third aspect, an electronic device is provided that includes a memory and a processor. The memory is for storing executable program code and the processor is for calling and running the executable program code from the memory for causing the electronic device to perform the method of the first aspect or any one of the possible implementations of the first aspect.
In a fourth aspect, there is provided a computer program product comprising: computer program code which, when run on a computer, causes the computer to perform the method of the first aspect or any one of the possible implementations of the first aspect.
In a fifth aspect, a computer readable storage medium is provided, the computer readable storage medium storing computer program code which, when run on a computer, causes the computer to perform the method of the first aspect or any one of the possible implementations of the first aspect.
Drawings
FIG. 1 is a schematic flow chart of a method for rich text content contrast provided by an embodiment of the application;
FIG. 2 is a schematic diagram of a rich text contrast interface provided by an embodiment of the present application;
FIG. 3 is a schematic structural diagram of a device for comparing rich text content according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical scheme of the application will be clearly and thoroughly described below with reference to the accompanying drawings. Wherein, in the description of the embodiments of the present application, unless otherwise indicated, "/" means or, for example, a/B may represent a or B: the text "and/or" is merely an association relation describing the associated object, and indicates that three relations may exist, for example, a and/or B may indicate: the three cases where a exists alone, a and B exist together, and B exists alone, and furthermore, in the description of the embodiments of the present application, "plural" means two or more than two.
The terms "first," "second," and the like, are used below for descriptive purposes only and are not to be construed as implying or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature.
Fig. 1 is a schematic flow chart of a method for comparing rich text content provided by an embodiment of the application.
Illustratively, as shown in FIG. 1, the method 100 includes:
step 101, acquiring first rich text data stored in a database;
102, when the editing operation of a user on the first rich text data is detected, acquiring second rich text data edited by the user;
step 103, respectively converting the first rich text data and the second rich text data to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data;
step 104, determining difference data based on the first plain text data and the second plain text data, marking the difference data and presenting the difference data to a user.
In the embodiment shown in fig. 1, first rich text data stored in a database is acquired; when the editing operation of the user on the first rich text data is detected, acquiring second rich text data edited by the user; respectively converting the first rich text data and the second rich text data to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data; difference data is determined based on the first plain text data and the second plain text data, and the difference data is marked and presented to the user. The method can compare the rich text data before and after editing and mark the changed content to remind the user of the content edited and modified this time, can avoid the user forgetting to modify the content, and can also avoid the situation that the same rich text is edited by different people in the same time period and the edited content is covered so that the user cannot know in time.
The following describes a specific implementation of each step in the embodiment shown in fig. 1:
rich text is a complex text that includes words, symbols, numbers, pictures, various formats, and a user can create a rich text document using a rich text component and edit rich text data in the document. The rich text document can be understood as a document similar to word, and can perform functions such as new creation, storage, editing and the like.
In step 101, the first rich text data is stored in the database in the form of a rich text document, and when the user needs to edit the rich text document stored in the database, the rich text document stored in the database needs to be opened first. The first rich text data is rich text data included in the rich text document before the user opens the rich text document for editing operations.
In one possible implementation, the first rich text data is rich text data stored after the last editing operation before the current editing operation.
Alternatively, the last editing operation before the current editing operation may be an editing operation performed on a newly created blank document after the user creates a rich text document, or an editing operation performed on rich text data in an already created rich text document by the user.
Assuming that the last editing operation before the current editing operation is the editing operation of the user on the newly built blank document after the user newly builds the rich text document, the first rich text data is the rich text data edited and stored in the newly built blank document after the user builds the rich text document.
In step 102, detecting the user's editing operation of the first rich text data may be interpreted as: an operation of modifying the first rich text data at the rich text editing interface by the user is detected. For example, it may be detected that the user has modified the first rich text data by keyboard clicking and/or by mouse clicking, circling, dragging, etc.
Before the user performs the editing operation, the user can directly open the rich text editing interface by clicking the saved rich text document. The editing interface of the rich text editor may be opened first, and then the rich text document to be edited may be selected.
The second rich text data is rich text data after the user performs editing operation on the first rich text data on the rich text editing interface. There is some difference data between the second rich text data and the first rich text data. Alternatively, after detecting that the duration of time for which the user stops editing the first rich text data reaches the preset duration, acquiring the second rich text data edited by the user may be started.
In step 103, after detecting that the duration of time for which the user stops editing the first rich text data reaches the preset duration, determining that the user completes the editing operation, acquiring second rich text data edited by the user, and then starting to convert the acquired first rich text data and second rich text data into plain text data respectively.
In a possible implementation manner, the converting process is performed on the first rich text data and the second rich text data respectively to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data, where the converting process includes: after detecting the storage operation of the user on the second rich text data, responding to the storage operation, and respectively converting the first rich text data and the second rich text data to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data.
The user can be proved to finish the editing operation after detecting the saving operation of the user on the second rich text data. And respectively converting the acquired first rich text data and second rich text data into plain text data in response to the saving operation.
The converting the first rich text data and the second rich text data into the plain text data may be performed based on a preset processing rule. The preset processing rule can be understood as a replacement rule, and through the preset processing rule, the hypertext markup language (hyper text markup language, html) tag in the rich text can be replaced and removed, and the pictures in the rich text can be replaced by corresponding connection, text description and the like, so that the plain text data is finally obtained.
Specifically, the preset processing rule may be a javaScript string, and may include the following statements:
String.replaceAll('<br/>','\n').replaceAll('&nbsp;',”).replaceAll('--&gt',”).repla ceAll('</p>','\n').replace(/<(style|script|iframe)[^>]*?>[\s\S]+?<\/\1\s*>/gi,”).repla ce(/<[^>]+?>/g,”).replace(//g,”).replace(/>/g,”);
and converting the acquired first rich text data through the javaScript character string to obtain first plain text data corresponding to the first rich text data. And converting the acquired second rich text data to obtain second plain text data corresponding to the second rich text data.
Illustratively, assume that the content of the first rich text data is:
< p > System test progress
< P > currently there are 10 bug(s) remaining unresolved, including 4P 3, 6P 2
The content of the second rich text data is:
< p > System test progress
< P > currently the remaining 10 bugs are unresolved, including 4P 3, 9P 2-
Through the javaScript character string, html tags such as < p >, </p > and the like in the first rich text data can be deleted to obtain first plain text data:
system test progression
The remaining 10 bugs currently are unresolved, including 4P 3, 6P 2
The html tags such as < p >, </p > and the like in the second rich text data can be deleted through the javaScript character string to obtain second plain text data:
system test progression
The remaining 10 bugs currently are unresolved, including 4P 3, 9P 2.
In step 104, the converted first plain text data and the second plain text data may be compared according to different comparison rules, so as to determine difference data, and the determined difference data is marked and presented to the user.
Tagging may be understood as a rendering that distinguishes modified content from other content, and may be based on different formats. After marking the modified content, the modified content can be quickly determined according to the mark.
In a possible implementation manner, before determining the difference data based on the first plain text data and the second plain text data, the method further includes: receiving a configuration instruction input by a user; and determining a comparison rule according to the configuration instruction.
The configuration instruction input by the user can be a configuration instruction input by the user based on an interface of the comparison tool. After receiving a configuration instruction input by a user, determining a comparison rule in a comparison tool according to the configuration instruction, comparing the converted first plain text data and second plain text data according to the determined comparison rule, determining difference data, and marking out the determined difference data to be presented to the user. Illustratively, the comparison tool may be codeMirror and the comparison rule may be a package in codeMirror. For example, the first plain text data and the second plain text data may be compared by the following statement to invoke a packet in the CodeMirror.
CodeMirror.MergeView(target,{
value: this.oldValue,// last content
origLeft:null,
orig: this. Newvalue,// this content
mode is "text/html",// code mode is js mode
lineWrap: true// per line
styleActiveLine: true,// highlight
LineLepidator:' n-! Line feed
readOnly: this. Isreadonly,// read-only cannot be modified
});
In some embodiments, the difference data may be marked out in the first plain text data and the second plain text data for presentation to the user. As in the above embodiment, the difference data may be obtained by comparing the first plain text data and the second plain text data according to the configuration comparison method, and the characters 6 and 9 may be marked out in the first plain text data and the second plain text data and presented to the user.
In a possible implementation, the comparison rule includes a line comparison rule, determining difference data based on the first plain text data and the second plain text data, including: according to a line comparison rule, performing line comparison on the first plain text data and the second plain text data to determine first difference data; marking and presenting the difference data to a user, including: the first difference data is marked in a first format and presented to the user.
As in the foregoing embodiment, the comparison rule is a packet in the CodeMirror, and the CodeMirror may include multiple comparison rules, and the required comparison rule may be determined by a configuration instruction of the user. When the determined comparison rule is a line comparison rule, line comparison can be performed on the first plain text data and the second plain text data according to the line comparison rule, so as to determine first difference data.
The row comparison rules may include a comparison rule of a plurality of row comparisons and a comparison rule of a single row comparison. When the line comparison rule is a comparison rule of multi-line comparison, assuming that the multi-line is two lines, the comparison is performed by two lines starting from the first two lines in the first plain text data and the corresponding first two lines in the second plain text data in a two-line period. When the line comparison rule is a comparison rule of single line comparison, the line comparison is performed from the first line in the first plain text data and the corresponding first line in the second plain text data in a line period.
When different characters exist in the line numbers of the first plain text data and the second plain text data for line comparison, determining the line numbers of the first plain text data and the second plain text data for line comparison as first difference data. Wherein, the characters comprise various nationalities, punctuations, graphic symbols, numbers, spaces and the like.
If the line comparison rule is a comparison rule for comparing one line, namely a comparison rule for comparing one line, comparing the first line character of the first plain text data with the first line character of the second plain text data, judging whether different characters exist in the first line character of the first plain text data and the first line character of the second plain text data, determining the first line character of the first plain text data and the first line character of the second plain text data as first difference data when the different characters exist, and marking the first line character of the first plain text data and the first line character of the second plain text data in a first format. And so on, comparing each line of the first plain text data with each line of the second plain text data, determining the second plain text data and the first plain text data with different characters in the same line as first difference data, and marking the first difference data in a first format.
For example, assuming that the first format is a highlighting format, the second plain text data and the first plain text data are compared according to the above embodiment, so that a first line of the first plain text data and a first line of the second plain text data have no different characters, and a second line of the second plain text data have different characters, and then the second line of characters of the first plain text data and the second plain text data are determined as first difference data. And the second line character of the first plain text data, which is currently left with 10 bug unresolved, including 4P 3, 6P 2's, and the second line character of the second plain text data, which is currently left with 10 bug unresolved, including 4P 3, 9P 2's, are marked in a highlighted format, and the specific marked first plain text data and second plain text data are as shown in fig. 2.
In some embodiments, the display color of the highlighting format may be preset in advance, for example, the display color set in advance is yellow, and each line in which different characters exist in the first plain text data and the second plain text data is marked in the yellow highlighting format.
By the method, the first plain text data and the second plain text data are compared to determine the first difference data, and the determined first difference data are marked by using the first format, so that a user can conveniently and quickly determine the position of the first difference data.
In a possible implementation, the comparison rule includes a character comparison rule, determining difference data based on the first plain text data and the second plain text data, and further including: according to the character comparison rule, performing character comparison on the first plain text data and the second plain text data, and determining second difference data; determining a type of the second difference data; marking and presenting the difference data to a user, including: the second difference data is marked in a different type of associated format and presented to the user.
As in the foregoing embodiment, the comparison rule is a packet in the CodeMirror, and the CodeMirror may include multiple comparison rules, and the required comparison rule may be determined by a configuration instruction of the user. When the determined comparison rule is a character ratio rule, the first plain text data and the second plain text data can be subjected to character comparison according to the character ratio rule, and the second difference data can be determined.
The content for performing character comparison may be all characters in the first plain text data and the second plain text data, or may be characters contained in the first plain text data and the second plain text data marked in the first format.
And if the content for character comparison is characters contained in the first plain text data and the second plain text data marked in the first format, comparing the characters in the same line marked in the first format in the first plain text data and the second plain text data one by one, and determining the changed characters to obtain second difference data. The second difference data is different from the first difference data by taking characters as units, and at least one character is included in the second difference data.
The type of the second differential data may be determined by the location where the second differential data exists. Specifically, the second difference data is a character that changes, and the type of the second difference data may be determined according to whether the character that changes at the time of comparison is a character that exists in the first plain text data or a character that exists in the second plain text data.
The different types may be associated with one marking format, and the second difference data may be marked and presented to the user using the format associated with the type after the type of the second difference data is determined.
In particular, different data types may be associated with different formats or the same format. For example, when there are three types of data, type one, type two may be associated with the second format and type three may be associated with the third format. Wherein type one and type two are associated with the same format and type one and type three are associated with different formats. This is not limiting in the embodiments of the present application.
Illustratively, as shown in FIG. 2, the second line of characters of the first plain text data and the second plain text data are marked in a highlighted format. The second line character of the first plain text data, which currently has 10 bug unresolved, including 4P 3, 6P 2, and the second line character of the second plain text data, which currently has 10 bug unresolved, including 4P 3, 9P 2, are compared one by one, resulting in the changed character being "6" in the first plain text data and "9" in the second plain text data. Then the character "6" and the character "9" are determined as second difference data, and then the type of the second difference data is determined according to the positions where the character "6" and the character "9" exist, and the character "6" and the character "9" are marked and presented to the user in a format associated with the types of the character "6" and the character "9".
In a possible implementation manner, the types of the second difference data include a deletion type and a new type, and the second difference data is marked according to different types of associated formats and presented to the user, including: if the second difference data is of a deletion type, marking the second difference data according to a second format; and if the second difference data is of the newly added type, marking the second difference data according to a third format.
And when the second difference data is the data which exists in the first plain text and does not exist in the second plain text, determining the second difference data as the deleted data. That is, when the position where the second difference data exists is in the first plain text, the second difference data is determined to be of the deletion type. At this time, the second difference data determined as the deletion type in the first plain text data is marked in the second format.
And when the second difference data is the data which does not exist in the second plain text and exists in the first plain text, determining that the second difference data is the newly added data. That is, when the position where the second difference data exists is in the second plain text, the second difference data is determined to be of the newly added type. At this time, the second difference data of the newly added type is determined in the second plain text data according to the third format flag.
Illustratively, assume that the second format is a green wavy line format and the third format is a red wavy line format. The second difference data includes a character "6" and a character "9". The character "6" is a character in which the first plain text data exists, and a character in which the second plain text data does not exist, that is, the data type in which the character "6" is determined to be a deletion type. At this time, the character "6" is marked in the first plain text data in a green wavy line format. The character "9" is a character in which the first plain text data does not exist, and the character in which the second plain text data exists, that is, the data type of the character "9" is determined to be the newly added type. At this time, the character "9" is marked in the red wavy line format in the second plain text data.
Through the method, the first plain text data and the second plain text data are subjected to character comparison to determine the second difference data, and the type of the second difference data is determined, so that different types of difference data can be marked out by using different formats and presented to a user, and the user can conveniently and quickly distinguish the types of the difference data.
In a possible implementation manner, the method further includes: displaying the marked difference data and presenting the marked difference data to a target interface of a user; detecting a save-determining operation performed by the user on the target interface, and storing the second rich text data in response to the save-determining operation; or detecting an exit operation executed by the user on the target interface, responding to the exit operation, returning to the editing interface of the user on the first rich text data, and not storing the second rich text data.
The target interface is a rich text contrast interface and can be displayed in a popup window mode. The rich text contrast interface may include the first plain text data and the second plain text data marked up in various formats as described above. The marked difference data may be difference data marked in different formats in the converted first plain text data and second plain text data.
Alternatively, the marked first plain text data and second plain text data may be displayed on the rich text contrast interface correspondingly left and right, or may be displayed on the rich text contrast interface correspondingly up and down. The embodiment of the present application is not limited thereto.
Fig. 2 is a schematic diagram of a rich text comparison interface according to an embodiment of the present application. The marked first plain text data and the marked second plain text data are correspondingly displayed on the rich text comparison interface in the left-right mode.
Illustratively, as shown in fig. 2, the rich text contrast interface 200 includes a close button 201, a cancel button 202, a ok button 203, a title bar 204, a left display area 205, and a right display area 206.
Wherein the close button 201 is in the title bar 204. The title bar displays prompt information 'the left side is the first data of the database and the right side is the second data', and prompts the user: the left display area 205 is marked first plain text data, and the right display area 206 is marked second plain text data.
When an operation of clicking the ok button 203 by the user is detected, that is, it is detected that the user performs an operation of determining saving on the target interface. The first plain text data and the second plain text data representing the marks that the user has viewed the display determine that the editing is correct, and the edited second rich text data needs to be saved. At this time, in response to the user clicking the ok button 203, the current rich text data is saved in the database.
In some embodiments, in response to the user clicking the ok button 203, the rich text comparison interface may be closed, and the rich text editing interface may be redisplayed to enable the user to continue editing the second rich text data, where the saved second rich text data is used as the rich text data before the editing operation.
When it is detected that the user clicks the close button 201 or the cancel button 202, it is detected that the user performs the exit operation on the target interface. Representing the marked first plain text data and second plain text data that the user has viewed the display, and requiring continued editing of the second rich text data. At this time, in response to the user clicking the close button 201, the rich text contrast interface is closed, and a rich text editing interface is displayed so that the user continues editing the first rich text data.
By the method, the marked difference data is presented to the user through the display target interface, so that the user can more intuitively and clearly check the content modified by the editing operation, and the secondary confirmation before the storage is realized.
In summary, the method and the device can compare the edited rich text content with the rich text content before editing, mark the difference data and present the difference data to the user, so that the content which is reminded of the user to modify the content this time is realized, and the use experience of the user is improved. The situation that the same rich text is edited by different people in the same time period, and the edited content is covered and unknown can be avoided. Marking different difference data in different formats can allow the user to quickly locate the modified position and facilitate the user to quickly distinguish the type of modified data. The display target interface is displayed, so that a user can intuitively and clearly know the content of the modification, and the secondary confirmation before the rich text data is stored can be realized.
Fig. 3 is a schematic structural diagram of a device for comparing rich text contents according to an embodiment of the present application.
Illustratively, as shown in FIG. 3, the apparatus 300 includes:
an obtaining module 301, configured to obtain first rich text data stored in a database; when the editing operation of the user on the first rich text data is detected, acquiring second rich text data edited by the user;
The processing module 302 is configured to perform conversion processing on the first rich text data and the second rich text data, so as to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data;
a marking module 303 for determining difference data based on the first plain text data and the second plain text data, marking the difference data and presenting it to a user.
Optionally, the apparatus further comprises: the determining module is used for receiving a configuration instruction input by a user before determining difference data based on the first plain text data and the second plain text data; and determining a comparison rule according to the configuration instruction.
In a possible implementation, the comparison rule includes a row comparison rule, and the marking module 303 is specifically configured to: according to a line comparison rule, performing line comparison on the first plain text data and the second plain text data to determine first difference data; marking and presenting the difference data to a user, including: the first difference data is marked in a first format and presented to the user.
In a possible implementation, the comparison rule includes a character comparison rule, and the marking module 303 is further configured to: according to the character comparison rule, performing character comparison on the first plain text data and the second plain text data, and determining second difference data; determining a type of the second difference data; marking and presenting the difference data to a user, including: the second difference data is marked in a different type of associated format and presented to the user.
In a possible implementation manner, the types of the difference data include a deletion type and a new type, and the second difference data is marked according to the format associated by different types and presented to the user, including: if the second difference data is of a deletion type, marking the second difference data according to a second format; and if the second difference data is of the newly added type, marking the second difference data according to a third format.
Optionally, the apparatus further comprises: the display module is used for displaying the marked difference data and presenting the marked difference data to a target interface of a user; the detection module is used for detecting the operation of determining to save, which is executed by a user on the target interface, and storing the second rich text data in response to the operation of determining to save; or detecting an exit operation executed by the user on the target interface, responding to the exit operation, returning to the editing interface of the user on the first rich text data, and not storing the second rich text data.
In a possible implementation manner, the apparatus further includes: and the updating module is used for taking the second rich text data as the rich text data of the next editing operation after storing the second rich text data.
In a possible implementation manner, the processing module 302 is specifically configured to, after detecting a saving operation of the second rich text data by the user, respectively perform conversion processing on the first rich text data and the second rich text data in response to the saving operation, so as to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data.
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Illustratively, as shown in FIG. 4, the electronic device 400 includes: a memory 401 and a processor 402, wherein the memory 401 stores executable program code 4011, and the processor 402 is configured to invoke and execute the executable program code 4011 to perform a rich text content comparison method.
In this embodiment, the electronic device may be divided into functional modules according to the above method example, for example, each functional module may be corresponding to one processing module, or two or more functions may be integrated into one processing module, where the integrated modules may be implemented in a hardware form. It should be noted that, in this embodiment, the division of the modules is schematic, only one logic function is divided, and another division manner may be implemented in actual implementation.
In the case of dividing each function module with corresponding each function, the electronic device may include: an acquisition module, a processing module, a marking module and the like. It should be noted that, all relevant contents of each step related to the above method embodiment may be cited to the functional description of the corresponding functional module, which is not described herein.
The electronic device provided in this embodiment is configured to perform the above-described method for comparing rich text content, so that the same effects as those of the above-described implementation method can be achieved.
In case an integrated unit is employed, the electronic device may comprise a processing module, a memory module. The processing module can be used for controlling and managing the actions of the electronic equipment. The memory module may be used to support the electronic device in executing, inter alia, program code and data.
Wherein a processing module may be a processor or controller that may implement or execute the various illustrative logical blocks, modules, and circuits described in connection with the present disclosure. A processor may also be a combination of computing functions, e.g., including one or more microprocessors, digital signal processing (digital signal processing, DSP) and microprocessor combinations, etc., and a memory module may be a memory.
The present embodiment also provides a computer readable storage medium having stored therein computer program code which, when run on a computer, causes the computer to perform the above-described related method steps to implement a method for rich text content comparison in the above-described embodiments.
The present embodiment also provides a computer program product which, when run on a computer, causes the computer to perform the above-described related steps to implement a method of rich text content comparison in the above-described embodiments.
In addition, the electronic device provided by the embodiment of the application can be a chip, a component or a module, and the electronic device can comprise a processor and a memory which are connected; the memory is used for storing instructions, and when the electronic device runs, the processor can call and execute the instructions to enable the chip to execute the method for comparing the rich text content.
The electronic device, the computer readable storage medium, the computer program product or the chip provided in this embodiment are used to execute the corresponding method provided above, so that the beneficial effects thereof can be referred to the beneficial effects in the corresponding method provided above, and will not be described herein.
It will be appreciated by those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (11)

1. A method of rich text content comparison, the method comprising:
Acquiring first rich text data stored in a database;
when the editing operation of the user on the first rich text data is detected, acquiring second rich text data edited by the user;
respectively converting the first rich text data and the second rich text data to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data;
difference data is determined based on the first plain text data and the second plain text data, the difference data is marked and presented to the user.
2. The method of claim 1, wherein prior to said determining difference data based on said first plain text data and said second plain text data, said method further comprises:
receiving a configuration instruction input by a user;
and determining a comparison rule according to the configuration instruction.
3. The method of claim 2, wherein the contrast rule comprises a line contrast rule, the determining difference data based on the first plain text data and the second plain text data comprising:
according to the line comparison rule, comparing the first plain text data with the second plain text data to determine first difference data;
The tagging and presenting the difference data to the user includes:
the first difference data is marked in a first format and presented to the user.
4. A method according to claim 2 or 3, wherein the comparison rules comprise character comparison rules, the determining difference data based on the first plain text data and the second plain text data further comprising:
according to the character comparison rule, comparing the characters of the first plain text data with the characters of the second plain text data, and determining second difference data;
determining a type of the second difference data;
the tagging and presenting the difference data to the user includes:
the second difference data is marked and presented to the user in a different type of associated format.
5. The method of claim 4, wherein the types of difference data include a delete type, a add type, and wherein the marking and presenting the second difference data to the user in a marking format associated with a different type comprises:
if the second difference data is of a deletion type, marking the second difference data according to a second format;
And if the second difference data is of a new type, marking the second difference data according to a third format.
6. The method according to claim 1 or 2, characterized in that the method further comprises:
displaying a target interface for marking the difference data and presenting the difference data to a user;
detecting a save-determining operation performed by a user on the target interface, and storing the second rich text data in response to the save-determining operation; or alternatively, the process may be performed,
and detecting an exit operation executed by the user on the target interface, responding to the exit operation, returning to an editing interface of the user on the first rich text data, and not storing the second rich text data.
7. The method of claim 6, wherein after storing the second rich text data, the method further comprises:
and taking the second rich text data as the rich text data of the next editing operation.
8. The method according to claim 1 or 2, wherein the converting the first rich text data and the second rich text data to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data includes:
After detecting the storage operation of the user on the second rich text data, responding to the storage operation, and respectively converting the first rich text data and the second rich text data to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data.
9. An apparatus for rich text content comparison, the apparatus comprising:
the acquisition module is used for acquiring the first rich text data stored in the database; when the editing operation of the user on the first rich text data is detected, acquiring second rich text data edited by the user;
the processing module is used for responding to the storage operation after detecting the storage operation of the second rich text data by a user, and converting the first rich text data and the second rich text data through a preset processing rule to obtain first plain text data corresponding to the first rich text data and second plain text data corresponding to the second rich text data;
and the marking module is used for determining difference data based on the first plain text data and the second plain text data, marking the difference data and presenting the difference data to the user.
10. An electronic device, the electronic device comprising:
a memory for storing executable program code;
a processor for calling and running the executable program code from the memory, causing the electronic device to perform the method of any one of claims 1 to 8.
11. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program which, when executed, implements the method according to any of claims 1 to 8.
CN202310758582.9A 2023-06-26 2023-06-26 Method, device, electronic equipment and storage medium for comparing rich text content Pending CN116992852A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310758582.9A CN116992852A (en) 2023-06-26 2023-06-26 Method, device, electronic equipment and storage medium for comparing rich text content

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310758582.9A CN116992852A (en) 2023-06-26 2023-06-26 Method, device, electronic equipment and storage medium for comparing rich text content

Publications (1)

Publication Number Publication Date
CN116992852A true CN116992852A (en) 2023-11-03

Family

ID=88531000

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310758582.9A Pending CN116992852A (en) 2023-06-26 2023-06-26 Method, device, electronic equipment and storage medium for comparing rich text content

Country Status (1)

Country Link
CN (1) CN116992852A (en)

Similar Documents

Publication Publication Date Title
US10733357B2 (en) Method for managing and selectively arranging sets of multiple documents and pages within documents
US8667410B2 (en) Method, system and computer program product for transmitting data from a document application to a data application
US7707498B2 (en) Specific type content manager in an electronic document
US7516406B1 (en) Partial functionality indicator
CN114330233A (en) Method for realizing correlation between electronic form content and file through file bottom
Yang et al. Don’t do that! hunting down visual design smells in complex uis against design guidelines
US10789418B2 (en) Batch generation of links to documents based on document name and page content matching
IL226027A (en) Bidirectional text checker and method
US8737746B2 (en) Method for multiple pass symbol and components-based visual object searching of documents
US10936172B2 (en) Method of computerized presentation of a document set view for auditing information and managing sets of multiple documents and pages
JP6237135B2 (en) Information processing apparatus and information processing program
US20050044528A1 (en) Systems and methods for viewing code
JP2004110825A (en) Method and system for emphasizing free form notation
CN112417826B (en) PDF online editing method and device, electronic equipment and readable storage medium
US7043689B2 (en) Managing zero-width markers
US8423913B1 (en) Methods and apparatus to display style-related information
CN116992852A (en) Method, device, electronic equipment and storage medium for comparing rich text content
CN113919287B (en) Entity relationship labeling method and device combining RPA and AI and electronic equipment
US8015485B2 (en) Multidimensional web page ruler
US20220091863A1 (en) Dynamically generating guided tours for software
CN111460792B (en) Auxiliary editing and correcting method and device and storage medium
Cuff et al. Statistical analysis of surgical pathology data using the R program
KR20070014219A (en) Automatic web source creation system
US10824805B2 (en) Systems and methods for automated review and editing of presentations
JPWO2010035388A1 (en) GUI evaluation system, GUI evaluation method, and GUI evaluation program

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