Web page editing method, device, and storage medium

By listening to keyboard events on the web page and saving input content, the problem of instant undoing and redoing in web page design is solved, and the web page text is quickly restored to historical versions, improving the efficiency of web page development.

CN114547522BActive Publication Date: 2025-01-14LANGYUAN TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210189419.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-28
Publication Date
2025-01-14
Estimated Expiration
2042-02-28

AI Technical Summary

Technical Problem

The prior art cannot realize instant input memory and undo redo functions in web design, resulting in inefficiency of web developers in error operations and unable to recover previous data.

Method used

By listening to keyboard events within the web page, saving input content to the local storage unit, and when receiving the undo command, selecting historical input content from the local storage to restore web page text, supporting editing of any page and form.

Benefits of technology

It realizes the rapid recovery of web page text to historical versions, avoids data loss, saves repeated development time, and improves web page development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114547522B_ABST
    Figure CN114547522B_ABST
Patent Text Reader

Abstract

The present invention discloses a web page editing method, device, and storage medium. The method comprises the following steps: step S1, obtaining basic information of a web page, and monitoring keyboard events in the web page; step S2, when receiving an instruction to edit an input element, obtaining input events and input content through keyboard event monitoring; saving the input content to a local storage unit according to the basic information of the web page; step S3, when receiving an undo instruction, selecting the input content from the local storage unit as current editing data; and obtaining the edited web page text according to the current editing data. The present invention conveniently and quickly restores the current web page text to a historical version, avoids the problem of data loss caused by user misoperation, supports the editing of any page, any form, and table data, saves repeated development, and improves web page development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technology, and in particular to a webpage editing method, electronic equipment, and storage medium. Background Art

[0002] The existing undo-redo function is a memory preservation function for specified content settings, which requires a large amount of work and is generally set in specific content editing scenarios such as document editing. Ordinary systems and form filling do not support instant input memory, nor do they support undo-redo. However, when designing web pages, web developers may make mistakes, such as accidentally deleting previously edited content or entering some wrong content. Web developers need to edit the current web page again, re-enter the previously deleted content or delete the mistakenly entered content to restore to the previous or later version, which is inefficient. And generally, after closing the web page or jumping back to the web page, the previous data cannot be restored.

[0003] If the undo and redo functions are developed for specific content of a web page, any module that needs the undo and redo functions will have to be redeveloped, which is not adaptable. How to quickly restore the current web page text to the historical version and improve the efficiency of web page development has become an urgent problem to be solved. Summary of the invention

[0004] In order to overcome the deficiencies of the prior art, the present invention aims to provide a web page editing method, which can quickly and easily restore the current web page text to a historical version, thereby improving web page development efficiency.

[0005] A second object of the present invention is to provide an electronic device that executes the above web page editing method to conveniently and quickly restore the current web page text to a historical version, thereby improving web page development efficiency.

[0006] The third object of the present invention is to provide a storage medium for executing the above web page editing method to conveniently and quickly restore the current web page text to a historical version, thereby improving the efficiency of web page development.

[0007] One of the purposes of the present invention is achieved by the following technical solution:

[0008] A webpage editing method, the method comprising the following steps:

[0009] Step S1, obtaining basic information of the web page, and monitoring keyboard events in the web page;

[0010] Step S2: upon receiving the instruction to edit the input element, obtaining the input event and the input content through keyboard event monitoring; and saving the input content to a local storage unit according to the basic information of the web page;

[0011] Step S3: When a cancel instruction is received, the input content is selected from the local storage unit as the current editing data; and the edited web page text is obtained according to the current editing data.

[0012] Furthermore, the basic information of the web page includes the web page URL, keywords, and input element features; the input element features include user ID, class, and tag.

[0013] Furthermore, in step S2, the input content is saved to a local storage unit according to the basic information of the web page, specifically,

[0014] Step S21, obtaining a historical input object queue according to the webpage URL, keywords, and input element features; the historical input object queue includes historical input element features, historical input content, and index numbers; each historical input content corresponds to an index number;

[0015] Step S22: Add the input content to the historical input object queue, and the index number of the input content is the last index number in the historical input object queue + 1.

[0016] Furthermore, in step S3, the input content is selected from the local storage unit as the current editing data, specifically,

[0017] Step S31, acquiring a historical input object queue in a local storage unit according to the webpage URL, keywords, and input element features;

[0018] Step S32: read the historical input content according to the index number in the historical input object queue; select the required historical input content as the current editing data.

[0019] Furthermore, in the step S3, the edited web page text is obtained according to the current editing data, specifically, the index number of the current editing data is obtained, the historical input content is obtained, and the historical input content is overwritten into the input content of the input element.

[0020] Furthermore, the method further comprises the following steps:

[0021] Step S4, obtain the index number in the historical input object queue in the local storage unit, and determine whether the index number exceeds the preset first threshold; when the index number exceeds the preset first threshold, clean up the historical input content in the historical input object queue in the local storage unit whose index number is less than the preset second threshold; and the preset first threshold is greater than the preset second threshold.

[0022] Furthermore, the undo instruction in step S3 is an undo instruction triggered by a keyboard key or a virtual undo key.

[0023] Furthermore, the historical input content stored in the local storage unit is the difference between the current version input content and the previous version input content.

[0024] The second object of the present invention is achieved by adopting the following technical solution:

[0025] An electronic device comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the webpage editing methods described above when executing the computer program.

[0026] The third object of the present invention is achieved by adopting the following technical solution:

[0027] A storage medium stores a computer program, wherein the computer program implements any of the webpage editing methods described above when executed.

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

[0029] The present invention discloses a web page editing method, an electronic device, and a storage medium. The method monitors keyboard events in a web page. When the input focus is an input element, the input event and input content are monitored and saved through the keyboard event. After receiving the undo command, the input content is selected from the local storage unit as the current editing data; according to the current editing data, the edited web page text is obtained, and the current web page text is conveniently and quickly restored to the historical version, avoiding the problem of data loss caused by user misoperation. In addition, the method supports the editing of any page, any form, and table data, saving repeated development and improving web page development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 A schematic diagram of a flow chart of a webpage editing method according to an embodiment of the present invention;

[0031] Figure 2 This is a flow chart of step S2 of a webpage editing method according to an embodiment of the present invention;

[0032] Figure 3 This is a flow chart of step S3 of a webpage editing method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0033] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that, under the premise of no conflict, the various embodiments or technical features described below can be arbitrarily combined to form a new embodiment.

[0034] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0035] It should be noted that the descriptions of "first", "second", etc. in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0036] like Figure 1 As shown, the present invention provides a web page editing method, which can quickly and easily restore the current web page text to a historical version, thereby improving the efficiency of web page development.

[0037] Specifically, the method comprises the following steps:

[0038] Step S1, obtain basic information of the web page, and monitor keyboard events in the web page. The basic information of the web page includes the web page URL (Uniform Resource Locator), keywords, and input element features; the input element features include user ID, class attributes, and tags.

[0039] Step S2: upon receiving the instruction to edit the input element, the input event and input content are obtained through keyboard event monitoring; the input content is saved in the local storage unit according to the basic information of the web page. Input elements include input, TEXTAREA, SELECT, elements containing contenteditable="true", etc. When the user edits the web page text, the text content may include text, numbers, strings, formulas, pictures, programming codes, etc. When the input focus selected by the user is within the input element, the input event is triggered, and the web page keeps monitoring the keyboard event to obtain the input content.

[0040] like Figure 2 As shown, according to the basic information of the web page, the input content is saved to the local storage unit, which specifically includes the following steps:

[0041] Step S21, obtaining a historical input object queue according to the webpage URL, keywords, and input element features; the historical input object queue includes historical input element features, historical input content, and index numbers; each historical input content corresponds to an index number;

[0042] Step S22: Add the input content to the historical input object queue, and the index number of the input content is the last index number in the historical input object queue + 1. The latest input content is added to the end of the historical input object queue, and the latest input content is assigned a corresponding index number according to the index number of the current historical input object queue. In the historical input object queue, the input content corresponding to the index number is arranged in chronological order, and each index number corresponds to a historical input content.

[0043] The local storage unit can directly store all input content for subsequent editing. In order to reduce the storage space of the local storage unit, in this embodiment, the historical input content saved by the local storage unit is the difference between the current version input content and the previous version input content. For example, the previous version input content is "The weather is so nice today", which is modified to "The weather is so nice" and recorded as the current version input content. The two versions are compared using the diff algorithm, and the difference data obtained is: the current version input content is less than the previous version input content. The two words "today" are located in the first 1 and the first 2 positions, then the information is saved in the historical input object queue of the local storage unit, and the index number is the last index number in the historical input object queue + 1.

[0044] Step S3: When receiving the undo command, select the input content from the local storage unit as the current editing data; and obtain the edited webpage text according to the current editing data. In the webpage text editing process, the undo command is an undo command triggered by a keyboard key (ctrl+z, ctrl+y) or a virtual undo key. Figure 3 As shown, in step S3, input content is selected from the local storage unit as the current editing data, specifically,

[0045] Step S31, acquiring a historical input object queue in a local storage unit according to the webpage URL, keywords, and input element features;

[0046] Step S32: read the historical input content according to the index number in the historical input object queue; select the required historical input content as the current editing data.

[0047] According to the current editing data, the edited webpage text is obtained, specifically, the index number of the current editing data is obtained, the historical input content is obtained, and the historical input content is overwritten to the input content of the input element. In this process, the historical input content can be the input content of the previous version, or the input content of the next version that has appeared in the editing process. The user can view the content that has been determined to be replied through the historical input object queue.

[0048] Step S4, obtain the index number in the historical input object queue in the local storage unit, and determine whether the index number exceeds the preset first threshold; when the index number exceeds the preset first threshold, clean up the historical input content in the historical input object queue in the local storage unit whose index number is less than the preset second threshold; and the preset first threshold is greater than the preset second threshold.

[0049] If the index number of the local storage unit is not less than the preset first threshold, it indicates that the current preset local storage unit length has reached the maximum value. At this time, the historical input content of the historical input object queue preset second threshold is deleted, and the index number of the storage unit after the preset second threshold in the queue to the end of the queue is reduced by the preset second threshold in sequence to facilitate subsequent editing.

[0050] The present invention provides a web page editing method, which monitors keyboard events in a web page, and when the input focus is obtained as an input element, monitors and saves the input event and input content through keyboard events. After receiving the undo command, the input content is selected from the local storage unit as the current editing data; according to the current editing data, the edited web page text is obtained, and the current web page text is conveniently and quickly restored to the historical version, avoiding the problem of data loss caused by user misoperation. In addition, the method supports the editing of any page, any form, and table data, saving repeated development and improving web page development efficiency.

[0051] Based on the same inventive concept, in addition, the present invention further provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the aforementioned web page editing method are implemented.

[0052] Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form, etc. Computer readable media may include: any entity or device capable of carrying computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in computer readable media can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer readable media do not include electric carrier signals and telecommunication signals.

[0053] The present invention can be used in many general or special computing system environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like.

[0054] Based on the same inventive concept, the present application also provides an electronic device, including a memory, a processor, and a program stored in the memory, wherein the program is configured to be executed by the processor, and the steps of the above-mentioned web page editing method are implemented when the processor executes the program.

[0055] The above-mentioned embodiments are only preferred embodiments of the present invention and cannot be used to limit the scope of protection of the present invention. Any non-substantial changes and substitutions made by technicians in this field on the basis of the present invention shall fall within the scope of protection required by the present invention.

Claims

1. A webpage editing method, characterized in that: The method comprises the following steps: Step S1, obtaining basic information of a web page, and monitoring keyboard events in the web page, wherein the basic information of the web page includes the web page URL, keywords, and input element features; the input element features include user ID, class, and tag; Step S2: upon receiving the instruction to edit the input element, obtaining the input event and the input content through keyboard event monitoring; and saving the input content to a local storage unit according to the basic information of the web page; Step S3: when a cancellation instruction is received, the input content is selected from the local storage unit as the current editing data; and the edited webpage text is obtained according to the current editing data; In step S2, the input content is saved to a local storage unit according to the basic information of the web page, specifically, Step S21, obtaining a historical input object queue according to the webpage URL, keywords, and input element features; the historical input object queue includes historical input element features, historical input content, and index numbers; each historical input content corresponds to an index number; Step S22: adding the input content to the historical input object queue, and the index number of the input content is the last index number in the historical input object queue + 1; In step S3, input content is selected from the local storage unit as the current editing data, specifically, Step S31, acquiring a historical input object queue in a local storage unit according to the webpage URL, keywords, and input element features; Step S32, reading the historical input content according to the index number in the historical input object queue; selecting the required historical input content as the current editing data; Step S4, obtain the index number in the historical input object queue in the local storage unit, and determine whether the index number exceeds the preset first threshold; when the index number exceeds the preset first threshold, clean up the historical input content in the historical input object queue in the local storage unit whose index number is less than the preset second threshold; and the preset first threshold is greater than the preset second threshold.

2. A webpage editing method as claimed in claim 1, characterized in that: In the step S3, the edited webpage text is obtained according to the current editing data, specifically, the index number of the current editing data is obtained, the historical input content is obtained, and the historical input content is overwritten into the input content of the input element.

3. A webpage editing method as claimed in claim 1, characterized in that: The undo instruction in step S3 is an undo instruction triggered by a keyboard key or a virtual undo key.

4. A webpage editing method as claimed in claim 1, characterized in that: The historical input content stored in the local storage unit is the difference between the current version input content and the previous version input content.

5. A device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the webpage editing method according to any one of claims 1 to 4 is implemented.

6. A storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed, the web page editing method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Page component editing method and device thereof

    CN106502700A

  • Webpage display method, and operation event recording method and apparatus

    CN106897347A

  • Webpage text editing method and device, computer equipment and storage medium

    CN111241791A