Online Visual Presentation Document Editing Method

By using WebSocket and version control algorithms in the online visual presentation document editing system, the problem of document consistency during collaborative editing by multiple people is solved, real-time synchronization and conflict resolution are achieved, and document integrity and consistency are ensured.

CN119378504BActive Publication Date: 2025-03-21ZHONGNAN XUNZHI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411945539.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-03-21
Estimated Expiration
2044-12-27

AI Technical Summary

Technical Problem

Existing online visual presentation document editing technology is difficult to ensure the consistency of documents when multiple people collaboratively edit.

Method used

Using WebSocket to establish a real-time communication connection between the client and the server through front-end scripts, synchronize user editing operations in real time, and use version control and conflict resolution algorithms to ensure the consistency of the document.

Benefits of technology

Real-time and document consistency during multi-person collaboration, and ensures document integrity and reliability through version management and conflict resolution functions.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention belongs to the field of data processing technology and relates to an online visual presentation document editing method, comprising establishing a real-time communication connection between a client and a server; sending the user's operation in the editor to the server in real time; the server broadcasting the operation to all users who are editing the same document; when the user performs the operation in the editor, the front-end script records the version number of the current document; before each operation, the client sends the current version number to the server, and the server checks whether the version numbers are consistent, and returns a conflict prompt if the version numbers do not match; for the conflict prompt, the user can choose to abandon the current operation or manually resolve the conflict; after each editing operation is completed, the front-end script performs version control, generates a new version number and saves it in a database; for multiple editing operations in a short period of time, the front-end script automatically merges these operations, and the merged operations are saved as a whole in the version control front-end script to reduce the number of versions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of data processing, and in particular relates to an online visual presentation document editing method. Background Art

[0002] With the continuous development of Internet technology, traditional document editing methods can no longer meet the needs of modern education and office. Online visual presentation document editing technology has emerged, which integrates multiple functions to provide a more efficient, convenient and interactive document editing experience. This technology not only supports multi-person collaborative editing, but also has rich editing tools and multimedia support, which greatly improves the efficiency and quality of document editing; however, in document editing, such as multi-person collaborative document editing, document consistency is still difficult to guarantee. Summary of the invention

[0003] In view of the deficiencies in the prior art, the present invention provides an online visual presentation document editing method.

[0004] To achieve the above object, the present invention provides the following technical solutions:

[0005] Online visual presentation document editing method, including:

[0006] Document import steps, document export steps, and collaborative editing steps;

[0007] The collaborative editing steps include: a user opens a document to be collaboratively edited;

[0008] The front-end script establishes a real-time communication connection between the client and the server through WebSocket;

[0009] The user's operations in the editor are sent to the server in real time;

[0010] The server broadcasts the operation to all users editing the same document;

[0011] When the user operates in the editor, the front-end script records the version number of the current document;

[0012] Before each operation, the client sends the current version number to the server, and the server checks whether the version numbers are consistent. If the version numbers do not match, a conflict prompt is returned;

[0013] For conflict prompts, users can choose to abandon the current operation or resolve the conflict manually;

[0014] After each editing operation is completed, the front-end script performs version control, generates a new version number and saves it to the database;

[0015] Users can view historical versions through the version management interface;

[0016] Users can choose to restore to any historical version;

[0017] The front-end script records the user's editing operations and their timestamps;

[0018] For multiple editing operations in a short period of time, the front-end script automatically merges these operations, and the merged operations are saved as a whole to the version control front-end script to reduce the number of versions.

[0019] Furthermore, the front-end script establishes a real-time communication connection between the client and the server through WebSocket, specifically including:

[0020] When a user opens a document that needs to be collaboratively edited, the front-end script automatically detects whether a real-time communication connection needs to be established;

[0021] The front-end script initiates a connection request by calling the WebSocket API using the preset server address and port;

[0022] After receiving the connection request, the server performs identity authentication to confirm that the user has the authority to access the document;

[0023] Once the WebSocket connection is established successfully, the front-end script sends an initial handshake message to the server. The initial handshake message contains the user ID and document ID.

[0024] After receiving the handshake message, the server adds the user to the collaborative editing session of the document and returns a confirmation message;

[0025] The user's operations in the editor are captured by the front-end script;

[0026] Encapsulate the captured operation into a message object, which contains the operation type, operation content, timestamp and current version number;

[0027] The front-end script sends the message object to the server in real time via the WebSocket connection.

[0028] Furthermore, the user's operations in the editor are sent to the server in real time, including:

[0029] When users perform operations in the editor, these operations are captured by the front-end script;

[0030] The captured operations include text input, deletion, formatting, image insertion, and table editing;

[0031] The front-end script encapsulates the captured operations into structured messages; the structured messages contain operation type, operation content, operation location, user ID and timestamp information;

[0032] Send the encapsulated operation message to the server in real time through the WebSocket connection;

[0033] After receiving the operation message, the server first checks the integrity and legitimacy of the message;

[0034] The server records the operation message in memory and generates a new operation queue.

[0035] Furthermore, when the user operates in the editor, the front-end script records the version number of the current document, including:

[0036] When a user opens a document for the first time, an initial version number is generated for the document; the initial version number is stored in the metadata of the document and loaded into the front-end script when the user opens the document;

[0037] Whenever the user performs any operation in the editor, the front-end script records the version number of the current document; the version number of the current document is a unique identifier used to track the status of the document;

[0038] Each time a user completes an editing operation, the front-end script generates a new version number; the new version number is incremented based on the current version number to ensure that each version number is unique;

[0039] Before the user performs any operation, the front-end script will send the current version number to the server; after receiving the version number, the server will check whether the version number is consistent with the latest version number recorded on the server.

[0040] Furthermore, before each operation, the client sends the current version number to the server, and the server checks whether the version numbers are consistent. If the version numbers do not match, a conflict prompt is returned. Specifically, whenever the user is ready to perform any operation in the editor, the front-end script will first obtain the version number of the current document; the version number of the current document is loaded from the server when the user opens the document, or it is a new version number generated after the last operation;

[0041] The front-end script encapsulates the version number of the current document and the operation to be performed into a message object and sends it to the server through the established WebSocket connection; the message object contains the operation type, operation content, operation location, user ID, timestamp and current version number information;

[0042] After receiving the message sent by the client, the server first parses the message content and extracts the version number information;

[0043] The server compares the version number sent by the client with the latest version number recorded on the server; if the two version numbers are consistent, it means that the client's operation is based on the latest document, and the server will continue to process the operation;

[0044] If the version number sent by the client is inconsistent with the latest version number recorded on the server, the server generates a conflict prompt message and sends the message back to the client through the WebSocket connection.

[0045] Furthermore, for conflict prompts, users can choose to abandon the current operation or manually resolve the conflict, including:

[0046] After receiving the conflict prompt, the front-end script displays a prompt box on the editor interface to inform the user that there is a conflict.

[0047] The reason for the conflict is detailed in the tooltip;

[0048] There are two selection buttons in the prompt box:

[0049] Abandon current operation button: Users can choose to abandon the current operation, and the system will cancel the operation and keep the current state of the document unchanged;

[0050] Manual conflict resolution button: Users can choose to manually resolve conflicts and enter the conflict resolution interface;

[0051] The conflict resolution interface displays the current user's operation and the latest document status on the server;

[0052] Users can manually adjust document content in the conflict resolution interface to resolve conflicts;

[0053] After the user has finished adjusting, he can click the "Save" button, and the system will send the adjusted content to the server for final saving;

[0054] Regardless of whether the user chooses to abandon the current operation or manually resolve the conflict, the system will resynchronize the latest version of the document;

[0055] If the user chooses to manually resolve the conflict and save, the system will generate a new version number and save the adjusted content to the database;

[0056] The latest document content and version number are broadcasted via the WebSocket connection to all users editing the same document.

[0057] Furthermore, after each editing operation is completed, the front-end script performs version control, generates a new version number and saves it to the database. Specifically, when the user completes an editing operation in the editor, the front-end script detects the event that the operation is completed;

[0058] The front-end script generates a new version number based on the current version number; the new version number is incremented by 1 based on the current version number to ensure that each version number is unique;

[0059] The front-end script encapsulates the details of the editing operation into a structured message;

[0060] The encapsulated structured message is sent to the server in real time through the WebSocket connection; the structured message contains the operation type, operation content, operation location, user ID, timestamp and new version number information;

[0061] After receiving the operation message, the server first checks the integrity and legitimacy of the message;

[0062] The server records the operation message in memory and generates a new operation queue to ensure the sequential consistency of the operation;

[0063] The server checks whether the version number of the structured message is consistent with the latest version number recorded on the server; if the version numbers are inconsistent, the server will return a conflict prompt;

[0064] If the version numbers are consistent, the server saves the new version number and the editing operation content in the database; the version information stored in the database includes the version number, operation type, operation content, operation location, user ID and timestamp.

[0065] Furthermore, for multiple editing operations in a short period of time, the front-end script automatically merges these operations, and the merged operations are saved as a whole to the version control front-end script, which specifically includes:

[0066] Each time an operation is captured, the front-end script records the current timestamp; the timestamp is used to identify the specific time when the operation occurred;

[0067] The front-end script monitors multiple editing operations performed by users within a preset time;

[0068] If these operations occur in the same location or adjacent locations and are of the same type, the front-end script merges these operations into one operation;

[0069] When merging operations, the front-end script will merge the contents of multiple operations into a whole and retain the earliest operation timestamp;

[0070] The merged operation is saved as a whole to the version control front-end script.

[0071] Furthermore, when more than two users are collaboratively editing a document, if the edited content at the same location of the same edited document is conflicting, the edited content of all users participating in the collaborative editing is counted, and the correct edited content is determined through probability distribution. The specific steps are as follows:

[0072] Record each user's edits in the same location;

[0073] Record the timestamp of each editing operation;

[0074] Count the editing frequency of each user over a period of time;

[0075] Record the historical accuracy of each user;

[0076] Assign weights to each user's edits based on edit frequency, historical accuracy, and edit time factors;

[0077] Calculate the prior probability of each user based on historical accuracy;

[0078] Calculate the likelihood function based on the editing time and editing frequency;

[0079] Calculate the posterior probability of each edited content based on the prior probability and likelihood function;

[0080] Sort all edits according to the calculated posterior probability values;

[0081] The edited content with the highest probability is selected as the final correct content.

[0082] Compared with the prior art, the present invention has the following beneficial effects:

[0083] Conflict Resolution:

[0084] Ensure document consistency when multiple people collaborate through precise version control and conflict resolution algorithms.

[0085] When the version numbers do not match, the system will generate a conflict prompt, and the user can choose to abandon the current operation or manually resolve the conflict to ensure the integrity and consistency of the document. A real-time communication connection is established between the client and the server through WebSocket to ensure low latency and high reliability.

[0086] Synchronize user operations in the editor in real time to ensure real-time and consistency during multi-person collaboration.

[0087] After each editing operation is completed, the front-end script generates a new version number and saves it to the database to ensure that each version is recorded in detail.

[0088] Users can view historical versions through the version management interface and choose to restore to any historical version for easy backtracking and management. DETAILED DESCRIPTION

[0089] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0090] The present application discloses an online visual presentation document editing method, the method comprising:

[0091] Document import steps:

[0092] The user selects the document format to be imported (such as Word, PDF, PPT);

[0093] The front-end script calls the corresponding third-party library (such as Apache POI, PDF.js) to read the document content;

[0094] Convert the imported document content into a format supported by the front-end script and display it in the editor;

[0095] Document export steps:

[0096] The user selects the document format to be exported (such as Word, PDF, PPT);

[0097] The front-end script calls the corresponding third-party library (such as Apache POI, PDF.js) to convert the content in the editor to the target format;

[0098] Generate export files and provide download links;

[0099] Important aspects of this approach include collaborative editing:

[0100] The user opens the document that needs to be collaboratively edited;

[0101] The front-end script establishes a real-time communication connection between the client and the server through WebSocket;

[0102] Specifically include:

[0103] When a user opens a document that needs to be collaboratively edited, the front-end script automatically detects whether a real-time communication connection needs to be established.

[0104] The front-end script initiates a connection request by calling the WebSocket API using the preset server address and port.

[0105] After receiving the connection request, the server performs identity authentication to confirm that the user has permission to access the document.

[0106] Once the WebSocket connection is established successfully, the front-end script sends an initial handshake message to the server, including the user ID and document ID.

[0107] After receiving the handshake message, the server adds the user to the collaborative editing session of the document and returns a confirmation message.

[0108] The user's operations in the editor (such as text input, formatting, and image insertion) are captured by the front-end script.

[0109] The captured operation is encapsulated into a message object, which includes the operation type, operation content, timestamp and current version number.

[0110] The front-end script sends the message object to the server in real time via the WebSocket connection.

[0111] The user's operations in the editor are sent to the server in real time;

[0112] Specifically include:

[0113] When users perform operations in the editor (such as text input, formatting, image insertion, table editing, etc.), these operations are captured by the front-end script.

[0114] The captured operations include but are not limited to: text input, deletion, formatting (bold, italic, underline, etc.), image insertion, table editing, etc.

[0115] The front-end script encapsulates the captured operations into structured messages. The structured messages contain the operation type, operation content, operation location, user ID, and timestamp information.

[0116] For example, a text input operation may be encapsulated as: { type: 'textInsert', content: 'Hello, World!', position: { row: 1, col: 1}, userId: 'user123', timestamp:1634567890}.

[0117] The encapsulated operation message is sent to the server in real time through the WebSocket connection.

[0118] WebSocket connections ensure low-latency, real-time communication, so that actions are quickly communicated to the server.

[0119] After receiving the operation message, the server first checks the integrity and legitimacy of the message.

[0120] The server records the operation message in memory and generates a new operation queue.

[0121] The server broadcasts the operation to all users editing the same document;

[0122] During specific broadcasts, the server ensures that all users receive the same order of operations to avoid document inconsistencies due to different operation orders.

[0123] When the user operates in the editor, the front-end script records the version number of the current document;

[0124] Specifically include:

[0125] When a user first opens a document, an initial version number is generated for the document. This version number is stored in the document's metadata and loaded into the front-end script when the user opens the document.

[0126] Whenever the user performs any operation in the editor (such as text input, image insertion, formatting, etc.), the front-end script will immediately record the version number of the current document. This version number is a unique identifier used to track the status of the document.

[0127] Each time a user completes an editing operation, the front-end script generates a new version number. The new version number is incremented based on the current version number to ensure that each version number is unique.

[0128] Before the user performs any operation, the front-end script will send the current version number to the server. After receiving the version number, the server will check whether the version number is consistent with the latest version number recorded on the server.

[0129] Before each operation, the client sends the current version number to the server, and the server checks whether the version numbers are consistent. If the version numbers do not match, a conflict prompt is returned;

[0130] Specifically, whenever a user prepares to perform any operation in the editor (such as text input, image insertion, formatting, etc.), the front-end script will first obtain the version number of the current document. This version number is loaded from the server when the user opens the document, or it is a new version number generated after the last operation.

[0131] The front-end script encapsulates the current version number and the operation to be performed into a message object and sends it to the server through the established WebSocket connection. The message object contains information such as operation type, operation content, operation location, user ID, timestamp, and current version number.

[0132] Receiving messages: After receiving the message sent by the client, the server first parses the message content and extracts the version number information.

[0133] Version number verification: The server compares the version number sent by the client with the latest version number recorded on the server. If the two version numbers are consistent, it means that the client's operation is based on the latest document, and the server will continue to process the operation.

[0134] If the version number sent by the client is inconsistent with the latest version number recorded on the server, it means that other users have edited the document at the same time, resulting in inconsistent version numbers.

[0135] When the server detects a version mismatch, it generates a conflict message and sends it back to the client over the WebSocket connection.

[0136] For conflict prompts, users can choose to abandon the current operation or resolve the conflict manually;

[0137] Specifically include:

[0138] After receiving the conflict prompt, the front-end script displays a prompt box on the editor interface to inform the user that there is a conflict.

[0139] The reason for the conflict is detailed in the prompt box, for example: "Other users have modified the document. Please choose a handling method.";

[0140] There are two selection buttons in the prompt box:

[0141] Abandon the current operation: The user can choose to abandon the current operation in progress. The system will undo the operation and keep the current status of the document unchanged.

[0142] Manually resolve conflicts: Users can choose to manually resolve conflicts and enter the conflict resolution interface.

[0143] The conflict resolution interface displays the current user's operations and the latest document status on the server.

[0144] Users can manually adjust document content in the conflict resolution interface to resolve conflicts.

[0145] After the user has completed the adjustment, he can click the "Save" button and the system will send the adjusted content to the server for final saving.

[0146] Regardless of whether the user chooses to abandon the current operation or resolve the conflict manually, the system will resynchronize the latest version of the document.

[0147] If the user chooses to manually resolve the conflict and save it, the system will generate a new version number and save the adjusted content in the database.

[0148] The latest document content and version number will be broadcasted via the WebSocket connection to all users who are editing the same document, ensuring that all users see the same document content.

[0149] After each editing operation is completed, the front-end script performs version control, generates a new version number and saves it to the database;

[0150] Specifically, when a user completes an editing operation in the editor (such as text input, image insertion, formatting, etc.), the front-end script detects the event that the operation is completed.

[0151] The front-end script generates a new version number based on the current version number. The new version number is incremented by 1 based on the current version number to ensure that each version number is unique.

[0152] The front-end script encapsulates the detailed information of the editing operation (such as operation type, operation content, operation location, user ID and timestamp, etc.) into a structured message.

[0153] The encapsulated structured message is sent to the server in real time through the WebSocket connection. The structured message contains information such as operation type, operation content, operation location, user ID, timestamp, and new version number.

[0154] After receiving the operation message, the server first checks the integrity and legitimacy of the message.

[0155] The server records the operation message in memory and generates a new operation queue to ensure the sequential consistency of the operation.

[0156] The server checks whether the version number of the structured message is consistent with the latest version number recorded on the server. If the version numbers are inconsistent, the server will return a conflict prompt.

[0157] If the version numbers are consistent, the server saves the new version number and the edit operation content to the database. The version information stored in the database includes the version number, operation type, operation content, operation location, user ID, and timestamp.

[0158] Users can view historical versions through the version management interface;

[0159] Users can choose to restore to any historical version;

[0160] The front-end script records the user's editing operations and their timestamps;

[0161] For multiple editing operations in a short period of time, the front-end script automatically merges these operations and saves the merged operations as a whole to the version control front-end script to reduce the number of versions;

[0162] For multiple editing operations in a short period of time, the front-end script automatically merges these operations, and the merged operations are saved as a whole to the version control front-end script, which specifically includes:

[0163] Each time an operation is captured, the front-end script records the current timestamp. The timestamp is used to identify the specific time when the operation occurred, which helps with subsequent version control and conflict resolution.

[0164] The front-end script monitors multiple editing operations performed by the user within a preset time (such as a few seconds).

[0165] If these operations occur at the same position or adjacent positions and are of the same type (such as continuous text input), the front-end script will merge these operations into one operation.

[0166] When merging operations, the front-end script will merge the contents of multiple operations into a whole and retain the earliest operation timestamp.

[0167] For example, if the user enters "Hello" and "World" consecutively within a few seconds, the front-end script will merge these two operations into one operation: { type: 'textInsert', content: 'HelloWorld', position: {row: 1, col: 1}, userId: 'user123', timestamp: 1634567890}.

[0168] The merged operations are saved as a whole to the version control front-end script, reducing the number of versions and improving the efficiency of version management.

[0169] In a preferred implementation, when more than two users are collaboratively editing a document, if the edited content at the same location of the same edited document conflicts with each other, the edited content of all users participating in the collaborative editing is counted, and the correct edited content is determined through probability distribution to ensure that the operation does not cause a conflict. The specific steps are as follows:

[0170] Edits: Records the edits made by each user in the same location.

[0171] Edit Time: Records the timestamp of each edit operation.

[0172] Editing frequency: Statistics on the editing frequency of each user within a period of time.

[0173] Historical accuracy: Records the historical editing accuracy of each user, that is, the correctness of past edits.

[0174] Weighting: Assign weights to each user's edits based on edit frequency, historical accuracy, and edit time factors.

[0175] Editing frequency: Users with higher editing frequency have higher weights.

[0176] Historical Accuracy: Users with higher historical accuracy are weighted higher.

[0177] Edit time: The most recent edits are weighted higher.

[0178] Prior probability: Calculate the prior probability for each user based on historical accuracy.

[0179] Likelihood function: Calculate the likelihood function based on the edit time and edit frequency.

[0180] Posterior probability: Combine the prior probability and likelihood function to calculate the posterior probability of each edited content.

[0181] Sorting: Sort all edits according to the calculated posterior probability values.

[0182] Selection: Select the edited content with the highest probability as the final correct content.

[0183] Specific steps

[0184] 1. Data Collection:

[0185] When multiple users edit the same location, the front-end script records each user's edit content, edit time, edit frequency, and historical accuracy.

[0186] For example, user A enters "Hello" at position (1, 1), user B enters "Hi" at the same position, and user C enters "Hey" at the same position.

[0187] 2. Weight distribution:

[0188] Edit frequency: Assume that user A has edited 10 times in the past hour, user B has edited 5 times, and user C has edited 3 times.

[0189] Historical accuracy: Assume that the historical accuracy of user A is 90%, user B is 80%, and user C is 70%.

[0190] Editing time: Assume that the editing time of user A is 10 seconds ago, that of user B is 5 seconds ago, and that of user C is 2 seconds ago.

[0191] 3. Probability calculation:

[0192] Prior Probability: Calculate the prior probability based on historical accuracy.

[0193] The prior probability of user A is 0.9.

[0194] The prior probability of user B is 0.8.

[0195] The prior probability of user C is 0.7.

[0196] Likelihood function: Calculate the likelihood function based on the edit time and edit frequency.

[0197] The likelihood function of user A is 0.8 (editing frequency) * 0.9 (editing time) = 0.72.

[0198] The likelihood function for user B is 0.5 * 0.95 = 0.475.

[0199] The likelihood function of user C is 0.3 * 0.98 = 0.294.

[0200] Posterior probability: Combine the prior probability and the likelihood function to calculate the posterior probability.

[0201] The posterior probability of user A is 0.9 * 0.72 = 0.648.

[0202] The posterior probability of user B is 0.8 * 0.475 = 0.38.

[0203] The posterior probability of user C is 0.7 * 0.294 = 0.2058.

[0204] 4. Probability ranking:

[0205] Sort all edits by their posterior probability values.

[0206] User A’s edited content “Hello”: posterior probability 0.648.

[0207] User B’s edited content “Hi”: posterior probability 0.38.

[0208] User C’s edited content “Hey”: posterior probability 0.2058.

[0209] The edited content "Hello" with the highest posterior probability is selected as the final correct content.

[0210] 5. Operation application:

[0211] The final edited content "Hello" is applied to the document and broadcasted via the WebSocket connection to all users who are editing the same document, ensuring that all users see the same document content.

[0212] Finally, it should be noted that the above are only preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein with equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. An online visual presentation document editing method, characterized in that: include: Document import steps, document export steps, and collaborative editing steps; The collaborative editing steps include: a user opens a document to be collaboratively edited; The front-end script establishes a real-time communication connection between the client and the server through WebSocket; The user's operations in the editor are sent to the server in real time; The server broadcasts the operation to all users editing the same document; When the user operates in the editor, the front-end script records the version number of the current document; Before each operation, the client sends the current version number to the server, and the server checks whether the version numbers are consistent. If the version numbers do not match, a conflict prompt is returned; For conflict prompts, users can choose to abandon the current operation or resolve the conflict manually; After each editing operation is completed, the front-end script performs version control, generates a new version number and saves it to the database; Users can view historical versions through the version management interface; Users can choose to restore to any historical version; The front-end script records the user's editing operations and their timestamps; For multiple editing operations in a short period of time, the front-end script automatically merges these operations and saves the merged operations as a whole to the version control front-end script to reduce the number of versions; When more than two users are collaboratively editing a document, if the edited content at the same location of the same edited document is conflicting, the edited content of all users participating in the collaborative editing is counted and the correct edited content is determined through probability distribution. The specific steps are as follows: Record each user's edits in the same location; Record the timestamp of each editing operation; Count the editing frequency of each user over a period of time; Record the historical accuracy of each user; Assign weights to each user's edits based on edit frequency, historical accuracy, and edit time factors; Calculate the prior probability of each user based on historical accuracy; Calculate the likelihood function based on the editing time and editing frequency; Calculate the posterior probability of each edited content based on the prior probability and likelihood function; Sort all edits according to the calculated posterior probability values; The edited content with the highest probability is selected as the final correct content.

2. The online visual presentation document editing method according to claim 1, characterized in that: The front-end script establishes a real-time communication connection between the client and the server through WebSocket, including: When a user opens a document that needs to be collaboratively edited, the front-end script automatically detects whether a real-time communication connection needs to be established; The front-end script initiates a connection request by calling the WebSocket API using the preset server address and port; After receiving the connection request, the server performs identity authentication to confirm that the user has the authority to access the document; Once the WebSocket connection is established successfully, the front-end script sends an initial handshake message to the server. The initial handshake message contains the user ID and document ID. After receiving the handshake message, the server adds the user to the collaborative editing session of the document and returns a confirmation message; The user's operations in the editor are captured by the front-end script; Encapsulate the captured operation into a message object, which contains the operation type, operation content, timestamp and current version number; The front-end script sends the message object to the server in real time via the WebSocket connection.

3. The online visual presentation document editing method according to claim 1, characterized in that: The operations that the user performs in the editor are sent to the server in real time, including: When users perform operations in the editor, these operations are captured by the front-end script; The captured operations include text input, deletion, formatting, image insertion, and table editing; The front-end script encapsulates the captured operations into structured messages; the structured messages contain operation type, operation content, operation location, user ID and timestamp information; Send the encapsulated operation message to the server in real time through the WebSocket connection; After receiving the operation message, the server first checks the integrity and legitimacy of the message; The server records the operation message in memory and generates a new operation queue.

4. The online visual presentation document editing method according to claim 1, characterized in that: When the user operates in the editor, the front-end script records the version number of the current document, including: When a user opens a document for the first time, an initial version number is generated for the document; the initial version number is stored in the metadata of the document and loaded into the front-end script when the user opens the document; Whenever the user performs any operation in the editor, the front-end script records the version number of the current document; the version number of the current document is a unique identifier used to track the status of the document; Each time a user completes an editing operation, the front-end script generates a new version number; the new version number is incremented based on the current version number to ensure that each version number is unique; Before the user performs any operation, the front-end script will send the current version number to the server; after receiving the version number, the server will check whether the version number is consistent with the latest version number recorded on the server.

5. The online visual presentation document editing method according to claim 1, characterized in that: Before each operation, the client sends the current version number to the server, and the server checks whether the version numbers are consistent. If the version numbers do not match, a conflict prompt is returned. Specifically, whenever the user is ready to perform any operation in the editor, the front-end script will first obtain the version number of the current document; the version number of the current document is loaded from the server when the user opens the document, or it is a new version number generated after the last operation; The front-end script encapsulates the version number of the current document and the operation to be performed into a message object and sends it to the server through the established WebSocket connection; the message object contains the operation type, operation content, operation location, user ID, timestamp and current version number information; After receiving the message sent by the client, the server first parses the message content and extracts the version number information; The server compares the version number sent by the client with the latest version number recorded on the server; if the two version numbers are consistent, it means that the client's operation is based on the latest document, and the server will continue to process the operation; If the version number sent by the client is inconsistent with the latest version number recorded on the server, the server generates a conflict prompt message and sends the message back to the client through the WebSocket connection.

6. The online visual presentation document editing method according to claim 1, characterized in that: For conflict prompts, users can choose to abandon the current operation or manually resolve the conflict, including: After receiving the conflict prompt, the front-end script displays a prompt box on the editor interface to inform the user that there is a conflict. The reason for the conflict is detailed in the tooltip; There are two selection buttons in the prompt box: Abandon current operation button: Users can choose to abandon the current operation in progress, and the system will cancel the operation and keep the current state of the document unchanged; Manual conflict resolution button: Users can choose to manually resolve conflicts and enter the conflict resolution interface; The conflict resolution interface displays the current user's operation and the latest document status on the server; Users can manually adjust document content in the conflict resolution interface to resolve conflicts; After the user has finished adjusting, he can click the "Save" button, and the system will send the adjusted content to the server for final saving; Regardless of whether the user chooses to abandon the current operation or manually resolve the conflict, the system will resynchronize the latest version of the document; If the user chooses to manually resolve the conflict and save, the system will generate a new version number and save the adjusted content to the database; The latest document content and version number are broadcasted via the WebSocket connection to all users editing the same document.

7. The online visual presentation document editing method according to claim 1, characterized in that: After each editing operation is completed, the front-end script performs version control, generates a new version number and saves it to the database. Specifically, when the user completes an editing operation in the editor, the front-end script detects the event that the operation is completed; The front-end script generates a new version number based on the current version number; the new version number is incremented by 1 based on the current version number to ensure that each version number is unique; The front-end script encapsulates the details of the editing operation into a structured message; The encapsulated structured message is sent to the server in real time through the WebSocket connection; the structured message contains the operation type, operation content, operation location, user ID, timestamp and new version number information; After receiving the operation message, the server first checks the integrity and legitimacy of the message; The server records the operation message in memory and generates a new operation queue to ensure the sequential consistency of the operation; The server checks whether the version number of the structured message is consistent with the latest version number recorded on the server; if the version numbers are inconsistent, the server will return a conflict prompt; If the version numbers are consistent, the server saves the new version number and the editing operation content in the database; the version information stored in the database includes the version number, operation type, operation content, operation location, user ID and timestamp.

8. The online visual presentation document editing method according to claim 1, characterized in that: For multiple editing operations in a short period of time, the front-end script automatically merges these operations, and the merged operations are saved as a whole to the version control front-end script, which specifically includes: Each time an operation is captured, the front-end script records the current timestamp; the timestamp is used to identify the specific time when the operation occurred; The front-end script monitors multiple editing operations performed by users within a preset time; If these operations occur in the same location or adjacent locations and are of the same type, the front-end script merges these operations into one operation; When merging operations, the front-end script will merge the contents of multiple operations into a whole and retain the earliest operation timestamp; The merged operation is saved as a whole to the version control front-end script.

Citation Information

Patent Citations

  • Intelligent conflict detection and semantic expression of document edits

    CN106663089A

  • CRDT-based document multi-person collaborative editing method and system

    CN118862840A