A method and system for incremental rendering of document review marks

By constructing a tag index tree independent of the DOM tree and using CSS pseudo-elements, the incremental rendering of document proofreading tags is optimized, the performance problem caused by full recalculation of tag positions is solved, and efficient tag position updates and visual rendering are achieved.

CN123178735APending Publication Date: 2026-11-27山东齐鲁壹点传媒有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611683402.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-29
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, the location information of document review markers is highly coupled with the document content, resulting in high time complexity of recalculating the full location of the markers. Frequent DOM reconstruction operations cause page lag and interaction failure.

Method used

The tag index tree structure is independent of the document object model tree. By constructing the tag index tree, including the root node, segmented index nodes and tag nodes, doubly linked lists and hash indexes are used to optimize tag position updates, and CSS pseudo-elements are combined to achieve incremental rendering of visual tags.

Benefits of technology

It reduces the time complexity of updating the marked position from O(n) to O(k), reduces the frequency of DOM node reconstruction, and improves rendering performance and interactive response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178735A_ABST
    Figure CN123178735A_ABST
Patent Text Reader

Abstract

The application discloses a kind of document review mark incremental rendering method and system.The method constructs mark index tree independent of document object model tree, the mark index tree includes root node, segmented index node and mark node, the root node corresponds entire document and records document total word number;Including segmented index node corresponding to the natural segmentation of document and mark node corresponding to review result item, the mark node under the same segmentation is arranged in ascending order according to starting offset and is linked with each other;Visual mark is generated according to mark index tree;Offset variation Δ is calculated in response to revision operation;According to Δ, the offset of relevant mark node in mark index tree is updated;Visual mark is regenerated to the natural segmentation affected.This application solves the problem of mark position full amount recalculation and rendering performance bottleneck in large-scale review scene by segmented index and differential update.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer front-end technology, specifically to an incremental rendering method and system for document review marking, which can be applied to scenarios requiring large-scale document review, such as online document editing and content review. Background Technology

[0002] In existing technologies, the mainstream implementation of document review tags is as follows: After the backend performs text review on the document, it returns the erroneous text along with its starting and ending offsets within the document; the frontend locates the corresponding text node in the Document Object Model (DOM) tree based on these offsets, and inserts the tag into that text node. The tag (a general inline content element) or <mark>Tags (a type of highlighting element) wrap erroneous text and, in conjunction with Cascading Style Sheets (CSS) styles (such as underlines and background colors), render the visual markup. For interactivity, each tag element is typically bound to a separate click event. Clicking on the tag dynamically creates a pop-up window for the user to confirm or modify the content. Once modified, the entire document content is updated using `innerHTML` (an attribute used to get or set the HTML content inside an element).

[0003] The above solution can maintain normal interactive responsiveness when the number of tags is small. However, when the document size increases to tens of thousands of words and the number of proofreading tags increases to hundreds or even thousands, problems gradually become apparent. The position information of the proofreading tags is only associated with the document content through offsets. Every time a user corrects an error, the offsets of all tags after the corrected position become invalid, and the front end needs to traverse all tags and recalculate their offsets one by one. If a correction causes a change in the character length of the text (for example, changing "all departments" to "all relevant departments", increasing the number of characters from 3 to 5), then the positions of all subsequent tags need to be shifted as a whole. Each correction operation requires O(n) time overhead (n is the total number of tags), and the cumulative computational overhead increases significantly with the number of corrections. At the same time, the front end also needs to re-render the tags after each correction. In the current solution, the position data of the tags is coupled with the DOM structure. During re-rendering, the entire innerHTML segment is usually overwritten, which will cause the original DOM structure, CSS styles, and event bindings to be completely destroyed and rebuilt. Frequent DOM reconstruction operations will trigger repeated browser reflows, resulting in frequent page lag and interactive failures. Summary of the Invention

[0004] To address the dual shortcomings of existing technologies—high time complexity due to full recalculation of marker positions and poor rendering performance due to strong coupling between marker rendering and DOM structure—this invention provides an incremental rendering method and system for document review markers. To achieve the above objective, this invention provides an incremental rendering method for document review markers, comprising the following steps: A tag index tree is constructed, which is stored independently of the document object model tree. It includes a root node, segment index nodes, and tag nodes. The root node corresponds to the entire document and records the total number of words. Each segment index node corresponds to a natural segment of the document and stores the start and end offsets of that segment. Each tag node corresponds to a proofreading result item and stores the tag's start offset, error text, end offset, proofreading type, and correction text. All tag nodes under the same segment index node are arranged in ascending order of their start offsets and are linked together. Based on the tag index tree, generate corresponding visual tags for each tag node in the document object model tree; In response to the correction operation on the marker node, calculate the change in offset Δ of the character length of the text before and after the correction; Update the start and / or end offsets of the relevant tag nodes in the tag index tree according to Δ; Based on the updated tag index tree, visual tags are regenerated for the affected natural segments.

[0005] Preferably, all marker nodes under the same segment index node are linked together to form a doubly linked list through predecessor pointers and successor pointers.

[0006] Preferably, the tag index tree further includes a hash index, with the node identifier of the tag node as the key and the reference of the tag node object as the value.

[0007] Preferably, updating the start offset and / or end offset of the relevant tag node in the tag index tree according to Δ specifically includes: If Δ=0, only the corrected text field and display status of the marked node are updated, without changing the start offset and end offset of each marked node; If Δ≠0, increase the end offset of the marked node by Δ, increase the end offset of the segment index node where the marked node is located by Δ, increase the start and end offsets of all subsequent marked nodes in the same segment index node whose start offset is greater than the start offset of the marked node by Δ, increase the start and end offsets of all segment index nodes after the same segment index node by Δ, increase the start and end offsets of all marked nodes under all segment index nodes after the same segment index node by Δ, and increase the total number of words recorded by the root node by Δ.

[0008] Preferably, the step of regenerating visual markup for the affected natural segments specifically includes: clearing all wrapping elements and data tags in the document object model tree corresponding to the affected natural segments, resetting the wrapping elements and data tags according to the updated offset information, and regenerating visual markup using CSS pseudo-elements.

[0009] Preferably, it also includes marker conflict detection and resolution: when the character ranges of two marker nodes overlap, the rendering range of the visual marker is determined according to the priority of each marker node, wherein the priority is determined according to the review type, severity or preset rules.

[0010] Preferably, it also includes change log recording and undo / redo: recording the change log for each correction operation, and in response to the undo operation, reading the record of the most recent correction operation from the change log and performing a rollback, and regenerating the visual tags based on the rolled-back tag index tree.

[0011] Preferably, the step of generating a corresponding visual tag for each tag node in the Document Object Model (DOM) tree based on the tag index tree specifically includes: determining the corresponding character range in the DOM tree based on the start and end offsets of the tag node; setting a wrapping element around the character range; adding data tags to the wrapping element; and generating a visual tag using CSS pseudo-elements based on the data tags.

[0012] Preferably, the method further includes the persistence and recovery of the tag index tree: serializing and storing the nodes of the tag index tree; and deserializing and reconstructing the tag index tree when the page is loaded.

[0013] The present invention also provides an incremental rendering system for document review marks, comprising: The tag index tree construction module is used to obtain the review result dataset and construct a tag index tree based on the review result dataset. The tag index tree is stored independently of the document object model tree and includes a root node, segment index nodes, and tag nodes. The root node corresponds to the entire document and records the total number of words in the document. The segment index node corresponds to a natural segment of the document and stores the start and end offsets of the segment. The tag node corresponds to a review result item and stores the start offset, error text, end offset, review type, and correction text of the tag. All tag nodes under the same segment index node are arranged in ascending order of start offset and are linked to each other. The rendering module is used to generate corresponding visual tags for each tag node in the document object model tree based on the tag index tree; The incremental update module is used to respond to the correction operation of the marker node, calculate the offset change Δ of the character length of the text before and after the correction, update the start offset and / or end offset of the relevant marker node in the marker index tree according to Δ, and regenerate visual markers for the affected natural segments according to the updated marker index tree.

[0014] Compared with the prior art, the present invention has the following beneficial effects: First, this invention uses a segmented index structure to organize the tags according to natural segments. The correction operation only needs to locally update the offset within the affected segment, reducing the time complexity of tag position update from O(n) (where n is the total number of all proofreading tags in the document (e.g., 500 errors)) to O(k) (where k is the number of tag nodes within the affected segment). When the 500 tags are evenly distributed across 20 segments, a single correction only affects about 25 tag nodes, eliminating the need to traverse all tags.

[0015] Secondly, this invention achieves visual marking by combining data marking with CSS pseudo-elements, without the need to add redundant DOM nodes. The addition or removal of pseudo-elements only triggers browser repaint and not reflow, effectively avoiding repeated calculations of page layout caused by the expansion of the number of DOM nodes.

[0016] Third, the present invention adopts an event delegation mechanism, which binds only one click event listener globally, eliminating the need to bind events separately for each review mark; the interactive interface uses a globally unique instance, and the visibility is controlled by display attributes without involving the creation and destruction of the DOM, thus significantly reducing memory usage and rendering overhead.

[0017] Fourth, this invention stores marker position data through an independent marker index tree, while the DOM tree only retains lightweight data markers. This decoupling ensures that marker position updates and visual rendering do not interfere with each other. When document content is modified, only the text content of text nodes is changed, the DOM structure remains stable, and event bindings and styles are not lost. The change log mechanism and persistent storage further support the undoing and redoing of operations and the restoration of state after page refresh. Attached Figure Description

[0018] Figure 1 A flowchart of an incremental rendering method for document review marks provided in an embodiment of the present invention.

[0019] Figure 2 This is a schematic diagram of the data structure of the tag index tree of the present invention.

[0020] Figure 3 This is a flowchart illustrating the specific process of updating the offset of relevant nodes in the marker index tree based on the offset change Δ in this invention.

[0021] Figure 4 This is a schematic diagram of the module structure of the incremental rendering system for document review and verification marking of this invention. Detailed Implementation

[0022] The technical solutions in the embodiments of the present invention are clearly and completely described in the following description. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0023] Example 1

[0024] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0025] In this invention, natural paragraphs refer to natural paragraphs in a document formed by line breaks, paragraph tags, or paragraph separators.

[0026] like Figure 1 As shown, the incremental rendering method for document review marks provided in this embodiment includes the following steps: Step S1: Construct the tag index tree.

[0027] Suppose the current document reads: "Our topic today is project progress reporting. Please be on time. This meeting will discuss the product release plan. Please prepare your materials in advance." After the backend performs text proofreading on the above documents, the returned proofreading result dataset contains three error items. Each error item includes an error ID, proofreading type, error text, corrected text, start offset, and end offset, as shown in Table 1 below: Table 1:

[0028] like Figure 2 As shown, a tag index tree is constructed based on the proofreading result dataset. The tag index tree is stored independently of the document object model tree and includes a root node, segment index nodes, and tag nodes. The root node corresponds to the entire document, recording the total number of words (48). Each segment index node corresponds to a natural segment of the document, storing the start and end offsets of that segment. In this embodiment, the document contains one natural paragraph, so a segment index node SEG_001 is created with a start offset of 0 and an end offset of 48. Each tag node corresponds to a proofreading result item, storing the start and end offsets, proofreading type, and corrected text of that tag. The three proofreading result items are converted into tag nodes and inserted under the segment index nodes. All tag nodes under the same segment index node are arranged in ascending order of their start offsets and linked together in a doubly linked list using predecessor and successor pointers. MARK_001(start=10, end=12) MARK_002(start=32, end=36) MARK_003(start=38, end=41) The data structure in Figure 2 is as follows: the root node ROOT records the total number of words in the document, 48; SEG_001 is mounted under ROOT; SEG_001 records the starting offset 0, the ending offset 48, the head pointer pointing to MARK_001, and the tail pointer pointing to MARK_003; the doubly linked list under SEG_001 is as follows: the next pointer of MARK_001 points to MARK_002, the prev pointer of MARK_002 points to MARK_001, the next pointer of MARK_002 points to MARK_003, the prev pointer of MARK_003 points to MARK_002, and the next pointer of MARK_003 is null; the hash index is ERR_001, ERR_002, ERR_003. The keys are the object references for MARK_001, MARK_002, and MARK_003, respectively.

[0029] Once the marker nodes are linked by a doubly linked list, starting from any node in the list, the system can traverse forward using the predecessor pointer to find all markers with smaller offsets, and backward using the successor pointer to find all markers with larger offsets. This means that when a user corrects a marker, the system starts from that marker node and traverses backward along the successor pointer, updating the offsets of subsequent marker nodes one by one, without having to traverse the entire marker set.

[0030] In addition, the tag index tree also contains a hash index, with the node identifier (i.e., error ID) of the tag node as the key and the reference to the tag node object as the value, for subsequent fast location.

[0031] Step S2: Generate visual tags based on the tag index tree.

[0032] A proofreading mark rendering view of the document is generated based on the mark index tree. For each mark node, the corresponding target text node and character range are determined in the Document Object Model (DOM) tree. Taking MARK_001 as an example: the corresponding text node in the DOM tree is located based on the starting offset 0 and ending offset 48 of the segment index node SEG_001; the character range, namely the two characters "progress", is determined based on the starting offset 10 and ending offset 12 of MARK_001. A span element is created, and "progress" is wrapped within the span using the `surroundContents` method of the Range object (an API object used to represent a continuous range in a document fragment). Custom data attributes `data-mark-id="MARK_001"` and `data-review="error"` are added to the span. CSS generates a red underline visual mark using the `[data-review="error"]::after` pseudo-element (a virtual element generated by CSS styles to add decorative effects after element content). Pseudo-elements are not real DOM nodes, do not occupy DOM tree memory, and do not affect the DOM structure. Adding a large number of tags will not cause the number of DOM nodes to swell—the only actual increase in the page is the span element wrapping the erroneous text, while visual effects such as underlines and speech bubbles are all generated by the browser rendering engine during the rendering phase and do not enter the DOM tree. This means that even if there are hundreds of proofreading tags at the same time, the growth of the DOM tree is extremely limited, and the browser's reflow calculation scope is kept to a minimum.

[0033] When the target character range spans multiple text nodes, the following methods are used to generate wrapping elements: Select the target character range using a Range object; if the `surroundContents` method throws an exception due to the range spanning multiple nodes, use `Range.extractContents()` to extract the range content into a `DocumentFragment`, split the text nodes at the start and end positions of the range, insert a wrapping element between the split start and end positions, and place the content of the `DocumentFragment` inside the wrapping element; alternatively, create wrapping elements for each text node within the range and add the same data marker to each wrapping element, so that multiple wrapping elements correspond to the same marker node. Using these methods, even if the proofreading markup spans multiple text nodes, visual markup can be correctly generated without disrupting the document object model tree structure.

[0034] Similarly, MARK_002 generates an orange underline, and MARK_003 generates a yellow dashed line. At this point, all three error texts are presented in the document using visual markers.

[0035] During page initialization, a click event listener is bound to the document container. This listener uses event bubbling to capture clicks on all markers. Only this one listener needs to be registered throughout the entire page lifecycle—whether there are 3 or 300 markers in the document, only one listener function is always in memory. The pop-up element is also pre-created with `display:none` set and is not destroyed during the page lifecycle. Each time the user clicks a marker, the pop-up's `display` property is simply switched from `none` to `block`. Content updates only modify the text of existing DOM elements; no DOM node creation or destruction is involved. When the user clicks the red underline below "Progress," the event bubbles up to the document container. The clicked span element is retrieved using `event.target.closest('[data-mark-id]')`, and `data-mark-id="MARK_001"` is read. The hash index is used to directly locate the `MARK_001` node in the marker index tree, obtaining its complete information (error text, correction text, verification type). The pop-up is then switched to the display state and this information is shown.

[0036] Step S3: In response to the correction operation, calculate the offset change Δ.

[0037] When the user clicks the "Accept" button in the pop-up window, in response to the correction operation, the marker node MARK_001 and the correction text "Progress" are retrieved. The character length L_old=2 of the erroneous text "Progress" before correction and the character length L_new=2 of the corrected text "Progress" after correction are calculated, and the offset change Δ=L_new-L_old=0 is calculated.

[0038] Step S4: Update the offset of the relevant tag node in the tag index tree according to Δ.

[0039] like Figure 3 As shown, since Δ=0, only the display content of the MARK_001 node is updated to the corrected text "Progress," without changing the start and end offsets of each node. Since the offsets of no marked nodes have changed, there is no need to move the positions of any marked nodes.

[0040] If Δ ≠ 0 (for example, if the user changes "all departments" to "all relevant departments", L_old=3, L_new=5, Δ=+2), then perform the following update: First, update the end offset of MARK_003 from 41 to 43 (original end offset + Δ).

[0041] Secondly, update the end offset of the segment index node SEG_001 where MARK_003 is located from 48 to 50 (original end offset + Δ).

[0042] Then, for all subsequent marker nodes in the same segment index node SEG_001 whose starting offset is greater than the starting offset of MARK_003 (38), the starting and ending offsets are increased by Δ. Since MARK_003 is already at the end of this segment in the doubly linked list (its successor pointer is null), there are no subsequent marker nodes that need to be updated in this step. If a subsequent marker node exists (e.g., MARK_004 with a starting offset of 45), its starting and ending offsets will be updated to 47 and the corresponding new ending value, respectively.

[0043] Then, the start and end offsets of the subsequent segment index nodes are increased by Δ. In this embodiment, there is only one natural segment, so no subsequent segment index nodes need to be updated. If there are subsequent segments, their start and end offsets are increased by Δ as a whole. At the same time, the start and end offsets of all marker nodes under the subsequent segment index nodes are increased by Δ.

[0044] Finally, update the total number of words in the document recorded in the root node from 48 to 50.

[0045] Unlike existing schemes that require traversing all marked nodes for each correction, this approach only affects marked nodes within the same segment that are after the correction position, regardless of whether the total number of marked nodes is 3 or 300. Marked nodes before the correction position and those in previous segments remain unaffected. This is because marked nodes within the same segment are linked sequentially by offsets using a doubly linked list. Once the entry point of the correction position in the linked list is determined, it is only necessary to traverse forward along the successor pointer and accumulate Δ. As the number of natural segments in a document increases, the average marked density within each segment decreases, making the advantages of this segmented indexing structure increasingly significant—the actual number of marked nodes k that need to be updated is usually much smaller than the total number of marked nodes n.

[0046] Step S5: Incremental rendering.

[0047] When Δ=0, the affected segment set is empty, and no wrapping elements need to be rebuilt. Only the text content within the span element corresponding to MARK_001 needs to be updated, while the visual marker color and position remain unchanged. This operation only involves modifying the content of the text node; the hierarchical structure of the DOM tree remains unchanged, and the browser's reflow scope is limited to the containing block where the text node is located.

[0048] When Δ≠0, the affected segment set includes SEG_001. All wrapping elements (three spans) in the DOM region corresponding to SEG_001 are cleared, and the corresponding CSS pseudo-elements are automatically removed from the render tree. The three marker nodes under SEG_001 are retraced, and the character range is redefined based on the updated offsets, generating wrapping elements and visual markers. The visual markers of unaffected natural segments remain unchanged. The scope of re-rendering is strictly limited to the affected natural segment SEG_001—natural segments containing marker nodes before the position correction require no DOM operations. Although the offset values ​​of marker nodes in subsequent natural segments change, their corresponding DOM regions remain unchanged because these segments have not yet been marked as "affected." Only when the user continues to correct the markers in these segments will the corresponding segments be incrementally updated at that moment. This "on-demand update" mechanism ensures that the scale of each DOM operation is only related to the marker density within a single natural segment, and is independent of the total number of markers in the document.

[0049] After the correction is completed, if there are still uncorrected markup nodes in the same document, their visual markup will continue to be displayed; if all markup nodes have been corrected, all data markup will be cleared and all CSS pseudo-element visual markup will disappear automatically.

[0050] In addition, the following extended features are also supported: Conflict detection and resolution: When the character ranges of two marker nodes A and B within the same segment overlap (e.g., A's starting offset < B's starting offset < A's ending offset), the rendering range of the visual marker is determined based on the priority of each marker node. The priority is determined according to the review type, severity, or preset rules. For containment relationships (i.e., the character range of one marker completely contains the character range of another marker), the outer marker's complete containment is preserved, and the inner marker does not generate a visual marker in the overlapping area; for intersection relationships (i.e., the character ranges of two markers partially overlap), the overlapping portion is assigned to the marker with the higher priority. Specifically, conflict detection and resolution include: calculating the effective rendering range for each marker node; sorting marker nodes within the same segment according to priority from high to low; allocating character ranges not occupied by higher priority markers to each marker node in turn; if the current marker has an inclusion relationship with an occupied range, the outer marker's complete wrapping is preserved, and the inner marker does not generate visual markers in the overlapping area; if there is an intersection relationship, the overlapping part is assigned to the higher priority marker, and the lower priority marker does not generate visual markers in the overlapping area. The lower priority marker can be split into multiple non-overlapping rendering fragments, and each rendering fragment generates a wrapping element and data markers respectively. The CSS pseudo-elements are rendered independently according to the data markers of each rendering fragment.

[0051] Undo / Redo: Each correction operation is logged in a change log (including node identifier, offsets before and after correction, and timestamps). When a user triggers an undo, the most recent record is read from the change log and a rollback is performed. The offsets and field values ​​of each node in the tag index tree are restored, and incremental rendering is re-executed based on the rolled-back tag index tree.

[0052] Persistence and Recovery: Periodically, all nodes of the tag index tree are serialized into structured data and stored in the browser's local storage. When the page loads, the tag index tree is loaded from local storage and deserialized to reconstruct the tag index tree. Based on the reconstructed tag index tree, a proofreading tag rendering view is generated, allowing the user to restore the previous proofreading state without having to re-trigger the proofreading request.

[0053] Example 2

[0054] This embodiment provides an incremental rendering system for document review markers, used to execute the above method. For example... Figure 4 As shown, the system includes: The tag index tree construction module is used to obtain the review result dataset and construct a tag index tree based on it. The tag index tree is stored independently of the document object model tree and includes a root node, segment index nodes, and tag nodes. The root node corresponds to the entire document and records the total number of words. Each segment index node corresponds to a natural segment of the document and stores the start and end offsets of that segment. Each tag node corresponds to a review result item and stores the start and end offsets, review type, and corrected text of that tag. All tag nodes under the same segment index node are arranged in ascending order of their start offsets and linked together in a doubly linked list using predecessor and successor pointers. The tag index tree also includes a hash index, with the node identifier of the tag node as the key and the reference to the tag node object as the value.

[0055] The rendering module generates corresponding visual tags for each tag node in the Document Object Model (DOM) tree based on the tag index tree. Specifically, the rendering module determines the corresponding character range in the DOM tree based on the start and end offsets of the tag node, sets a wrapping element around this character range, adds data tags containing node identifiers and proofreading types to the wrapping element, and generates visual tags using CSS pseudo-elements based on these data tags. The rendering module also pre-creates interactive UI elements that are not destroyed during the page's lifecycle and are controlled to be shown or hidden via display properties. The rendering module binds an event listener to the page container element, detects triggering operations on the visual tags through an event delegation mechanism, and retrieves the corresponding tag node information based on the triggering operation, displaying it in the interactive UI element.

[0056] The incremental update module responds to correction operations on marker nodes by calculating the change in character length offset Δ before and after the correction. If Δ = 0, the incremental update module only updates the corrected text field and display status of the marker node, without changing the start and end offsets of each marker node. If Δ ≠ 0, the incremental update module increases the end offset of the marker node by Δ, increases the end offset of the segment index node containing the marker node by Δ, increases the start and end offsets of all subsequent marker nodes in the same segment index node whose start offset is greater than the start offset of the marker node by Δ, increases the start and end offsets of subsequent segment index nodes by Δ, increases the start and end offsets of all marker nodes under the subsequent segment index nodes by Δ, and increases the total number of characters recorded in the root node by Δ. The incremental update module is also used to regenerate visual tags for affected natural segments based on the updated tag index tree: clear all wrapping elements and data tags in the document object model tree corresponding to the affected natural segments, reset the wrapping elements and data tags according to the updated offset information, and regenerate visual tags through CSS pseudo-elements; unaffected natural segments retain their visual tags unchanged.

[0057] The collaboration among the modules is as follows: The marker index tree construction module receives the proofreading result dataset returned by the backend, constructs the marker index tree, and then passes it to the rendering module; the rendering module generates visual markers in the document based on the marker index tree and renders the interactive interface; when the user triggers a correction operation through the interactive interface, the incremental update module receives the correction instruction, updates the offset of each node in the marker index tree, and passes the updated marker index tree to the rendering module; the rendering module regenerates visual markers for the affected natural segments based on the updated marker index tree. Through this collaboration, the system achieves efficient updating of marker positions and incremental rendering of visual markers in large-scale proofreading scenarios.

[0058] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.< / mark>

Claims

1. An incremental rendering method for document review marks, characterized in that, include: Construct a tag index tree, which is stored independently of the document object model tree, including a root node, segment index nodes, and tag nodes; the root node corresponds to the entire document and records the total number of words in the document; the segment index node corresponds to a natural segment of the document and stores the start offset and end offset of the segment. Each marker node corresponds to a review result item, storing the marker's starting offset, error text, ending offset, review type, and correction text; all marker nodes under the same segment index node are arranged in ascending order of starting offset and linked to each other; Based on the tag index tree, generate corresponding visual tags for each tag node in the document object model tree; In response to the correction operation on the marker node, calculate the change in offset Δ of the character length of the text before and after the correction; Update the start and / or end offsets of the relevant tag nodes in the tag index tree according to Δ; Based on the updated tag index tree, visual tags are regenerated for the affected natural segments.

2. The method according to claim 1, characterized in that, All marked nodes under the same segment index node are linked together to form a doubly linked list through the predecessor pointer and the successor pointer.

3. The method according to claim 1, characterized in that, The tag index tree also includes a hash index, with the node identifier of the tag node as the key and the reference of the tag node object as the value.

4. The method according to claim 1, characterized in that, The step of updating the start offset and / or end offset of the relevant tag node in the tag index tree according to Δ specifically includes: If Δ=0, only the correction text field and display status of the marked node are updated, without changing the start offset and end offset of each marked node; If Δ≠0, increase the end offset of the marked node by Δ, increase the end offset of the segment index node where the marked node is located by Δ, increase the start and end offsets of all subsequent marked nodes in the same segment index node whose start offset is greater than the start offset of the marked node by Δ, increase the start and end offsets of all segment index nodes after the same segment index node by Δ, increase the start and end offsets of all marked nodes under all segment index nodes after the same segment index node by Δ, and increase the total number of words recorded by the root node by Δ.

5. The method according to claim 1, characterized in that, The process of regenerating visual markup for the affected natural segments specifically includes: clearing all wrapping elements and data tags in the document object model tree corresponding to the affected natural segments, resetting the wrapping elements and data tags according to the updated offset information, and regenerating visual markup using CSS pseudo-elements.

6. The method according to claim 1, characterized in that, It also includes tag conflict detection and resolution: when the character ranges of two tag nodes overlap, the rendering range of the visual tag is determined according to the priority of each tag node, and the priority is determined according to the review type, severity or preset rules.

7. The method according to claim 1, characterized in that, It also includes change log recording and undo / redo: recording the change log for each correction operation, and in response to an undo operation, reading the record of the most recent correction operation from the change log and performing a rollback, and regenerating visual tags based on the rolled-back tag index tree.

8. The method according to claim 1, characterized in that, The step of generating a corresponding visual tag for each tag node in the Document Object Model (DOM) tree based on the tag index tree specifically includes: determining the corresponding character range in the DOM tree based on the start and end offsets of the tag node; setting a wrapping element around the character range; adding data tags to the wrapping element; and generating a visual tag using CSS pseudo-elements based on the data tags.

9. The method according to claim 1, characterized in that, It also includes the persistence and recovery of the tag index tree: serializing and storing the nodes of the tag index tree; and deserializing and reconstructing the tag index tree when the page is loaded.

10. An incremental rendering system for document review and approval marking, characterized in that, include: The tag index tree construction module is used to obtain the review result dataset and construct a tag index tree based on the review result dataset. The tag index tree is stored independently of the document object model tree and includes a root node, segment index nodes, and tag nodes. The root node corresponds to the entire document and records the total number of words in the document. The segment index node corresponds to a natural segment of the document and stores the start offset and end offset of the segment. Each marker node corresponds to a review result item, storing the marker's starting offset, error text, ending offset, review type, and correction text; all marker nodes under the same segment index node are arranged in ascending order of starting offset and linked to each other; The rendering module is used to generate corresponding visual tags for each tag node in the document object model tree based on the tag index tree; The incremental update module is used to respond to the correction operation of the marker node, calculate the offset change Δ of the character length of the text before and after the correction, update the start offset and / or end offset of the relevant marker node in the marker index tree according to Δ, and regenerate visual markers for the affected natural segments according to the updated marker index tree.