Collaborative editing method and device for rich text format document and storage medium

By building a semantic tree of rich text format documents and performing parameter update detection, the semantic conflicts and rendering exceptions of collaborative editing of rich text format documents in the existing technology are solved, and efficient and accurate collaborative editing of documents is achieved.

CN119692311APending Publication Date: 2025-03-25ZHEJIANG HUACHUANG VISION TECH CO LTD
View PDF 0 Cites 9 Cited by

Patent Information

Application Number
CN202411535348.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

It is difficult for the prior art to collaborate on rich text format documents effectively and accurately, especially when dealing with documents with complex content, there are problems of semantic conflicts and rendering exceptions.

Method used

The semantic tree is constructed by taking each document in a rich text format as a node, the attributes of the document element as the semantic information of the node, and the spatial structure relationship between each document element as an edge. In response to the editing operation, the parameters are updated, the semantic conflicts are detected and the preset conflict resolution strategy is corrected, and the revised document is finally synchronized to all editing ends.

Benefits of technology

It realizes effective and accurate collaborative editing of rich text format documents, reduces the risks of semantic errors and rendering exceptions, and ensures the consistency and accuracy of the documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119692311A_ABST
    Figure CN119692311A_ABST
Patent Text Reader

Abstract

The invention discloses a collaborative editing method and device for a rich text format document and a storage medium, and the collaborative editing method for the rich text format document comprises the steps: taking each document element of the rich text format document as a node, and taking the attribute of the document element as the semantic information of the node, constructing a semantic tree by taking the spatial structure relationship between the document elements as an edge; performing parameter updating on nodes in the semantic tree according to the editing operation; nodes which do not meet constraint rules in the semantic tree after parameter updating are detected, and semantic conflict nodes are obtained; and performing semantic conflict correction on the semantic conflict node according to a conflict resolution strategy to obtain a corrected rich text format document, and synchronizing the corrected rich text format document to all editing ends. According to the method, effective and accurate collaborative editing can be carried out on the rich text format document, conflict detection and solution are carried out on the semantic level, and the risk of semantic errors and rendering abnormity in the collaborative editing process is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of collaborative data editing, and in particular to a collaborative editing method, device and storage medium for rich text format documents. Background Art

[0002] Collaborative document editing is a way of working in which multiple editors edit and modify the same document to achieve real-time collaboration. Through real-time collaboration, multiple editors can instantly share ideas and negotiate decisions, reduce the time and errors of information transmission, avoid version conflicts and misoperations, and ensure the consistency and accuracy of documents.

[0003] Traditional document collaborative editing usually deals with relatively simple data structures, such as lists and mappings, and cannot handle documents with complex content, especially rich text format documents that contain rich geometry, styles, text, and interactive information.

[0004] Therefore, how to perform effective and accurate collaborative editing of rich text format documents is an urgent problem to be solved by those skilled in the art. Summary of the invention

[0005] The present application at least provides a method, device and storage medium for collaborative editing of rich text format documents.

[0006] In a first aspect, the present application provides a collaborative editing method for a rich text document, the method comprising: taking each document element of the rich text document as a node, taking the attributes of the document element as the semantic information of the node, and taking the spatial structural relationship between each document element as an edge, to construct a semantic tree corresponding to the rich text document; in response to a node editing operation sent by any editing end, updating parameters of the nodes in the semantic tree according to the editing operation; detecting nodes in the semantic tree after the parameter update that do not satisfy preset constraint rules, and obtaining semantic conflict nodes; wherein the constraint rules include at least one of node semantic constraints and inter-node constraints, the node semantic constraints are used to limit the rules that the semantic information of the node needs to satisfy, and the inter-node constraints are used to limit the rules that the spatial structural relationship between nodes needs to satisfy; according to a preset conflict resolution strategy, performing semantic conflict correction on the semantic conflict node to obtain a corrected rich text document, and synchronizing the corrected rich text document to all editing ends.

[0007] In one embodiment, the rich text format document also contains layout parameters, and the layout parameters are used to limit the canvas for displaying each document element and the size of each document element relative to the canvas; the method also includes: constructing a set of final consistency registers based on the layout parameters, and each type of layout parameter corresponds to a final consistency register; wherein, when the final consistency register applies multiple modification operations to a parameter, the last modification operation will overwrite the previous modification operations; receiving a parameter modification instruction for at least one layout parameter sent by any editing end, the parameter modification instruction carries a new parameter value; based on the new parameter value, updating the value of the final consistency register corresponding to the layout parameter specified to be modified by the parameter modification instruction.

[0008] In one embodiment, after updating the value of the final consistency register corresponding to the layout parameter modified by the parameter modification instruction based on the new parameter value, the method also includes: dividing the semantic tree into multiple subtrees to obtain multiple layout units, and different layout units depend on different layout parameters; detecting the layout units containing the layout parameters modified by the parameter modification instruction in the dependent layout parameters to obtain the affected layout units; and updating the layout of the affected layout units based on the layout parameters after the value update.

[0009] In one embodiment, nodes in a semantic tree after parameter update that do not satisfy preset constraint rules are detected to obtain semantic conflict nodes, including: performing dependency analysis on each node in the semantic tree, and recording the dependent nodes corresponding to each node; wherein the probability of a semantic conflict between a node and its corresponding dependent node is greater than a preset threshold; using the node after parameter update according to the editing operation as a modification node, and using the dependent node corresponding to the modification node as a conflict detection node; and based on the constraint rules, detecting whether each conflict detection node has a semantic conflict.

[0010] In one embodiment, constraint rules correspond to constraint priorities, and conflict correction strategies are associated and stored corresponding to different constraint rules. The conflict correction strategies are used for semantic conflict correction; according to a preset conflict resolution strategy, semantic conflict correction is performed on semantic conflict nodes to obtain a corrected rich text format document, including: taking constraint rules that are not satisfied by semantic conflict nodes as target constraint rules; detecting target constraint rules with constraint conflicts among all target constraint rules to obtain conflict constraint rules; wherein, if conflicts exist when two target constraint rules are semantically corrected according to corresponding conflict correction strategies, it is determined that there is a constraint conflict between the two target constraint rules; comparing the constraint priorities between the conflict constraint rules, selecting the conflict correction strategy corresponding to the conflict constraint rule with the highest constraint priority, performing semantic conflict correction on the semantic conflict nodes to obtain a corrected rich text format document.

[0011] In one embodiment, constraint rules correspond to constraint priorities, and different constraint rules correspond to associated storage of conflict correction strategies, which are used for semantic conflict correction; according to a preset conflict resolution strategy, semantic conflict correction is performed on semantic conflict nodes to obtain a corrected rich text format document, including: taking the constraint rules that are not satisfied by the semantic conflict nodes as directed graph nodes, and taking the constraint conflict relationships between the constraint rules as directed graph edges to construct a constraint directed graph; detecting the loops contained in the constraint directed graph, and deleting the directed graph nodes with the lowest constraint priority on the loop until the loop is eliminated; based on the conflict correction strategies corresponding to the currently retained constraint rules, semantic conflict correction is performed on the semantic conflict nodes to obtain a corrected rich text format document.

[0012] In one embodiment, semantic conflict correction is performed on semantic conflict nodes according to a preset conflict resolution strategy to obtain a corrected rich text format document, including: obtaining all conflict correction strategies for the semantic conflict nodes; in a display interface corresponding to the rich text format document, highlighting the document content corresponding to the semantic conflict nodes, and displaying all conflict correction strategies in association; in response to any displayed conflict correction strategy being selected, modifying the semantic conflict nodes according to the selected conflict correction strategy to obtain a corrected rich text format document.

[0013] In one embodiment, the method further includes: assigning a semantic identifier to the general semantic information, associating the general semantic information and the semantic identifier and storing them in a semantic dictionary, and the node references the general semantic information through the semantic identifier.

[0014] According to a second aspect of the present application, there is provided a collaborative editing device for rich text format documents, the device comprising: a semantic tree construction module, for taking each document element of the rich text format document as a node, taking the attributes of the document element as the semantic information of the node, and taking the spatial structural relationship between each document element as an edge, to construct a semantic tree corresponding to the rich text format document; a parameter update module, for responding to a node editing operation sent by any editing end, and updating the parameters of the nodes in the semantic tree according to the editing operation; a semantic conflict detection module, for detecting nodes in the semantic tree after parameter update that do not satisfy preset constraint rules, and obtaining semantic conflict nodes; wherein the constraint rules include at least one of node semantic constraints and inter-node constraints, the node semantic constraints are used to limit the rules that the semantic information of the node needs to satisfy, and the inter-node constraints are used to limit the rules that the spatial structural relationship between nodes needs to satisfy; a conflict correction module, for performing semantic conflict correction on the semantic conflict nodes according to a preset conflict resolution strategy, to obtain a corrected rich text format document, and synchronizing the corrected rich text format document to all editing ends.

[0015] A third aspect of the present application provides an electronic device, including a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement the above-mentioned collaborative editing method of rich text format documents.

[0016] A fourth aspect of the present application provides a computer-readable storage medium having program instructions stored thereon, which implement the above-mentioned collaborative editing method of rich text format documents when the program instructions are executed by a processor.

[0017] The above scheme constructs a semantic tree corresponding to the rich text document by taking each document element of the rich text document as a node, the attributes of the document element as the semantic information of the node, and the spatial structural relationship between each document element as an edge; in response to a node editing operation sent by any editing end, the parameters of the nodes in the semantic tree are updated according to the editing operation; the nodes that do not satisfy the preset constraint rules in the semantic tree after the parameter update are detected to obtain semantic conflict nodes; according to the preset conflict resolution strategy, the semantic conflict nodes are corrected to obtain a corrected rich text document, and the corrected rich text document is synchronized to all editing ends, so that the rich text document can be effectively and accurately collaboratively edited, and conflicts can be detected and resolved at the semantic level, reducing the risk of semantic errors and rendering anomalies during the collaborative editing process.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.

[0020] Figure 1 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;

[0021] Figure 2 is a flowchart of a method for collaboratively editing a rich text format document shown in an exemplary embodiment of the present application;

[0022] Figure 3 is a flowchart of semantic conflict detection shown in an exemplary embodiment of the present application;

[0023] Figure 4 is a flowchart of semantic conflict resolution shown in an exemplary embodiment of the present application;

[0024] Figure 5 is a flowchart of semantic conflict resolution shown in another exemplary embodiment of the present application;

[0025] Figure 6 is a block diagram of a collaborative editing device for a rich text format document shown in an exemplary embodiment of the present application;

[0026] Figure 7 is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present application;

[0027] Figure 8 It is a schematic diagram of the structure of a computer-readable storage medium shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0028] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0029] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0030] The term "and / or" in this article is only an association information describing the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the previous and next associated objects are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of, for example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C.

[0031] The following is a description of the collaborative editing method for a rich text format document provided in an embodiment of the present application.

[0032] Please refer to Figure 1 , which shows a schematic diagram of a solution implementation environment provided by an embodiment of the present application. The solution implementation environment may include multiple editing terminals 110 and servers 120, and the editing terminals 110 and the servers 120 are connected to each other in communication.

[0033] The editing terminal 110 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart watch, etc., but is not limited thereto.

[0034] Server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0035] In one example, a rich text document is stored in the server 120. The server 120 receives editing operations on the rich text document from each editing terminal 110, modifies the rich text document, and finally feeds back the modified consistent rich text document to each editing terminal 110 to achieve multi-terminal collaborative editing.

[0036] In the collaborative editing method for rich text format documents provided in the embodiment of the present application, the execution subject of each step can be the editing terminal 110, or the server 120, or the editing terminal 110 and the server 120 can cooperate with each other to execute, that is, part of the steps of the method are executed by the editing terminal 110 and the other steps are executed by the server 120.

[0037] See also Figure 2 , Figure 2 is a flowchart of a method for collaboratively editing a rich text document as shown in an exemplary embodiment of the present application. The method for collaboratively editing a rich text document can be applied to Figure 1 It should be understood that the method can also be applied to other exemplary implementation environments and be specifically executed by devices in other implementation environments, and this embodiment does not limit the implementation environment to which the method is applicable.

[0038] like Figure 2 As shown, the collaborative editing method for a rich text format document includes at least steps S210 to S240, which are described in detail as follows:

[0039] Step S210: Take each document element of the rich text document as a node, the attributes of the document element as the semantic information of the node, and the spatial structural relationship between each document element as an edge to construct a semantic tree corresponding to the rich text document.

[0040] Among them, rich text format documents refer to documents containing rich text content, including but not limited to scalable vector graphics documents (SVG), vector graphics documents (Adobe illustrator, AI), encapsulated postscript language documents (EPS), etc. This application does not limit this.

[0041] A rich text format document is composed of multiple document elements, such as one or more of geometric elements, text elements, table elements, etc.

[0042] Each document element corresponds to attribute information, such as one or more of the coordinates, size, fill color, stroke color, text style, and spatial relationship with other document elements of a geometric figure.

[0043] For example, the attributes of geometric elements mainly describe the position and size of geometric figures; the attributes of style elements mainly describe visual parameters; and the attributes of text elements include text content and layout information.

[0044] Optionally, in order to better describe the structure and semantics of a rich text document, a domain-specific language (DSL) may be designed for a rich text document to define various types of document elements in the rich text document. For example, the geometric elements in an SVG document: rectangle (Rect), circle (Circle), path (Path) are defined, and the defined data types include the coordinates, size, fill color, stroke color, text style, spatial relationship with other document elements and other attribute information of the corresponding document element.

[0045] For example, Rect can be defined as a five-tuple, Rect: (id, x, y, width, height), which means a rectangle with width and height located at (x, y). ID is the number of the rectangle, and can further contain other attributes of the rectangle, such as fill color, stroke color, etc., as well as the spatial relationship with other document elements, such as the id of other referenced document elements (parent_id), the stacking order of document elements (z-index), etc.

[0046] Then, each document element of the rich text document is taken as a node, the attributes of the document element are taken as the semantic information of the node, and the spatial structural relationship between each document element is taken as an edge to construct a semantic tree corresponding to the rich text document.

[0047] The spatial hierarchical relationship between document elements is clearly expressed through a tree structure, so that during collaborative editing, the tree hierarchy can be used to limit the editing granularity and propagation scope.

[0048] In addition, by converting rich text documents into semantic trees, it is convenient to edit rich text documents in combination with graph theory algorithms. For example, when performing editing operations on the syntax tree, a topological sorting algorithm can be used to recalculate the rendering order of each document element.

[0049] Step S220: In response to a node editing operation sent by any editing terminal, update parameters of the nodes in the semantic tree according to the editing operation.

[0050] There may be multiple editing terminals, which receive node editing operations sent by any editing terminal to update parameters of nodes in the semantic tree according to the editing operations.

[0051] Exemplarily, the editing end displays a document editing page, which is used to display a rich text document and provides editing entries for each document element of the rich text document. The editing end sends a node editing operation to the server in response to the editing instruction received from the editing entry.

[0052] The node editing operation includes but is not limited to one or more instructions of adding new document elements, deleting existing document elements, modifying the attributes of existing document elements, modifying the spatial structural relationship between document elements, etc.

[0053] According to the node editing operation sent by the editing end, one or more parameter update operations are performed on the semantic tree, including adding new document elements, deleting existing document elements, modifying the attributes of existing document elements, modifying the spatial structure relationship between document elements, etc.

[0054] Step S230: Detect nodes that do not satisfy preset constraint rules in the semantic tree after parameter update to obtain semantic conflict nodes.

[0055] Semantic conflict refers to errors in the semantic information of a node, which may be errors in the semantic information of the node itself, or logical conflicts between the semantic information of the node and the semantic information of other nodes.

[0056] After detecting that the semantic tree has been updated, whether there is a semantic conflict in the semantic tree after the parameter update is detected in real time. Specifically, the nodes in the semantic tree after the parameter update that do not satisfy the preset constraint rules are detected. If the node does not satisfy at least one constraint rule, the node is regarded as a semantic conflict node.

[0057] Among them, the constraint rules include at least one of node semantic constraints and inter-node constraints. The node semantic constraints are used to limit the rules that the semantic information of the node needs to satisfy, and the inter-node constraints are used to limit the rules that the spatial structural relationship between nodes needs to satisfy.

[0058] For example, the constraint rules include: whether the geometric shape of the document element overlaps with other document elements; whether there is invalid element nesting (such as circle embedded in rect); whether the coordinates or size of the document element exceeds the preset range; whether the referenced document element ID exists; whether the attribute values ​​such as fill color and stroke color are within the preset value range.

[0059] It should be noted that the constraint rules can be flexibly set according to the actual application scenario, and this application does not limit this.

[0060] Step S240: according to a preset conflict resolution strategy, semantic conflict correction is performed on the semantic conflict node to obtain a corrected rich text format document, and the corrected rich text format document is synchronized to all editing terminals.

[0061] Once it is discovered that a node editing operation will cause a semantic conflict, it is necessary to enter the conflict resolution logic.

[0062] It should be noted that there are various strategies for resolving conflicts, which may include adjusting the coordinates of geometric figures to avoid overlap between the geometric figures and other document elements, limiting the radius of the circle so that it does not exceed the canvas boundaries, changing the rendering order between document elements, deleting document elements whose attribute values ​​are not within a preset range, etc.

[0063] According to various anticipated semantic conflicts, corresponding semantic conflict correction methods can be pre-set to obtain multiple conflict resolution strategies, so that semantic conflict correction can be performed on semantic conflict nodes according to the preset conflict resolution strategies to obtain a corrected rich text format document.

[0064] It should be noted that the conflict resolution strategy can be flexibly set according to the actual application scenario, and this application does not limit this.

[0065] Then, the revised rich text format document is synchronized to all editing terminals to ensure that all editing terminals finally view consistent rich text format document content, thereby ensuring the ultimate consistency of the rich text format document during the collaborative editing process.

[0066] Next, some embodiments of the present application are described in detail.

[0067] In some implementations, the method further includes: assigning a semantic identifier to the general semantic information, associating the general semantic information and the semantic identifier and storing them in a semantic dictionary, and the node referencing the general semantic information through the semantic identifier.

[0068] Among them, common semantic information refers to semantic information that is reused in multiple nodes.

[0069] For example, for geometric graphic elements, semantic information such as "gradient" and "filter" may be used in multiple geometric graphic elements. In order to reduce the duplication of semantic information in the semantic tree, this type of semantic information is used as general semantic information, a semantic identifier is assigned to the general semantic information, and the general semantic information and the semantic identifier are associated and stored in a semantic dictionary. In this way, the specific definition of the general semantic information is not directly stored in the nodes in the semantic tree, but the semantic identifier of the general semantic information is stored to achieve the reference of the general semantic information.

[0070] Optionally, general semantic information can be used as an independent node, and edges can be constructed for the nodes of document elements that apply the general semantic information. That is, the nodes in the semantic tree include general semantic information nodes and document element nodes, and the edges between nodes include semantic information reference edges and spatial structure relationship edges.

[0071] In some embodiments, the rich text format document also contains layout parameters; the method also includes: constructing a set of final consistency registers based on the layout parameters, each type of layout parameter corresponds to a final consistency register; wherein, when the final consistency register applies multiple modification operations to a parameter, the last modification operation will overwrite the previous modification operations; receiving a parameter modification instruction for at least one layout parameter sent by any editing end, the parameter modification instruction carrying a new parameter value; based on the new parameter value, updating the value of the final consistency register corresponding to the layout parameter specified to be modified by the parameter modification instruction.

[0072] Among them, the layout parameters are used to limit the canvas for displaying each document element and the size of each document element relative to the canvas. The canvas refers to the visualization window used to display document elements. The layout parameters can limit the width and height of the canvas, the visible area of ​​the canvas, the aspect ratio adjustment strategy of the canvas, etc.

[0073] Layout parameters and document elements together determine the final display effect of rich text on the screen.

[0074] Taking an SVG document as an example, the layout parameters may include one or more of viewBox, preserveAspectRatio, and width / height.

[0075] The viewBox is a container that contains position and size, and is used to define the viewing area of ​​the SVG content. By adjusting the x, y, width, and height values ​​of the viewBox, you can move and scale the SVG elements to suit different layout requirements.

[0076] preserveAspectRatio is an SVG attribute that specifies how to maintain the aspect ratio of an SVG element.

[0077] The width and height attributes define the external dimensions of the SVG element, that is, the absolute size of the canvas. Elements inside the SVG document will be confined to the range defined by the width and height attributes.

[0078] Of course, the above layout parameters are only illustrative examples, and other layout parameters may be included in actual application scenarios, which are not limited in this application.

[0079] The placement parameters are modeled as a set of eventually consistent registers, one for each type of placement parameter.

[0080] For example, the final consistency register can use the Last Write Wins (LWW) register. When multiple modification operations are applied to a parameter, the last modification operation will overwrite the previous modification operations. Then, when merging the parameter modification instructions of multiple editing ends, each final consistency register will converge to the last written value, ensuring that all editing ends will eventually see the same layout effect.

[0081] Of course, other methods can also be used to store layout parameters. It is only necessary to ensure that when multiple modification operations are applied to a parameter, the last modification operation will overwrite the previous modification operations, that is, multiple parameter modification instructions will eventually converge to a modification value.

[0082] Taking the LWW register as an example, the obtained layout parameter P can be identified as:

[0083] P = {viewBox:LWWRegister <string>,

[0084] preserveAspectRatio:LWWRegister <string>,

[0085] width:LWWRegister <float>,

[0086] height:LWWRegister <float>}

[0087] It constructs corresponding final consistency registers for layout parameters viewBox, preserveAspectRatio, width, and height respectively.

[0088] When receiving a parameter modification instruction for at least one layout parameter sent by any editing end, the new parameter value carried by the parameter modification instruction is written into the corresponding LWW register.

[0089] Of course, after updating the layout parameters, the sizes and positions of the affected document elements need to be recalculated, that is, the layout parameters need to be reapplied.

[0090] However, if the entire syntax tree is directly rearranged each time the layout parameters are updated, frequent global rearrangements will not only affect the system response speed, but may also lead to a significant decrease in the editing experience. Taking the above issues into consideration, this application only rearranges the nodes affected by the update of the layout parameters.

[0091] Specifically, after updating the value of the final consistency register corresponding to the layout parameter specified by the parameter modification instruction based on the new parameter value, the method also includes: dividing the semantic tree into multiple subtrees to obtain multiple layout units, and different layout units depend on different layout parameters; detecting the layout units containing the layout parameters specified by the parameter modification instruction in the dependent layout parameters to obtain the affected layout units; and updating the layout of the affected layout units based on the layout parameters after the value update.

[0092] The syntax tree is regarded as a set of layout units, which can be expressed as T = {u1, u2, ..., un}, where each layout unit ui is a subtree.

[0093] When dividing the semantic tree into multiple subtrees, in order to ensure the independence of each layout unit, the root node ri of the subtree needs to meet at least one of the following conditions:

[0094] 1) The root node ri is the root node of the syntax tree;

[0095] 2) The parent node of the root node ri has the transform attribute set;

[0096] 3) The parent node of the root node ri has the viewBox attribute set.

[0097] The tranform attribute is used to declare one or more transformations for a document element. It takes as input a list of transformation definitions in order. <transform-list>Values, each transformation definition is separated by spaces or commas, valid transformations are: rotation, scale, translation and skew.

[0098] A document element with a transform or viewBox attribute set will start a new local coordinate system. The layout of its subtrees is performed relative to this new coordinate system and is not affected by external layout. Therefore, they can be regarded as the boundaries of the layout unit.

[0099] By dynamically tracking the changes in the syntax tree, the division of the layout unit is adjusted in real time to obtain multiple layout units, and different layout units rely on different layout parameters.

[0100] Then, the layout units whose dependent layout parameters contain the layout parameters modified by the parameter modification instruction are detected, and the affected layout units are obtained.

[0101] When the layout parameters change, the affected layout units are identified and the affected layout unit set Ua is obtained, where: Wherein, param(ri) represents the set of layout parameters that the root node ri of the layout unit ui depends on; PΔ represents the set of layout parameters that have changed, that is, the layout parameters that are modified as specified by the parameter modification instruction.

[0102] Then, according to the layout parameters after the value update, the layout of the affected layout units is updated.

[0103] For example, it can be expressed as: Where Mi′ represents the rich text layout mapping after the layout unit ui is updated, Ei represents the document element set inside ui, and Pi′ represents the value of the layout parameter that ui depends on after the update.

[0104] In the above embodiment, by dividing the syntax tree into several independent layout units, the layout inside each layout unit is not affected by the outside. Therefore, when the layout parameters change, only the layout of the affected layout unit needs to be recalculated without touching other layout units, thereby improving the efficiency of layout update.

[0105] The editing end will also send node editing operations. When performing node editing operations, it is necessary to ensure consistency between multiple editing ends.

[0106] Among them, the consistency between multi-end editing can be achieved based on conflict-free replicated data type (CRDT) technology, such as Last Write Wins (LWW), Replicated Growable Array (RGA), Conflict-free Replicated Tree (CT) and other technologies to achieve data consistency.

[0107] It is also possible to achieve consistency between multi-terminal editing based on an operational transformation (OT) algorithm, which can be flexibly selected according to actual application conditions and is not limited in this application.

[0108] Of course, in addition to ensuring consistency between multiple editing terminals, for rich text format documents, it is also necessary to avoid semantic conflicts of nodes caused by node editing operations.

[0109] In some embodiments, see Figure 3 , Figure 3 is a flowchart of semantic conflict detection shown in an exemplary embodiment of the present application, such as Figure 3 As shown, including:

[0110] Step S231: perform dependency analysis on each node in the semantic tree, and record the dependent nodes corresponding to each node.

[0111] Among them, the probability of semantic conflict between a node and its corresponding dependent node is greater than a preset threshold.

[0112] A set of dependencies can be maintained for each document element, recording which other document elements it has potential semantic conflicts with.

[0113] Exemplarily, the spatial structural relationship between the nodes can be analyzed to determine the dependent nodes corresponding to each node. For example, if two rectangular elements intersect geometrically, the node identifiers of each other are recorded in their dependent items.

[0114] Exemplarily, the execution status of the node editing operation in the historical time period of the syntax tree can also be recorded, and the execution status is analyzed to determine the dependent nodes corresponding to each node. For example, all nodes with grammatical conflicts after the node editing operation is performed on the document element in the historical time period are recorded, and these nodes with grammatical conflicts are recorded as dependent nodes of the document element.

[0115] Step S232: The node after the parameter is updated according to the editing operation is used as the modification node, and the dependent node corresponding to the modification node is used as the conflict detection node.

[0116] Step S233: Based on the constraint rules, each conflict detection node is detected to see whether there is a semantic conflict.

[0117] Through the above embodiment, when a document element is modified, it is only necessary to check whether the dependent nodes of the document element have a grammatical conflict, without traversing all the nodes of the entire grammar tree.

[0118] For example, you can define a dependency function Dep, in, is an existential quantifier, attr(e) represents the attribute set of node e; attr(e') represents the attribute set of node e'; e' is the dependent node of node e; Conflict_Condition represents a constraint rule used to determine whether there is a semantic conflict between specific attributes of two nodes.

[0119] Based on the Dep function, the basic process of conflict detection can be obtained as follows:

[0120] Step 1: For each document element node e in the rich text format document, calculate its dependent node set Dep(e);

[0121] Step 2: When the attribute of node e changes, check whether there is a semantic conflict between e itself and each dependent node e' in Dep(e).

[0122] Among them, if e' belongs to Dep(e) and Conflict_Condition(e,e',attr(e),attr(e')) no longer holds, remove each other from Dep(e) and Dep(e'); if e' does not belong to Dep(e) and Conflict_Condition(e,e',attr(e),attr(e')) holds, add e' to Dep(e) and add e to Dep(e').

[0123] To determine whether there is a semantic conflict between e itself and each dependent node e' in Dep(e), we only need to check whether there is e or e' that satisfies Dep(e)!=empty set, and treat the nodes with Dep(e)!=empty set as semantic conflict nodes.

[0124] Of course, in addition to performing semantic conflict detection on some nodes as described above, semantic conflict detection may also be performed directly on all nodes, which is not limited in the present application.

[0125] The following are some examples of constraint rules:

[0126] Geometric constraints: For example, the radius of a circle must be non-negative, the width and height of a rectangle must be non-negative, etc.

[0127] Reference constraints: such as document elements <use>The xlink:href attribute must refer to a valid document element;

[0128] Nested constraints: such as document elements Document elements cannot be nested , document element <defs>Can only appear at the top level of a document, etc.

[0129] Specifically, the constraint that the circle radius is non-negative can be expressed as: Circle represents the collection of all circular elements in a rich text document, cr represents the radius attribute of circle c; document elements can be< / defs> Constraints that cannot be nested are expressed as: A represents all document elements in the rich text format document A collection of , < represents the ancestor-descendant relationship of the node.

[0130] Compared with the collaborative editing technology of the prior art that only focuses on the convergence of the data level, the present application ensures the structural integrity and semantic correctness of rich text format documents through constraint rules, provides semantic-level constraints, and ensures that the editing operations of different editing terminals satisfy these constraints in the collaborative editing scenario, thereby avoiding rendering errors or display failures.

[0131] Optionally, in order to facilitate semantic conflict calculation, constraint rules may be formally defined, that is, semantic conflicts that may occur in a rich text document may be formally defined.

[0132] For example:

[0133] Overlap(e1, e2): indicates that nodes e1 and e2 intersect geometrically;

[0134] Invalid_Nesting(e1, e2): indicates that the nesting relationship between nodes e1 and e2 is invalid, such as circle is embedded in rect;

[0135] Out_Of_Bound(e): indicates that the coordinates or size of node e exceeds the boundaries of the canvas;

[0136] Dangling_Reference(e, id): indicates that node e refers to a non-existent node id;

[0137] Invalid_Attribute_Value(e, attr): indicates that the value of the attribute attr of node e is not within the preset range, such as a negative radius value.

[0138] Based on the above constraint rules, the semantic conflict between node e1 and node e2 in rich text document d can be defined as:

[0139]

[0140] Overlap(e1, e2)∨

[0141] Invalid_Nesting(e1, e2)∨

[0142] Out_Of_Bound(e1)∨

[0143] Out_Of_Bound(e2)∨

[0144] Dangling_Reference(e1,e2.id)∨

[0145] Dangling_Reference(e2,el.id)∨

[0146] Invalid_Attribute_Value(e1,attr)V

[0147] Invalid_Attribute_Value(e2, attr)

[0148] Wherein, Elements(d) represents the set of nodes of all document elements in the rich text format document d, and ∨ represents or.

[0149] The above definition is based on the existential quantifier It means that as long as there is a node in the rich text document d that satisfies any of the above constraint rules, the rich text document d is considered to be in a semantic conflict state.

[0150] Of course, the above constraint rules are only schematic illustrations. In actual application scenarios, more types of constraint rules may be designed. For example, a threshold parameter can be introduced for the constraint rule Overlap, indicating that when the overlapping area or volume ratio of two elements exceeds the threshold, they are considered as semantic conflicts. This application does not limit the specific implementation method of the constraint rules.

[0151] In some implementations, constraint rules correspond to constraint priorities, and different constraint rules correspond to associated storage of conflict correction strategies, which are used to correct semantic conflicts; see Figure 4 , Figure 4 is a flowchart of semantic conflict resolution shown in an exemplary embodiment of the present application, such as Figure 4 As shown, including:

[0152] Step S2411: taking the constraint rules that are not satisfied by the semantic conflict node as the target constraint rules.

[0153] Step S2412: Detect target constraint rules with constraint conflicts among all target constraint rules to obtain conflicting constraint rules.

[0154] If two target constraint rules have conflicts when semantic conflict correction is performed according to the corresponding conflict correction strategies, it is determined that there is a constraint conflict between the two target constraint rules. At this time, when the conflict correction strategy of one target constraint rule is satisfied, the conflict correction strategy of the other target constraint rule cannot be satisfied.

[0155] Step S2413: Compare the constraint priorities between the conflicting constraint rules, select the conflict correction strategy corresponding to the conflicting constraint rule with the highest constraint priority, perform semantic conflict correction on the semantic conflict node, and obtain a corrected rich text format document.

[0156] When there is a conflict in the conflict correction strategies corresponding to the constraint rules, the constraint rules with higher priority are satisfied first, while the constraint rules with lower priority are sacrificed.

[0157] For example, geometric constraints can be given a higher priority than reference constraints because geometric constraints more directly affect the visual representation of graphics in the document. Therefore, when a node does not satisfy both the geometric constraints and the reference constraints, and there is a conflict between the conflict correction strategy corresponding to the geometric constraint and the conflict correction strategy corresponding to the reference constraint, the semantic conflict correction of the node is performed according to the conflict correction strategy corresponding to the geometric constraint.

[0158] In some embodiments, see Figure 5 , Figure 5 is a flowchart of semantic conflict resolution shown in another exemplary embodiment of the present application, such as Figure 5 As shown, including:

[0159] Step S2421: Take the constraint rules that are not satisfied by the semantic conflict nodes as directed graph nodes, take the constraint conflict relationships between the constraint rules as directed graph edges, and construct a constraint directed graph.

[0160] The constraint conflict relationship is used to indicate whether there is a constraint conflict between constraint rules.

[0161] Exemplarily, a rich text document is represented as a tuple space, in which each tuple corresponds to a constraint rule, and multiple editing terminals concurrently editing the rich text document corresponds to concurrently writing tuples into the tuple space.

[0162] For example, the tuple space of a rich text document is defined as a triple: TS = (T, W, R), where T represents a set of tuples, W represents a sequence of write operations on the tuple space, and R represents a set of constraint conflict relationships between tuples. When the editor submits a node edit operation, it is converted into a write operation w and added to W. Then, the constraint conflict relationship R is represented as a directed graph, and a constraint directed graph is constructed. In the constraint directed graph, each node represents a tuple, and each edge represents a constraint conflict relationship between two tuples. Constraint conflicts correspond to loops in the constraint directed graph.

[0163] Step S2422: Detect the loops contained in the constraint directed graph, and delete the directed graph nodes with the lowest constraint priority on the loop until the loop is eliminated.

[0164] To detect loops, a depth-first search (DFS) can be performed on the constraint directed graph. The time complexity of DFS is O(|T|+|R|), where |T| represents the number of tuples and |R| represents the number of constraint conflict relations.

[0165] In order to eliminate the loop, an iterative repair method can be used. In each iteration, the tuple (i.e., directed graph node) with the lowest constraint priority on the loop is selected and removed from the tuple space until the loop is eliminated. Assuming that the level of constraint priority is k, the worst time complexity of eliminating a single loop is O(k·|T|).

[0166] Step S2423: Based on the conflict correction strategy corresponding to the currently retained constraint rule, semantic conflict correction is performed on the semantic conflict node to obtain a corrected rich text format document.

[0167] After the constraint rules are deleted according to the above steps, the currently retained constraint rules are in a stable state. Based on the conflict correction strategy corresponding to the currently retained constraint rules, semantic conflict correction is performed on the semantic conflict nodes to obtain a corrected rich text format document.

[0168] In some embodiments, for complex semantic conflicts that are difficult to resolve automatically, the resolution steps include: obtaining all conflict correction strategies for the semantic conflict node; highlighting the document content corresponding to the semantic conflict node in the display interface corresponding to the rich text format document, and displaying all conflict correction strategies in association; in response to any displayed conflict correction strategy being selected, modifying the semantic conflict node according to the selected conflict correction strategy to obtain a corrected rich text format document.

[0169] For conflict correction strategies that may resolve semantic conflicts, they can be designed as a series of clickable operation buttons. For example, for geometric overlap conflicts, options such as "automatically adjust position" and "manually modify boundaries" can be provided; for reference invalidation conflicts, options such as "automatically repair references" and "manually select new reference targets" can be provided. When a conflict correction strategy is detected to be clicked, the corresponding conflict correction strategy is automatically executed, and the display content of the visual interface of the rich text format document and the semantic conflict prompt information are updated immediately.

[0170] Optionally, if the conflict correction strategy requires a long time, the execution progress of the conflict correction strategy may also be displayed.

[0171] In addition to enabling flexible strategy selection through visual interaction, other information can also be visualized during the collaborative editing process.

[0172] For example, in order to reflect the editing area, cursor position, selection range and other information of each editing end, so that each editing end can understand each other's editing progress and intentions, thereby better coordinating editing behaviors and avoiding unnecessary conflicts, a coloring-based visualization method can be adopted, that is, assigning different colors to the editing areas of different editing ends.

[0173] Furthermore, when there are many editing ends, in order to avoid the problem of insufficient color space and editing interference caused by too many colors, a semi-transparent rectangular overlay is created for each editing end, covering its current editing area. The border color of the rectangular overlay is used to distinguish different editing ends, and the fill color of the rectangular overlay is set with a degree of transparency to ensure that the underlying document content is visible. The cursor position and selection range of the editing end can be represented by a vertical line and a semi-transparent rectangle respectively. The color of the cursor line and the selection rectangle is consistent with the color of the editing area border of the corresponding editing end, thereby forming a visual response and coherence.

[0174] In addition, the editor's name, avatar and other information can be displayed on the edge or corner of the rectangular overlay to help each editor quickly identify each other. When the editor hovers the mouse over an editing area, detailed editing information of the area, such as editing time, modified content summary, etc., can be displayed in the form of tooltips.

[0175] Among them, when there are a large number of editing terminals and the editing area changes frequently, technologies such as incremental rendering and view reuse can be used to avoid visual page freezes.

[0176] Through the above display method, the information richness and visual clarity of the visual display can be effectively balanced, which can improve the efficiency of collaborative editing.

[0177] For example, the area where the semantic conflict occurs is highlighted in the visual interface of the rich text format document, such as marked with a red semi-transparent rectangle, wherein the transparency of the rectangle can be dynamically adjusted according to the severity of the semantic conflict to intuitively reflect the urgency of the semantic conflict.

[0178] In addition, an interactive detailed information viewing portal is displayed in association with the highlighted semantic conflict occurrence area, such as a prompt icon such as an exclamation mark or a lightning symbol. When it is detected that the detailed information viewing portal is triggered, the detailed information of the semantic conflict is displayed. For example, when it is detected that the mouse hovers over the prompt icon for more than a preset time, the detailed information of the semantic conflict is displayed through a floating panel. The detailed information of the semantic conflict includes but is not limited to one or more of the following combinations:

[0179] 1) Semantic conflict types: such as geometric overlap, topological conflict, semantic inconsistency, etc.

[0180] 2) Reasons for semantic conflicts: such as concurrent editing, reference invalidation, constraint violation, etc.

[0181] 3) Potential impacts of semantic conflicts: such as rendering errors, functional failures, data loss, etc.

[0182] In terms of presenting conflict information, in addition to text descriptions, multimedia means such as images and animations can also be used to enhance the intuitiveness and comprehensibility of information. For example, vector graphics can be used to illustrate geometric conflicts, and tree structure diagrams can be used to visualize topological conflicts.

[0183] Alternatively, considering the complexity of rich text format documents, a single semantic conflict prompt may not be able to fully describe the semantic conflict. Therefore, a "conflict panel" can be set in the visualization page to centrally display all semantic conflicts in the current document and support operations such as filtering, sorting, and searching to quickly locate the semantic conflicts of interest. The conflict panel can also serve as a unified interactive entry to guide the editor to check and handle each semantic conflict one by one.

[0184] Through the above display method, complex semantic conflicts can be warned in a timely manner, and the editor can be helped to accurately locate the location of the semantic conflict and the document content involved, provide feasible suggestions and operational guidance for resolving the conflict, and improve the quality of collaborative editing and the quality of the final document.

[0185] Optionally, version management and rollback are performed on rich text documents, allowing you to view historical versions of rich text documents and roll back versions in time when errors occur. The version list of rich text documents can display the editor end, modification time, and summary of added and deleted content for each version.

[0186] Optionally, add a conversation collaboration feature to facilitate discussion and coordination of specific editing tasks among various editing ends through built-in chat, comment, reminder and other functions.

[0187] In some implementations, a general application programming interface (API) is designed to be integrated with an existing rich text document editor.

[0188] The API can include one or more of the following key functional modules:

[0189] 1) Session Management: Responsible for creating, joining, and exiting collaborative editing sessions, controlling the access rights of the editing end, and supporting the synchronous processing of concurrent operations of multiple editing ends.

[0190] 2) Document Synchronization: Responsible for real-time synchronization of changes in rich text format documents between editing terminals, ensuring that all editing terminals see the same document status. Among them, an incremental synchronization strategy is adopted, and only the difference part is transmitted to reduce bandwidth consumption.

[0191] 3) Conflict Resolution: Responsible for detecting and handling semantic conflicts that arise during collaborative editing to ensure the consistency and correctness of the document.

[0192] 4) State Query: Allows the editor to query various status information of rich text format documents, such as the current editing end list, document version number, etc. Supports real-time status update notifications.

[0193] 5) Custom Event: Allows the editor to register custom event listeners with the CRDT system to respond to collaboration events in a timely manner, such as the editor joining / leaving.

[0194] 6) Software Development Kit (SDK) development and documentation: In order to facilitate editor developers to use the above APIs, it is necessary to provide SDKs in different languages, such as JavaScript, Python, Java, etc. Each SDK should contain complete API function definitions, data type specifications, usage examples, etc.

[0195] In addition, a detailed integration document must be written, which includes one or more of the following:

[0196] 1) System Overview: Introduces the semantics of rich text format documents and the basic principles, functional features, and usage scenarios of CRDT.

[0197] 2) Environment configuration: explains how to configure the development environment, including SDK installation, dependency library settings, network port opening, etc.

[0198] 3) API Reference: Detailed description of the syntax, parameters, return values, error codes, etc. of each API function, and provides specific usage examples.

[0199] 4) Best Practices: Introduce best practices in the integration process, such as how to handle network exceptions, how to optimize performance, how to achieve fault tolerance, etc.

[0200] 5) FAQ: List some common problems in the integration process and their corresponding solutions to help developers quickly troubleshoot.

[0201] Integration documentation should be provided in multiple forms, such as online web pages, downloadable PDFs, interactive API testing tools, etc., to meet the usage habits of different developers.

[0202] To further reduce the difficulty of integration, pre-built plug-ins or extensions can be provided for editors of mainstream rich text format documents. These plug-ins / extensions should encapsulate all the implementation details of the above-mentioned collaborative editing methods for rich text format documents, so that editor developers can quickly add collaborative editing functions to the editor by simply installing and configuring the plug-ins without having to deeply understand the internal principles of CRDT. Implementation details:

[0203] Through the above strategy, the collaborative editing method of rich text format documents provided by this application can be efficiently integrated with the existing rich text format document editor, thereby improving collaboration efficiency and user experience.

[0204] The collaborative editing method for a rich text document provided by the present application constructs a semantic tree corresponding to the rich text document by taking each document element of the rich text document as a node, the attributes of the document element as the semantic information of the node, and the spatial structural relationship between each document element as an edge; in response to a node editing operation sent by any editing end, the parameters of the nodes in the semantic tree are updated according to the editing operation; the nodes that do not satisfy the preset constraint rules in the semantic tree after the parameter update are detected to obtain semantic conflict nodes; according to a preset conflict resolution strategy, semantic conflict correction is performed on the semantic conflict nodes to obtain a corrected rich text document, and the corrected rich text document is synchronized to all editing ends, so that the rich text document can be effectively and accurately collaboratively edited, and conflict detection and resolution are performed at the semantic level, reducing the risk of semantic errors and rendering anomalies during the collaborative editing process.

[0205] Figure 6 FIG. 1 is a block diagram of a collaborative editing device for a rich text format document shown in an exemplary embodiment of the present application. Figure 6 As shown, the exemplary collaborative editing device 600 for rich text format documents includes: a semantic tree construction module 610, a parameter updating module 620, a semantic conflict detection module 630 and a conflict correction module 640. Specifically:

[0206] The semantic tree construction module 610 is used to construct a semantic tree corresponding to the rich text document by taking each document element of the rich text document as a node, taking the attribute of the document element as the semantic information of the node, and taking the spatial structural relationship between each document element as an edge;

[0207] A parameter updating module 620, for responding to a node editing operation sent by any editing terminal, and updating parameters of nodes in the semantic tree according to the editing operation;

[0208] The semantic conflict detection module 630 is used to detect nodes that do not satisfy preset constraint rules in the semantic tree after parameter update, and obtain semantic conflict nodes; wherein the constraint rules include at least one of node semantic constraints and inter-node constraints, the node semantic constraints are used to limit the rules that the semantic information of the node needs to satisfy, and the inter-node constraints are used to limit the rules that the spatial structural relationship between nodes needs to satisfy;

[0209] The conflict correction module 640 is used to perform semantic conflict correction on the semantic conflict node according to a preset conflict resolution strategy to obtain a corrected rich text format document, and synchronize the corrected rich text format document to all editing terminals.

[0210] It should be noted that the collaborative editing device for rich text format documents provided in the above embodiment and the collaborative editing method for rich text format documents provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here. In actual applications, the collaborative editing device for rich text format documents provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0211] See also Figure 7 , Figure 7 7 is a schematic diagram of the structure of an embodiment of an electronic device of the present application. The electronic device 700 includes a memory 701 and a processor 702, and the processor 702 is used to execute program instructions stored in the memory 701 to implement the steps in any of the above-mentioned collaborative editing method embodiments of rich text format documents. In a specific implementation scenario, the electronic device 700 may include but is not limited to: a microcomputer, a server, and in addition, the electronic device 700 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.

[0212] Specifically, the processor 702 is used to control itself and the memory 701 to implement the steps in any of the above-mentioned collaborative editing method embodiments of rich text format documents. The processor 702 can also be called a central processing unit (CPU). The processor 702 may be an integrated circuit chip with signal processing capabilities. The processor 702 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 702 can be implemented by an integrated circuit chip.

[0213] See also Figure 8 , Figure 8 The computer-readable storage medium 800 stores program instructions 810 that can be executed by a processor, and the program instructions 810 are used to implement the steps in any of the above-mentioned collaborative editing method embodiments of rich text format documents.

[0214] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0215] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0216] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0217] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.< / use> < / float> < / float> < / string> < / string>

Claims

1. A collaborative editing method for a rich text format document, characterized in that: The method comprises: Taking each document element of a rich text document as a node, taking the attribute of the document element as the semantic information of the node, and taking the spatial structural relationship between each document element as an edge, a semantic tree corresponding to the rich text document is constructed; In response to a node editing operation sent by any editing terminal, updating parameters of nodes in the semantic tree according to the editing operation; Detecting nodes in the semantic tree after parameter update that do not satisfy preset constraint rules, and obtaining semantic conflict nodes; wherein the constraint rules include at least one of node semantic constraints and inter-node constraints, the node semantic constraints are used to limit the rules that the semantic information of the node needs to satisfy, and the inter-node constraints are used to limit the rules that the spatial structural relationship between nodes needs to satisfy; According to a preset conflict resolution strategy, semantic conflict correction is performed on the semantic conflict node to obtain a corrected rich text format document, and the corrected rich text format document is synchronized to all editing terminals.

2. The method according to claim 1, characterized in that The rich text format document further includes layout parameters, and the layout parameters are used to limit the canvas for displaying each document element and the size of each document element relative to the canvas; the method further includes: A set of final consistency registers is constructed based on the layout parameters, each type of layout parameter corresponds to a final consistency register; wherein when multiple modification operations are applied to a parameter of the final consistency register, the last modification operation will overwrite the previous modification operations; receiving a parameter modification instruction for at least one layout parameter sent by any editing terminal, wherein the parameter modification instruction carries a new parameter value; Based on the new parameter value, the final consistency register corresponding to the layout parameter modified by the parameter modification instruction is updated.

3. The method according to claim 2, characterized in that After updating the value of the final consistency register corresponding to the layout parameter modified by the parameter modification instruction based on the new parameter value, the method further includes: Dividing the semantic tree into multiple subtrees to obtain multiple layout units, where different layout units depend on different layout parameters; Detecting the layout units whose dependent layout parameters contain the layout parameters specified to be modified by the parameter modification instruction, and obtaining the affected layout units; Based on the layout parameters after value update, the layout of the affected layout unit is updated.

4. The method according to claim 1, characterized in that The detecting parameter-updated semantic tree contains nodes that do not satisfy the preset constraint rules, and obtains semantic conflict nodes, including: Perform dependency analysis on each node in the semantic tree, and record the dependent nodes corresponding to each node; wherein the probability of a semantic conflict between the node and its corresponding dependent node is greater than a preset threshold; The node after the parameter is updated according to the editing operation is used as the modification node, and the dependent node corresponding to the modification node is used as the conflict detection node; Based on the constraint rules, each of the conflict detection nodes is detected respectively to determine whether there is a semantic conflict.

5. The method according to claim 1, characterized in that The constraint rules correspond to constraint priorities, and different constraint rules correspond to associated storage of conflict correction strategies, and the conflict correction strategies are used for semantic conflict correction; the semantic conflict nodes are corrected according to the preset conflict resolution strategy to obtain a corrected rich text format document, including: Taking the constraint rules that are not satisfied by the semantic conflict node as target constraint rules; Detecting target constraint rules with constraint conflicts among all target constraint rules to obtain conflicting constraint rules; wherein, if there is a conflict when two target constraint rules are semantically corrected according to corresponding conflict correction strategies, it is determined that there is a constraint conflict between the two target constraint rules; The constraint priorities between the conflicting constraint rules are compared, and the conflict correction strategy corresponding to the conflicting constraint rule with the highest constraint priority is selected to perform semantic conflict correction on the semantic conflict node to obtain a corrected rich text format document.

6. The method according to claim 1, characterized in that The constraint rules correspond to constraint priorities, and different constraint rules correspond to associated storage of conflict correction strategies, and the conflict correction strategies are used for semantic conflict correction; the semantic conflict nodes are corrected according to the preset conflict resolution strategy to obtain a corrected rich text format document, including: Taking the constraint rules that are not satisfied by the semantic conflict node as directed graph nodes, and taking the constraint conflict relations between the constraint rules as directed graph edges, to construct a constraint directed graph; wherein the constraint conflict relations are used to indicate whether there is a constraint conflict between the constraint rules; Detecting a loop in the constraint directed graph, and deleting directed graph nodes with the lowest constraint priority on the loop until the loop is eliminated; Based on the conflict correction strategy corresponding to the currently retained constraint rule, semantic conflict correction is performed on the semantic conflict node to obtain a corrected rich text format document.

7. The method according to claim 1, characterized in that The step of performing semantic conflict correction on the semantic conflict node according to a preset conflict resolution strategy to obtain a corrected rich text format document includes: Obtain all conflict correction strategies for the semantic conflict node; In the display interface corresponding to the rich text format document, the document content corresponding to the semantic conflict node is highlighted, and all the conflict correction strategies are displayed in association; In response to any displayed conflict correction strategy being selected, the semantic conflict node is modified according to the selected conflict correction strategy to obtain a modified rich text format document.

8. The method according to claim 1, characterized in that The method further comprises: A semantic identifier is allocated to the general semantic information, the general semantic information and the semantic identifier are associated and stored in a semantic dictionary, and the node references the general semantic information through the semantic identifier.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the processor is configured to execute program instructions stored in the memory to implement the steps in the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program instructions, and the program instructions can be executed by a processor to implement the steps in the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Modeling method, system and device based on dynamic 3D target and storage medium

    CN120491969A

  • Document playing control method and device, electronic equipment and computer storage medium

    CN120492647A

  • Document playback control method and device, electronic device, and computer storage medium

    CN120492647B

  • Method and system for realizing document editing based on rich text

    CN121168418A

  • A method and system for implementing document editing based on rich text

    CN121168418B