A presentation editing method and system based on an XML semantic document model

CN123031669APending Publication Date: 2026-11-03BEIJING ZERO ONE EVERYTHING INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611097460.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-23
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Existing presentation editing technologies suffer from structural loss or pasting failures when copying content across different levels. They lack a unified clipboard protocol and context-aware insertion strategy, making it difficult to achieve incremental saving by page and version difference comparison. In AI streaming generation scenarios, document structure and resource loading are out of sync.

Method used

Construct an XML semantic document model with card sequences as the root node. By determining the clipboard content type, recursively generate new IDs and determine the insertion position, or perform normalization and multi-level transformation on the open structure, to ensure the reliability and integrity of the paste operation.

Benefits of technology

It achieves reliable paste repair without violating document model schema constraints, solves the problems of silent paste failure and structure stripping, supports isomorphic conversion between edit and stored states, and provides a unified data foundation and visible feedback.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123031669A_ABST
    Figure CN123031669A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of presentation editing, in particular to a presentation editing method and system based on an XML semantic document model, which comprises the following steps: constructing a document model of a presentation; reading the clipboard content in response to a user's paste operation; judging whether the clipboard content is structured data containing a card node identifier; if yes, determining an insertion position according to a current selected area position, generating a new unique identifier for a node in the clipboard content, and inserting the clipboard content at the insertion position; if not, performing structural standardization processing on a paste slice obtained by parsing the clipboard content, converting the paste slice from an open structure into a closed structure, executing at least one of a plurality of transformation operations on the paste slice after the structural standardization processing according to a preset order, and ending after any transformation operation is hit; updating the document model and rendering and displaying. The application solves the problems of paste silence failure, structure stripping and missing of slide-level operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of presentation editing technology, and in particular to a presentation editing method and system based on the XML semantic document model. Background Technology

[0002] Existing presentation editing solutions mainly include the following categories: First, there are traditional desktop presentation software (such as Microsoft PowerPoint), which uses proprietary formats such as binary or OOXML and a data model of "slide page + absolute coordinate object". While it has strong layout capabilities, it is costly to couple with scenarios such as web-based AI generation and streaming output, making it difficult to perform fine-grained collaborative editing within a browser using a unified document tree.

[0003] Secondly, online presentation tools based on Canvas or absolute positioning, while friendly to free layout, require additional maintenance of a data layer separate from the visual layer for operations such as text flow editing, cross-block copy and paste, and semantic-level undo / redo, resulting in high development and consistency maintenance costs.

[0004] Third, document products based on block editors (such as Notion) often handle pasting for flat or shallow block structures. When the block hierarchy is deep and the schema (data model) has strict restrictions on node types and nesting relationships, the default pasting behavior of the editing kernel often results in silent rejection, structure stripping, and loss of layout units after cross-container copying.

[0005] The shortcomings of the aforementioned existing technologies lie in the lack of systematic support for presentation-specific rules such as "slide cards are only allowed to appear at the top level of the document" and "cell types under smart layouts must be synchronized with the parent layout," leading to structural loss or pasting failures when copying content across levels. Furthermore, the lack of a homogeneous dual-track conversion mechanism between the edit-state document tree and server-side HTML fragments makes it difficult to achieve incremental saving by page and version difference comparison. In AI streaming generation scenarios, the document structure and image resources arrive at different times, making progressive loading and display impossible. In addition, copying and pasting entire slides lacks a unified clipboard protocol and context-aware insertion strategy, frequently resulting in ID conflicts and unreasonable placement. Summary of the Invention

[0006] To address the aforementioned technical issues, this application provides a presentation editing method and system based on the XML semantic document model. This method enables reliable pasting and repair of complex hierarchical presentation content without violating document model schema constraints, thus resolving the problems of silent pasting failure, structure stripping, and missing slide-level operations in existing technologies.

[0007] Firstly, this application provides a presentation editing method for an XML semantic document model, including: A document model for the presentation is constructed, wherein the root node of the document model contains a sequence of one or more card nodes; in response to the user's paste operation, the clipboard content is read; it is determined whether the clipboard content is structured data containing card node identifiers; if so, the insertion position is determined according to the current selection position, a new unique identifier is generated for the nodes in the clipboard content, and the clipboard content is inserted at the insertion position; if not, the pasted slice obtained from the clipboard content is subjected to structural normalization processing, converting the pasted slice from an open structure to a closed structure, and at least one of multiple transformation operations is performed on the structurally normalized pasted slice in a preset order, ending after any transformation operation is hit; the document model is updated and rendered for display.

[0008] Optionally, in some embodiments, the multiple transformation operations include: a first transformation, when the paste target is the top level of the document and the paste slice does not contain closed card nodes, grouping and packaging the non-card node content in the paste slice into card nodes; a second transformation, when all the top-level child nodes of the paste slice are cell-type nodes, cutting the current cell at the target layout node and inserting multiple cells in the paste slice into the cut; a third transformation, when the top-level child nodes of the paste slice are content-carrying layer nodes, merging the content of the paste slice into the target content-carrying layer; and a fourth transformation, stripping the structural shell of the paste slice and processing it by the editor kernel.

[0009] Optionally, in some embodiments, the step of grouping and packaging the non-card node content in the pasted slice into card nodes includes: merging consecutive non-card nodes into new card nodes, using existing card nodes in the pasted slice as boundaries; if the top-level node itself is a card node, it is retained as is.

[0010] Optionally, in some embodiments, the step of cutting the current cell at the target layout node and inserting multiple cells from the pasted slice into the cut includes: searching along the ancestor chain of the pasted point to find a target layout node that can receive a cell type node; and selecting a preset method to insert the multiple cells according to the positional relationship between the pasted point and the cell to be cut, wherein the preset method includes: directly inserting when the pasted point is already located at the child boundary of the target layout node; inserting adjacently before or after the cell when the cursor is located at the end of the cell to be cut; and cutting the current cell at the cursor position and inserting at the cut when the cursor is located in the middle of the cell to be cut.

[0011] Optionally, in some embodiments, determining the insertion position based on the current selection position includes: if the cursor is located inside a card node, determining whether to insert before or after the card node based on the relative position of the cursor in the card node; if the selection area is the gap between the top-level card nodes of the document, using the gap as the insertion position; if none of the above conditions are met, using the current slide position as the insertion position.

[0012] Optionally, in some embodiments, converting the adhesive slice from an open structure to a closed structure includes: obtaining the open depth information of the structural shell of the adhesive slice; peeling off the structural shell layer by layer and updating the open depth information accordingly until a stopping condition is met; If the pasted slice still contains structural nodes after stopping, the open depth information is set to zero, and a closed slice is constructed.

[0013] Optionally, in some embodiments, the method further includes: receiving a structured message stream pushed by a server; when a card skeleton message is received, writing the card skeleton into a buffer; when a multimedia binding message is received, writing a multimedia address into the corresponding node in the buffer according to the node identifier in the multimedia binding message; and when a stream end flag is received, writing the card content in the buffer into the document model all at once.

[0014] Optionally, in some embodiments, the method further includes: in response to a content change in the document model, scanning layout nodes in the document model; for each child node of the layout node, calculating derived attributes of the child node based on the attributes of the parent layout node; and sending the derived attributes to a rendering component to cause the rendering component to update the rendering.

[0015] Optionally, in some embodiments, the method further includes: generating a gap cursor in the gaps between card nodes and between cells within the layout; selecting an adjacent node when a delete operation is received at the gap cursor position; deleting the adjacent node when a delete operation is received again after the adjacent node has been selected; and determining the cursor landing point based on the neighbor node type after deletion.

[0016] Secondly, this application also provides a presentation editing system based on the XML semantic document model, applicable to the methods described in any of the above-mentioned methods, the system comprising: The document model building module is used to build a document model for a presentation, wherein the root node of the document model is a sequence containing only one or more card nodes; The clipboard reading module is used to read the clipboard content in response to the user's paste operation; The data judgment module is used to determine whether the clipboard content is structured data containing card node identifiers; The paste processing module is used to determine the insertion position based on the current selection area position when the clipboard content is structured data containing card node identifiers, generate a new unique identifier for the nodes in the clipboard content, and insert the clipboard content at the insertion position; when the clipboard content is not structured data containing card node identifiers, it performs structural normalization processing on the paste slice obtained from the parsed clipboard content, converts the paste slice from an open structure to a closed structure, performs at least one of multiple transformation operations on the structure-normalized paste slice in a preset order, and terminates after any transformation operation is hit; The rendering update module is used to update the document model and render it for display.

[0017] The technical solution provided in this application has the following advantages compared with the prior art: The presentation editing method based on the XML semantic document model provided in this application constructs a structured document model with card sequences as the root node, enabling presentations to exist as a unified document tree. This provides a consistent data foundation for streaming editing and AI incremental output, and supports isomorphism between the editing and storage states based on the same XML semantic model, enabling incremental saving by page and version comparison. In the paste processing, it first determines whether the clipboard content is JSON data of the entire card. If so, a new ID is recursively generated and the insertion position is determined according to the cursor position, achieving reliable slide-level copying without ID conflicts. If not, the paste slice is normalized to an open structure, closing the open structural shell when copying across cell selections, so that multiple cells are retained as complete nodes. Then, multi-level transformations are used to ensure that at least one insertion path is hit, so that text selection copying across smart layouts and smart cells can retain complete layout units. Any paste operation has visible feedback or reasonable degradation, solving the problems of silent paste failure and structure stripping in the prior art. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without any creative effort.

[0020] Figure 1A flowchart illustrating the presentation editing method for the XML semantic document model provided in this application embodiment; Figure 2 A general architecture diagram of the presentation editing method for the XML semantic document model provided in the embodiments of this application; Figure 3 This is a schematic diagram of the structure of the XML semantic document tree provided in the embodiments of this application; Figure 4 This is a schematic diagram of the dual-track persistence process provided in the embodiments of this application; Figure 5 This is a schematic diagram illustrating the decision-making process for inserting a JSON clipboard into a slideshow, as provided in an embodiment of this application. Figure 6 The streaming AI staged assembly timing diagram provided in the embodiments of this application; Figure 7 This is a flowchart illustrating the Smart Layout attribute normalization process provided in an embodiment of this application. Figure 8 This is a schematic diagram illustrating the three-level decision-making process for the Gap cursor deletion landing point, provided in an embodiment of this application. Figure 9 This is a schematic diagram of the structure of the presentation editing system based on the XML semantic document model provided in this application embodiment. Detailed Implementation

[0021] To better understand the above-mentioned objectives, features, and advantages of this application, the solution of this application will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0022] Many specific details are set forth in the following description in order to provide a full understanding of this application, but this application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some embodiments of this application, and not all embodiments.

[0023] The following description, in conjunction with the accompanying drawings, provides an exemplary description of the presentation editing method and system for the XML semantic document model provided in this application.

[0024] Figure 1 A flowchart illustrating the presentation editing method for the XML semantic document model provided in this application embodiment; Figure 2 A general architecture diagram of the presentation editing method for the XML semantic document model provided in the embodiments of this application; Figure 3 This is a schematic diagram of the structure of the XML semantic document tree provided in the embodiments of this application; Figure 4 This is a schematic diagram of the dual-track persistence process provided in the embodiments of this application; Figure 5 This is a schematic diagram illustrating the decision-making process for inserting a JSON clipboard into a slideshow, as provided in an embodiment of this application. Figure 6 The streaming AI staged assembly timing diagram provided in the embodiments of this application; Figure 7 This is a flowchart illustrating the SmartLayout attribute normalization process provided in an embodiment of this application. Figure 8 This is a schematic diagram illustrating the three-level decision-making process for the Gap cursor deletion landing point, provided in an embodiment of this application.

[0025] Reference Figure 2 The overall system architecture of this application embodiment includes a server, an editing kernel, and a browser frontend. The editing kernel comprises a document model module (card / smartLayout / smartCell), a paste processing module (PptCardClipboard + PptPasteSink), a serialization module (JSON, HTML, fragmentation), and a cursor control module (Gap Cursor + edge click). The browser frontend renders the document model as a user interface using ReactNodeView. The server interacts with the editing kernel via the SSE streaming AI interface and REST API (save Presentation / load). The paste processing module employs a layered paste repair pipeline; the specific processing flow will be described in detail in steps S103-S105 below.

[0026] The following is combined Figure 2 ,right Figure 1 Each step is described in detail. The presentation editing method 100 based on the XML semantic document model includes the following steps: S101. Construct a document model for the presentation, wherein the root node of the document model contains a sequence of one or more card nodes.

[0027] Specifically, Figure 3 A schematic diagram of the structure of the XML semantic document tree is shown below. Figure 3 The root node of the document model is doc, and its content attribute is defined as card. This indicates that the document contains only a sequence of one or more card nodes, each corresponding to a slide page in the presentation.

[0028] Each card node can include attributes: unique identifier id (used to uniquely identify the card in the document tree), index (indicating the card's sequential position in the document), layout (such as "title-only", "title-content", etc.), and card type (such as "normal", "accent", etc.).

[0029] The card node can nest the following child nodes: layout item nodes (cardLayoutItem, cardAccentLayoutItem), used to carry the main layout and emphasis layout of the card; smart layout nodes (smartLayout), which carry attributes such as type (e.g., "pyramid", "timeline", "grid") and direction; smart cell nodes (smartCell), which are the only legal direct child nodes of smartLayout, do not declare a general block group through schema, and prohibit nesting of the same type; content block nodes: paragraph, heading, image, chart, table, etc.

[0030] The nodes mentioned above can be extended using TipTap (a rich text editing framework based on Prose Mirror) / ProseMirror (an extensible rich text editing framework): parseHTML is used to parse custom XML / HTML tags into document tree nodes; renderHTML is used to render document tree nodes into custom tag strings.

[0031] Furthermore, this application embodiment also provides a dual-track persistence mechanism to achieve isomorphic conversion between the edit-state document model and the server-side storage.

[0032] like Figure 4 As shown, the persistence process can include two directions: forward transformation and reverse loading. During forward transformation, the editable document model is first serialized into a JSON data structure. Then, the JSON data structure is traversed, and the predefined renderHTML rules in each node extension are called to recursively render the entire document into a complete HTML string. Next, the complete tags of each card node are matched using regular expressions or DOM parsing, and the document is divided into a segmented array according to the card node. Finally, the segmented array is submitted to the server for incremental storage by page and version difference comparison.

[0033] During reverse loading, the server returns an array of fragments, and the client concatenates the fragments in order into a complete HTML string. If the editor instance already exists, setContent is called directly to inject the editor, which is then parsed into a document tree and rendered by the parseHTML rules. If the editor instance has not yet been created, it is temporarily stored in the pendingContent queue and consumed after the editor's onCreate event is triggered.

[0034] During the transition from edit mode to storage mode, the document model is serialized into a JSON data structure. The JSON data structure is then traversed, and the `renderHTML` rules for each node are called to generate a complete HTML string. Finally, the complete tags of each card node are matched using regular expressions or DOM parsing to segment the string into a fragmented array, which is then stored page by page on the server. During reverse loading, the fragmented arrays are concatenated into a complete HTML string and injected into the editor kernel to be parsed into the document model.

[0035] S102. In response to the user's paste operation, read the clipboard content.

[0036] Specifically, when a user performs a paste operation in the browser (such as Ctrl+V or right-click to paste), the editor kernel's handlePaste processing chain is triggered, reading the text / plain text content from the system clipboard.

[0037] S103. Determine whether the clipboard content is structured data containing card node identifiers. If yes, proceed to step S104; otherwise, proceed to step S105.

[0038] Specifically, the read clipboard text is attempted to be parsed as JSON. If the parsing is successful and the parsing result object contains a nodeType field with the value "card", then the clipboard content is determined to be structured data containing card node identifiers (i.e., the JSON clipboard data of the entire card), and the process proceeds to step S104; otherwise, it is determined to be ordinary pasted content, and the process proceeds to step S105. In this embodiment, a layered paste repair pipeline can be adopted. The first processing is high-priority slide JSON clipboard processing, and the second processing is a general paste fallback extension. Together, they constitute a complete paste repair.

[0039] S104. Determine the insertion position based on the current selected area position, generate a new unique identifier for the nodes in the clipboard content, and insert the clipboard content at the insertion position.

[0040] Specifically, when the clipboard content is determined to be card JSON data, slideshow-level paste processing is performed. Figure 5 This illustrates the insertion point decision process for the JSON clipboard in the slideshow. First, refer to... Figure 5 The insertion position (insertPos) is determined based on the current selected area.

[0041] After determining the insertion position, insert the updated clipboard content at that position. Recursively perform the `generateNewIds` operation on the card's JSON data to generate new unique identifiers, such as `nanoid()`, for all nodes containing `attrs.id`, to avoid conflicts with the identifiers of existing nodes in the document model.

[0042] Then, the editor's insertContentAt(insertPos, newCardData) method is called to insert the processed card JSON data into the document and update the slide index status synchronously.

[0043] In step S104, determining the insertion position based on the current selection position may include: if the cursor is inside a card node, determining whether to insert before or after the card node based on the relative position of the cursor in the card node; if the selection area is the gap between the top-level card nodes of the document, using the gap as the insertion position; if none of the above conditions are met, using the current slide position as the insertion position.

[0044] Specifically, if the cursor is in the first half of the card node, it will be inserted before the card node; if the cursor is in the second half of the card node, it will be inserted after the card node; if the selection area is the gap between the top-level card nodes of the document (such as the gap between cards), the gap will be used as the insertion position; if none of the above conditions are met, the current slide position will be used as the insertion position.

[0045] S105. Perform structural normalization processing on the pasted slice obtained from the clipboard content, convert the pasted slice from an open structure to a closed structure, and perform at least one of multiple transformation operations on the pasted slice after structural normalization processing in a preset order, and end after any transformation operation is hit.

[0046] When the clipboard content is determined not to be card JSON data, general paste processing is performed. In the ProseMirror editing kernel, when a user copies text selections across smart cells or smart layouts, the resulting paste slices typically have large openStart / openEnd values. In this case, the structural shell in the paste slice exists as a single-sided opening. When pasting, the editing kernel attempts to merge with the ancestor node corresponding to the target position, resulting in the structural content being stripped away, leaving only inline text.

[0047] To address the aforementioned issues, this application first performs structural normalization on the pasted slices, i.e., preprocessing. The pasted slices are converted from open structures to closed structures. After structural normalization, at least one of multiple transformation operations is executed in a preset order. The entire transformation process ends once any transformation is successfully executed.

[0048] In step S105, the multiple transformation operations may include: a first transformation, where, when the paste target is the top layer of the document and the paste slice does not contain closed card nodes, the non-card node content in the paste slice is grouped and packaged into card nodes; a second transformation, where, when all the top-level child nodes of the paste slice are cell-type nodes, the current cell is cut at the target layout node, and multiple cells in the paste slice are inserted into the cut; a third transformation, where, when the top-level child nodes of the paste slice are content-carrying layer nodes, the content of the paste slice is merged into the target content-carrying layer; and a fourth transformation, where the structural shell of the paste slice is removed and processed by the editor kernel.

[0049] First transformation: When the paste target is the top level of the document (AllSelection or doc-levelGapCursor) and the paste slice does not contain closed card nodes, the non-card node content in the paste slice is grouped and packaged into card nodes. If the top-level node itself is a card node, it is preserved as is; if the top-level node is a non-card node, it is accumulated to the current batch. When the next card node is encountered or the end of the top-level node is reached, all non-card nodes in the current batch are merged and packaged into a new card node.

[0050] Second transformation: When all top-level child nodes of the pasted slice are cell-type nodes (such as smartCell or gridCell) and the first transformation fails, the current cell is cut at the target layout node, and multiple cells from the pasted slice are inserted into the cut. For example, along the ancestor chain of the pasting point ($head), the first target layout node (fittingDepth) that can receive cell-type nodes is searched from deep to shallow; if not found, null is returned, and the subsequent transformation will handle it; according to the positional relationship between the pasting point and the cells to be cut, a preset method is selected to insert the multiple cells.

[0051] The third transformation: When the top-level child node of the pasted slice is a content carrier layer node (textblock / inline), the first content block of the pasted slice is merged into the target content carrier layer, and the remaining content blocks are inserted as sibling nodes. This avoids the Fitter (content adapter, used to adapt the pasted content to the schema constraints of the target location) of the editing kernel from replacing the entire target card node, which would result in data loss.

[0052] Fourth transformation: peel off the structural shell of the pasted slice layer by layer, and let the editor kernel's natural insertion mechanism (such as replaceRange's split / lift) handle it as a degradation to avoid silent discarding.

[0053] The four transformations are executed sequentially in the order of first transformation, second transformation, third transformation, and fourth transformation. The entire transformation process ends once any transformation is successfully executed. If the conditions of a transformation are not met, the next transformation will be tried. The fourth transformation is a fallback transformation to ensure that any pasting operation has visible feedback.

[0054] For example, the step of grouping and packaging the non-card node content in the pasted slice into card nodes may include: merging consecutive non-card nodes into new card nodes, using existing card nodes in the pasted slice as boundaries; if the top-level node itself is a card node, it is retained as is.

[0055] Specifically, the sequence of top-level child nodes of the pasted slice is traversed. If the current top-level node is itself a card node, it is preserved as is. If the current top-level node is a non-card node (such as a paragraph, heading, layout node, inline text, etc.), it is accumulated into the current batch, and the traversal continues to the next node. When the next card node is encountered or the traversal reaches the end of the top-level node, all consecutive non-card nodes accumulated in the current batch are merged and packaged into a new card node; the internal structure of this new card node is card→cardLayoutItem→normalized content. If the current batch contains multiple consecutive inline nodes, these multiple consecutive inline nodes are first merged into a paragraph node and then placed into the card node. After grouping, the traversal continues to the subsequent nodes, repeating the above process until all top-level child nodes have been processed.

[0056] For example, if the top-level child node sequence of the pasted slice is [card, paragraph, layout, card, paragraph], then the result after grouping and packaging is [card, card{paragraph+layout}, card, card{paragraph}] - the first card is kept as is; paragraph and layout are packaged into a new card as consecutive non-card nodes; the second card is kept as is; and the last paragraph is packaged into another new card.

[0057] For example, the step of cutting the current cell at the target layout node and inserting multiple cells from the pasted slice into the cut may include: searching for a target layout node that can receive a cell type node along the ancestor chain of the pasted point; inserting the multiple cells according to the positional relationship between the pasted point and the cell to be cut, wherein the preset method includes: directly inserting when the pasted point is already located at the child boundary of the target layout node; inserting adjacently before or after the cell when the cursor is located at the end of the cell to be cut; and cutting the current cell at the cursor position and inserting at the cut when the cursor is located in the middle of the cell to be cut.

[0058] Specifically, the system searches from deep to shallow along the ancestor chain of the pasting point for the first target layout node that can receive cell type nodes; if the search is successful, the depth difference (splitDepth) between the cursor and the target layout node is recorded; if the search fails, an empty value is returned and handed over to subsequent transformation processing. Then, determine the positional relationship between the paste landing point and the cells to be cut, and select one of the following preset methods to insert the multiple cells: If the paste point is already located at the child boundary of the target layout node (i.e., the cursor is located in the gap between two cells), then perform boundary insertion: directly insert all cells at the cursor position; If the cursor is at the beginning or end of the cell to be cut, endpoint optimization is performed: all adjacent cells are inserted before or after the cell to be cut, skipping the cutting operation to avoid leaving empty half-cells. If the cursor is in the middle of the cell to be split, the main path split is performed: the current cell is split along the depth at the cursor position (tr.split(pos, splitDepth)), and all cells are inserted at the cut (tr.insert(pos +splitDepth, slice.content)).

[0059] Furthermore, the step of converting the pasted slice from an open structure to a closed structure may include: obtaining the open depth information of the structural shell of the pasted slice; peeling off the structural shell layer by layer and updating the open depth information accordingly until a stopping condition is met; if the pasted slice still contains structural nodes after stopping, setting the open depth information to zero and constructing a closed slice.

[0060] Specifically, the open depth information of the structural shell of the pasted slice is obtained, namely the open depth on the starting side (openStart) and the open depth on the ending side (openEnd). The open depth information indicates the degree to which each layer of the structural shell exists in the form of a single-sided opening.

[0061] Peel off the structural shell layer by layer: replace the content of the current slice with the content of its only child node (drill down along the single child chain of card→cardLayoutItem→smartLayout), and decrement openStart and openEnd by 1.

[0062] After each layer is stripped, check if the following stopping conditions are met: (a) the number of top-level child nodes is greater than 1; (b) the top-level node is a content-carrying layer node (textblock / inline); (c) openStart or openEnd is zero. If any of these conditions are met, stop stripping; otherwise, return to step two and continue stripping.

[0063] If the top layer of the pasted slice is still a structural node (such as smartCell or smartLayout) after stopping, then openStart and openEnd are forcibly set to zero to construct a closed slice; if the top layer is already a textblock or inline node, then the current open depth information is retained and handed over to subsequent transformation processing.

[0064] Through the above processing, the structural shell that originally existed in the form of a single-sided opening is completely closed, so that multiple cells copied across cells participate in subsequent transformations as independent closed nodes, avoiding the content being stripped away and leaving only inline text.

[0065] S106. Update the document model and render it.

[0066] Specifically, after the paste operation is completed (including the insertion of card JSON in the first processing step or the successful execution of multi-level transformations in the second processing step), the editor kernel encapsulates all document changes (node ​​insertion, node deletion, attribute updates, index adjustments, etc.) involved in this paste operation into a transaction and commits this transaction to the document model. Upon receiving the transaction, the document model updates its internal state to ensure the document tree remains completely consistent with the actual content of the current presentation. The editor kernel triggers a view update process, re-rendering the updated document model into a visual presentation interface and displaying it in the browser for the user to continue editing.

[0067] Furthermore, the presentation editing method for the XML semantic document model provided in this application embodiment may further include: receiving a structured message stream pushed by a server; when a card skeleton message is received, writing the card skeleton into a buffer; when a multimedia binding message is received, writing a multimedia address into the corresponding node in the buffer according to the node identifier in the multimedia binding message; and when a stream end flag is received, writing the card content in the buffer into the document model all at once.

[0068] Specifically, the method may further include a streaming generation step. Figure 6 The timing diagram for the staged assembly of the streaming AI provided in this application embodiment. (Refer to...) Figure 6 First, it receives a structured message stream (such as SSE, Server-SentEvents) pushed by the server; when it receives a card skeleton message (such as slidesSingleCard or insertSlideHtml), it writes the card skeleton (such as an HTML string or JSON data) into the buffer.

[0069] When a multimedia binding message (such as insertSlideImg) is received, the multimedia address (such as an image URL) is written to the corresponding node in the buffer according to the node identifier (nodeId) in the multimedia binding message. Specifically, the HTML in the buffer is parsed using DOMParser, and the src attribute is set using doc.query Selector(img[id=${node Id}]), or the accent-image is set using card-accent[id=..], or the image attribute is set using smart-cell[id=.]. When the end-of-stream marker (last===true) is received, deleteRange({from, to}) is executed on the placeholder range, and the card content in the buffer is written to the document model all at once using insertContentAt(from,dataRef.current), and global attributes such as logo are inherited from the first card of the document.

[0070] Furthermore, the presentation editing method for the XML semantic document model provided in this application embodiment may further include: in response to a change in the content of the document model, scanning the layout nodes in the document model; for each child node of the layout node, calculating the derived attributes of the child node based on the attributes of the parent layout node; and sending the derived attributes to the rendering component to cause the rendering component to update the rendering.

[0071] The method may also include a layout synchronization step. Figure 7 This is a flowchart illustrating the SmartLayout attribute normalization process provided in an embodiment of this application. (Refer to...) Figure 7In response to changes in the content of the document model (i.e., ProseMirror's tr.docChanged===true), all smartLayout nodes in the document model are scanned. For each smart layout node's child smart cell node, the derived attributes of the child node are calculated with the parent smart layout node's attributes as the authority. These attributes include: type (with the parent layout's type as the authority; if layout.type is not null, it is pushed down; if layout.type is null, it is not pushed down, and the cell's existing value is rolled back), count (get the parent layout's childCount), index (get the cell's index in the parent), and rendering parameters such as direction, twoSided, and showLine (parent layout attributes take precedence, and cell attributes are rolled back during migration). The derived attributes are then distributed to the rendering component in the form of node decorations. The rendering component merges the derived attributes with the original node attributes into displayNode.attrs, which is used by child components to route rendering based on type (such as Pyramid or Timeline components), without needing to write back to setNodeMarkup. Pure cursor movement (selection changes, doc Changed=false) does not trigger decoration recalculation, thus avoiding invalid scanning.

[0072] It's important to note that decoration recalculation refers to the process where the editor re-executes the plugin code after a state change, generating a new DecorationSet. Since decoration itself is temporary, it doesn't automatically update with document changes. Therefore, the plugin must actively and explicitly recalculate which nodes need decoration, what decorations are needed, and generate a new DecorationSet for the view layer to render each time the state changes.

[0073] Furthermore, the presentation editing method for the XML semantic document model provided in this application embodiment may also include: generating a gap cursor in the gaps between card nodes and between cells within the layout; selecting an adjacent node when a delete operation is received at the gap cursor position; deleting the adjacent node when a delete operation is received again after the adjacent node has been selected; and determining the cursor landing point based on the neighbor node type after deletion.

[0074] The method may further include a gap cursor control step. Figure 8 This is a schematic diagram illustrating the three-level decision-making process for the Gap cursor deletion landing point, provided as an embodiment of this application. (Refer to...) Figure 8In locations such as gaps between card nodes (e.g., gaps between cards at the top level of the document), gaps between cells within a smart layout (e.g., gaps between cells within a smart layout), and gaps between images in a gallery, the `allow Gap Cursor: false` setting is used via the schema to restrict the generation of gap cursors, preventing pseudo-reachability where the cursor is visible but input is not possible. Simultaneously, in the `mousedown` event at the edge of the NodeView shell, a `GapCursor` is dispatched, allowing users to enter the gap cursor state by clicking the container edge. When a deletion operation (e.g., Backspace or Delete) is received at the gap cursor position, an adjacent node (e.g., NodeSelection) is selected. If a deletion operation is received again after the adjacent node is selected, the adjacent node is deleted. After deletion, the cursor placement is determined based on the neighbor node type—if the neighbor is a textblock, it falls into that textblock; if the neighbor is a structure node, a `GapCursor` is generated; if neither condition is met, it falls back to `Selection.near`. Furthermore, when character input is received at the top-level `GapCursor` position of the document, a new card node is automatically inserted. Figure 8 The three-tier decision-making mechanism shown (textblock neighbor → GapCursor → Selection.near) ensures that the cursor's landing point after a deletion operation conforms to the user's spatial intuition, preventing the cursor from accidentally jumping to other cards.

[0075] In summary, the presentation editing method 100 based on the XML semantic document model provided in this application constructs a structured document model with card sequences as the root node, enabling the presentation to exist as a unified document tree. This provides a consistent data foundation for streaming editing and AI incremental output, and supports isomorphism between the editing and storage states based on the same XML semantic model, enabling incremental saving by page and version comparison. In the paste processing, it first determines whether the clipboard content is JSON data of the entire card. If so, a new ID is recursively generated and the insertion position is determined according to the cursor position, achieving reliable slide-level copying without ID conflicts. If not, the paste slice is normalized with an open structure, closing the structural shell that is in an open state when copying across cell selections, so that multiple cells are retained as complete nodes. Then, multi-level transformations are used to ensure that at least one insertion path is hit, so that text selection copying across smart layouts and smart cells can retain complete layout units. Any paste operation has visible feedback or reasonable degradation, solving the common problems of silent paste failure and structural stripping in the prior art.

[0076] Based on the same inventive concept, embodiments of this application also provide a presentation editing system 200 based on the XML semantic document model. Figure 9 This is a schematic diagram of the structure of the presentation editing system based on the XML semantic document model provided in this application embodiment. (See attached diagram.) Figure 9 As shown, the system includes 200 components: Document model building module 201 is used to build a document model for a presentation, wherein the root node of the document model is a sequence containing only one or more card nodes; Clipboard reading module 202 is used to read clipboard content in response to user paste operation; Data judgment module 203 is used to determine whether the clipboard content is structured data containing card node identifiers; The pasting processing module 204 is used to determine the insertion position based on the current selection area position when the clipboard content is structured data containing card node identifiers, generate a new unique identifier for the nodes in the clipboard content, and insert the clipboard content at the insertion position; when the clipboard content is not structured data containing card node identifiers, it performs structural normalization processing on the pasting slice obtained from the parsed clipboard content, converts the pasting slice from an open structure to a closed structure, performs at least one of multiple transformation operations on the structurally normalized pasting slice in a preset order, and terminates after any transformation operation is hit; The rendering update module 205 is used to update the document model and render it for display.

[0077] The presentation editing system based on the XML semantic document model provided in the above embodiments can execute the presentation editing methods based on the XML semantic document model provided in the above embodiments, and has the same or corresponding beneficial effects, which will not be described in detail here.

[0078] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.

[0079] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.

[0080] In this application, unless otherwise stated, directional terms such as "up" and "down" are generally used in relation to the direction shown in the accompanying drawings, or in relation to the vertical, perpendicular, or gravitational direction; similarly, for ease of understanding and description, "left" and "right" are generally used in relation to the left and right shown in the accompanying drawings; "inner" and "outer" refer to the inner and outer contours of each component itself, but the above directional terms are not intended to limit this application.

[0081] The above description is merely an exemplary embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various variations or substitutions within the technical scope described in this application, and these should all be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A presentation editing method based on the XML semantic document model, characterized in that, include: Construct a document model for the presentation, wherein the root node of the document model contains a sequence of one or more card nodes; Responding to the user's paste action, read the clipboard contents; Determine whether the clipboard content is structured data containing card node identifiers; If so, the insertion position is determined based on the current selected area position, a new unique identifier is generated for the node in the clipboard content, and the clipboard content is inserted at the insertion position; If not, the pasted slice obtained from the clipboard content is subjected to structural normalization processing, the pasted slice is converted from an open structure to a closed structure, and at least one of multiple transformation operations is performed on the pasted slice after structural normalization processing in a preset order, and the process ends after any transformation operation is hit. Update the document model and render it.

2. The method according to claim 1, characterized in that, The plurality of transformation operations include: The first transformation is to group and package the non-card node content in the pasting slice into card nodes when the pasting target is the top layer of the document and the pasting slice does not contain closed card nodes. The second transformation is as follows: when all the top-level child nodes of the pasted slice are cell type nodes, the current cell is cut at the target layout node, and multiple cells in the pasted slice are inserted into the cut. The third transformation is to merge the content of the pasted slice into the target content carrying layer when the top-level child node of the pasted slice is a content carrying layer node. The fourth transformation involves stripping away the structural shell of the pasted slice, which is then processed by the editor kernel.

3. The method according to claim 2, characterized in that, The step of grouping and packaging the non-card node content in the pasted slice into card nodes includes: Using the existing card nodes in the pasted slice as the boundary, consecutive non-card nodes are merged into new card nodes; If the top-level node is itself a card node, it is preserved as is.

4. The method according to claim 2, characterized in that, The step of cutting the current cell at the target layout node and inserting multiple cells from the pasted slice into the cut includes: Search along the ancestor chain of the paste location for the target layout node that can receive a cell type node; Based on the positional relationship between the paste placement point and the cell to be cut, a preset method is selected to insert the multiple cells, wherein the preset method includes: Insert directly when the paste point is already located at the child boundary of the target layout node; Insert an adjacent element before or after the cell to be cut when the cursor is at the end of the cell to be cut. When the cursor is in the middle of the cell to be cut, the current cell is cut at the cursor position and an insert is placed at the cut.

5. The method according to claim 1, characterized in that, Determining the insertion position based on the current selected area includes: If the cursor is inside a card node, the insertion point is determined based on the cursor's relative position within the card node, either before or after the insertion point. If the selected area is the gap between the top-level card nodes of the document, the gap position is used as the insertion position; If none of the above conditions are met, the current slide position will be used as the insertion position.

6. The method according to claim 1, characterized in that, The step of converting the pasted slice from an open structure to a closed structure includes: Obtain the open depth information of the structural shell of the pasted slice; The structural shell is peeled off layer by layer, and the open depth information is updated accordingly, until the stopping condition is met; If the pasted slice still contains structural nodes after stopping, the open depth information is set to zero, and a closed slice is constructed.

7. The method according to claim 1, characterized in that, Also includes: Receive structured message streams pushed by the server; When a card skeleton message is received, the card skeleton is written to the buffer; When a multimedia binding message is received, the multimedia address is written into the corresponding node in the buffer according to the node identifier in the multimedia binding message; When the end-of-stream flag is received, the card content in the buffer is written to the document model all at once.

8. The method according to claim 1, characterized in that, Also includes: In response to changes in the content of the document model, the layout nodes in the document model are scanned; For each child node of the layout node, the derived attributes of the child node are calculated based on the attributes of the parent layout node. The derived attribute is sent to the rendering component, causing the rendering component to update the rendering.

9. The method according to claim 1, characterized in that, Also includes: Generate gap cursors in the gaps between card nodes and between cells within the layout; When a delete operation is received at the cursor position, the adjacent node is selected; If a delete operation is received again after the adjacent node has been selected, the adjacent node is deleted. After deletion, the cursor placement is determined based on the neighboring node type.

10. A presentation editing system based on the XML semantic document model, applicable to the method of any one of claims 1 to 9, characterized in that, The system includes: The document model building module is used to build a document model for a presentation, wherein the root node of the document model is a sequence containing only one or more card nodes; The clipboard reading module is used to read the clipboard content in response to the user's paste operation; The data judgment module is used to determine whether the clipboard content is structured data containing card node identifiers; The paste processing module is used to determine the insertion position based on the current selection area position when the clipboard content is structured data containing card node identifiers, generate a new unique identifier for the nodes in the clipboard content, and insert the clipboard content at the insertion position; when the clipboard content is not structured data containing card node identifiers, it performs structural normalization processing on the paste slice obtained from the parsed clipboard content, converts the paste slice from an open structure to a closed structure, performs at least one of multiple transformation operations on the structure-normalized paste slice in a preset order, and terminates after any transformation operation is hit; The rendering update module is used to update the document model and render it for display.