Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Examples:
Conventionally, in order for a user to review/edit a document in an application program of a terminal, it is necessary to download a related application program for processing a document format in the terminal to achieve review/editing of the document in the application program based on the related application program. For example, if a user wants to review/edit a document in an instant messaging application, the user needs to download a related application program for processing the format of the document in the terminal (for example, if the document is in a word format, a WPS application program for processing the word format needs to be downloaded in the terminal), so as to review/edit the document in the instant messaging application based on the WPS application program.
At present, the document in the application program of the terminal can be a web document based on the web document technology, the related application program for processing the document format is not required to be downloaded in the terminal like the traditional technology, the online viewing of the web document in the application program of the terminal can be realized, and the complexity of document viewing is reduced. However, although online viewing of the web page document can be realized at present, the complexity of the document viewing process is reduced, the document editing process is still complex, and online editing of the document cannot be realized.
Therefore, the embodiment of the invention provides a document editing method, a device, a terminal and a storage medium, so as to realize online editing of a webpage document and reduce the complexity of a document editing process.
As a preferred implementation of the embodiment of the invention, a toolbar can be generated based on a native program of an application program in a terminal, the toolbar can be called as a native toolbar, and online editing of the webpage document can be realized through interaction between the webpage document in the application program and the toolbar applied to the application program. If the web page document is generated based on the html5 technology, the web page document can also be called as an H5 document.
The following describes a method for editing a web document according to an embodiment of the present invention in detail, and refer to fig. 1 specifically.
The method for editing the webpage document shown in fig. 1 is applied to an application program in a terminal, and comprises the following steps:
s101, receiving a first operation executed on a webpage document displayed in a webpage view of an application program;
In the embodiment of the invention, a browser can be loaded in an application program of the terminal, the browser provides a webpage view, and a webpage document in the application program can be loaded and displayed in the webpage view. The user on the terminal side may perform an operation on the web document, and for convenience of distinction, the operation performed on the web document by the user is referred to as a first operation.
As a preferred implementation of the embodiment of the present invention, the first operation may be a text input operation, a text selection operation, a click operation, or the like. The foregoing is merely preferred content of the first operation provided in the embodiment of the present invention, and the inventor may set the preferred content of the first operation according to his own needs, which is not limited herein.
S102, acquiring environment information of a current webpage document, wherein the environment information comprises an operation position of a first operation on the webpage document and document format information of the webpage document at the operation position of the first operation;
as a preferred implementation of the embodiment of the invention, after the user performs the first operation on the web document, the environment information of the current web document may be acquired, where the environment information may include an operation position of the first operation on the web document and document format information of the web document at the operation position.
In the embodiment of the present invention, preferably, the document format information of the current web page document at the operation position of the first operation may be document format information of the cursor text of the current web page document.
The above is merely preferred content of the environmental information provided by the embodiment of the present invention, and specific content of the environmental information may be set by the inventor according to his own needs, which is not limited herein.
S103, determining whether to display a toolbar view in the application program according to the operation position of the first operation on the webpage document;
In the embodiment of the invention, if the operation position of the first operation on the webpage document is the title of the webpage document, the toolbar view is determined not to be displayed on the webpage document, and if the operation position of the first operation on the webpage document is the text of the webpage document, the toolbar view is determined to be displayed on the webpage document.
S104, if it is determined that the toolbar view is displayed in the application program, updating the document format indicated by the tool option in the toolbar generated based on the native program of the application program to the target document format indicated by the document format information to obtain a target toolbar, and displaying the toolbar view loaded with the target toolbar in the application program.
In the embodiment of the invention, if the toolbar view is determined to be displayed in the application program, the toolbar generated based on the native program of the application program can be determined, the toolbar comprises at least one tool option, the document format indicated by the tool option in the toolbar is updated to be the target document format indicated by the document format information, so that the target toolbar is obtained, and then the toolbar view loaded with the target toolbar is displayed in the application program.
FIG. 2 is a flowchart of another method for editing a web document according to an embodiment of the present invention. As shown in fig. 2, the method includes:
s201, monitoring a system keyboard display event, wherein the system keyboard display event is an operation event on a webpage document or an operation event for a first tool option when a keyboard view loaded with the system keyboard is not displayed in an application program;
in an embodiment of the present invention, the system keyboard display event may be a focus-generated event. As a preferred mode of the embodiment of the invention, the operation event executed on the webpage document can be regarded as a focus generation event, and the operation event of the first tool option on the toolbar can be regarded as a focus event when the keyboard view loaded with the system keyboard is not displayed in the application program.
Wherein the toolbar includes at least one tool option, the at least one tool option includes a first tool option, a second tool option and a third tool option. The number of the first tool options is one, the first tool options are related to a system keyboard, and the first tool options can be keyboard tool options. The number of the second tool options is at least one, the at least one second tool option can be at least related to a document format, the at least one second tool option comprises a font tool option and/or a list tool option, wherein the font tool option is used for carrying out font control on cursor texts in the webpage document, and the list tool option is used for carrying out list control on the cursor texts in the webpage document. The number of the third tool options is at least one, and the at least one third tool option can be a cancel tool option and/or a restore tool option.
Further, the toolbar provided in the embodiment of the present invention may further include a fourth tool option, where the number of the fourth tool options is at least one, and the fourth tool option may be a picture tool option, a forwarding tool option, an associated tool option, and so on. The picture tool option is used for inserting pictures into the webpage documents, the forwarding tool option is used for interaction between the webpage documents and the application programs, and the association tool option is also used for interaction between the webpage documents and the application programs and is mainly used for pushing the webpage documents to associated friends.
Forwarding tool options, such as when the application program is an instant messaging application program, a registered user of the instant messaging application program forwards the web page document to a friend user of the registered user in the instant messaging application program, or issues the web page document to a shared space (such as a friend circle) of the instant messaging application program, so that the friend user of the registered user in the instant messaging application program can view the web page document through the shared space.
And associating tool options, such as when the application program is an instant messaging application program, the registered user of the instant messaging application program associates with the friend user to remind the friend user to view the webpage document.
In the embodiment of the invention, when a tool view of a non-first tool option is displayed in an application program, but a keyboard view loaded with a system keyboard is not displayed, an operation event of the first tool option on a toolbar can be regarded as a focus event. Wherein the second tool option, the third tool option, and the fourth tool option may all be considered as non-first tool options.
S202, receiving a first operation executed on a webpage document displayed in a webpage view of an application program;
s203, displaying a keyboard view loaded with a system keyboard in an application program;
In the embodiment of the invention, the received first operation is an operation event on the webpage document, so that a keyboard view can be displayed in an application program after the first operation is received, and a system keyboard is loaded in the keyboard view.
S204, acquiring environment information of the current webpage document, wherein the environment information comprises an operation position of a first operation on the webpage document and document format information of the webpage document at the operation position of the first operation;
in the embodiment of the invention, after the first operation is received, the environment information of the current webpage document can be acquired, wherein the environment information comprises the operation position of the first operation on the webpage document and the document format information of the webpage document at the operation position of the first operation.
The environment information may further include third option state information, wherein the third option state information is used for indicating a first target state of the tool option being withdrawn, the first target state being an enabled state or a disabled state if the third tool option is the tool option being withdrawn, the third option state information is used for indicating a second target state of the tool option being recovered, the second target state being an enabled state or a disabled state if the third tool option is the tool option being recovered, and the third option state information is used for indicating a first target state of the tool option being withdrawn and a second target state of the tool option being recovered if the third tool option is the tool option being withdrawn and the tool option being recovered, the first target state being an enabled state or a disabled state, the second target state being an enabled state or a disabled state. Wherein the enable state characterization tool option is available and the disable state characterization tool option is not available.
S205, determining whether to display a toolbar view in the application program according to the operation position of the first operation on the webpage document;
S206, if the toolbar view is determined to be displayed in the application program, the toolbar generated based on the native program of the application program is determined, the state of the first tool option in the toolbar is updated based on the display state of the keyboard view in the application program, and the document format indicated by the second tool option in the toolbar is updated to be the target document format indicated by the document format information, so that the target toolbar is obtained;
In the embodiment of the present invention, preferably, the display state of the keyboard view in the application program is displayed/not displayed, if the current keyboard view is not displayed in the application program, the state of the first tool option in the update toolbar is an undeployed state, and if the current keyboard view is displayed in the application program, the state of the first tool option in the update toolbar is a deployed state.
Further, if the toolbar further includes a third tool option, after determining the toolbar generated based on the native program of the application program, the state of the first tool option in the toolbar may be updated based on the display state of the keyboard view in the application program, the document format indicated by the second tool option in the toolbar may be updated to the target document format indicated by the document format information, and the state of the third tool option in the toolbar may be updated to the target state indicated by the third option state information, so as to obtain the target toolbar.
For example, if the third option status information is used to indicate the first target status of the tool option to be withdrawn, and the first target status is the disabled status, the status of the tool option withdrawn in the toolbar is updated to be the disabled status.
S207, displaying a toolbar view loaded with a target toolbar in an application program;
S208, acquiring operation information of a second operation executed on the target tool option of the target tool bar;
in the embodiment of the present invention, preferably, when the toolbar view is displayed in the application program, the toolbar view is loaded with a target toolbar, the target toolbar includes at least one tool option, the user can execute the second operation on the tool options in the toolbar, and for convenience of distinction, the tool option for which the user executes the second operation on the tool bar is temporarily referred to as a target tool option. Upon receiving a second operation performed on the target tool option of the target toolbar, operation information of the second operation may be acquired.
In the embodiment of the present invention, the second operation may be a clicking operation, and the target tool option may be a tool option or a sub-tool option in the tool options.
As a preferred implementation manner of the embodiment of the present invention, when the tool option is the first tool option, the operation information of the second operation performed by the user on the first tool option is opposite to the state of the first tool option in the toolbar displayed in step S207. For example, if the status of the first tool option in the toolbar displayed in step S207 is in the expanded state, the acquired operation information of the second operation indicates the unexpanded state, and if the status of the first tool option in the toolbar displayed in step S207 is in the unexpanded state, the acquired operation information of the second operation indicates the expanded state.
When the tool option is the second tool option, at least one sub tool option can be displayed in the tool view of the tool option, the sub tool option operated by the user in the at least one sub tool option based on the second operation can be taken as the target tool option, and the option information of the target tool option is regarded as the operation information of the second operation on the target tool option. Wherein the option information of the target tool option may characterize whether the target tool option is selected or not, or the option information of the target tool option may further characterize a parameter value set by the user for the target tool option. For example, the user sets the parameter value for the "word size sub tool option" which is the target tool option to "14".
As a preferred implementation manner of the embodiment of the invention, when the third tool option is the cancel tool option, if the state of the current cancel tool option is the enabling state, the user indicates the cancel operation based on the operation information of the second operation in the cancel tool option, and when the third tool option is the restore tool option, if the state of the current restore tool option is the enabling state, the user indicates the restore operation based on the operation information of the second operation in the restore tool option. The operation of the revocation is used for indicating the operation of the revocation history on the webpage document last time, and the operation of the recovery is used for indicating the operation of the revocation history on the webpage document last time.
As a preferred implementation manner of the embodiment of the present invention, if the fourth tool option is a picture tool option, the user may select a picture to be inserted into the web document for the user based on the operation information of the second operation in the picture tool option.
As a preferred implementation manner of the embodiment of the present invention, if the fourth tool option is a forwarding tool option, the user may select the operation information of the forwarding tool option based on the second operation as the document receiver for receiving the web document, and the document receiver may be a friend or a shared space.
As a preferred implementation manner of the embodiment of the present invention, if the fourth tool option is an associated tool option, the user may select a friend to be associated for the user based on the operation information of the second operation on the associated tool option. For example, the user selects friends to be @.
S209, searching a preset corresponding relation between tool options and interfaces, and acquiring a target interface corresponding to the target tool option;
In the embodiment of the invention, the corresponding relation between the tool options and the interfaces is preset, the interfaces corresponding to the target tool options are searched for, and the searched interfaces are called target interfaces temporarily for the convenience of distinguishing.
The preset interface is provided by H5, and the call interface can realize the processing of the H5 webpage document.
S210, calling a target interface for injecting operation information to operate the webpage document.
In the embodiment of the invention, after the operation information is injected into the target interface, the operation on the webpage document can be realized by calling the target interface.
As a preferred implementation manner of the embodiment of the present invention, when the target tool option is the first tool option and the obtained operation information of the second operation indicates the expanded state, after the operation information is injected into the interface corresponding to the first tool option, the interface is invoked to control the keyboard view to be displayed in the web document.
As a preferred implementation manner of the embodiment of the present invention, the target tool option is a first tool option, and when the obtained operation information of the second operation indicates the undeployed state, the interface is called after the operation information is injected into the interface corresponding to the first tool option, so as to hide the keyboard view and the toolbar view.
As a preferred implementation manner of the embodiment of the present invention, when the tool option is the second tool option, at least one sub-tool option may be displayed in the tool view of the tool option, the sub-tool option operated by the user in the at least one sub-tool option of the target tool option based on the second operation may be considered as the target tool option, and the option information of the target tool option may be considered as the operation information of the second operation on the target tool option.
For example, when the second tool option is a text tool option, the text tool option may include a bold sub-tool option, an italic sub-tool option, a slide-down line sub-tool option and a word size sub-tool option, wherein the sub-tool option operated by the user through the second operation is used as a target tool option, if the target tool option is an "italic sub-tool option" and a "word size sub-tool option", the option information of the "italic sub-tool option" indicates whether the current "italic sub-tool option" is selected, and the option information of the "word size sub-tool option" indicates a parameter value set by the user for the "word size sub-tool option", that is, a word size set by the user for the "word size sub-tool option". The method comprises the steps of injecting option information of a word size sub-tool option into an interface corresponding to the word size sub-tool option as operation information, calling the interface, if the option information of the word size sub-tool option represents that a parameter value set by a user for the word size sub-tool option is 14 numbers, modifying the word size of cursor texts in a webpage document into the 14 numbers, injecting option information of an italic sub-tool option as operation information into the interface corresponding to the italic sub-tool option, calling the interface, and if the option information of the italic sub-tool option represents that the current italic sub-tool option is selected, setting the cursor texts in the webpage document into italics.
As a preferred implementation manner of the embodiment of the invention, when the target tool option is the undo tool option, the user indicates the undo operation in the operation information of the undo tool option based on the second operation, the operation information is injected into the interface corresponding to the undo tool option, and the operation undo operation of the interface undo history on the webpage document is invoked.
As a preferred implementation manner of the embodiment of the invention, when the target tool option is a recovery tool option, the user indicates a recovery operation based on the operation information of the second operation in the recovery tool option, injects the operation information into an interface corresponding to the recovery tool option, and invokes the operation of the interface recovery history for the last revocation of the webpage document.
As a preferred implementation manner of the embodiment of the invention, the target tool option is a picture tool option, and the user can select a picture to be inserted into the webpage document based on the operation information of the second operation in the picture tool option, and the picture is injected into an interface corresponding to the picture tool option, and the interface is called to insert the picture into the webpage document.
As a preferred implementation manner of the embodiment of the invention, the target tool option is a forwarding tool option, the operation information of the forwarding tool option based on the second operation by the user can be a document receiver which is selected by the user and used for receiving the webpage document, the operation information is injected into an interface corresponding to the forwarding tool option, and the interface is called to send the webpage document to the document receiver.
As a preferred implementation manner of the embodiment of the invention, the target tool option is an associated tool option, the operation information of the user on the basis of the second operation on the associated tool option can be a friend to be processed by the user, the operation information is injected into an interface corresponding to the associated tool option, the interface is called, and the friend to be processed is prompted to view the webpage document.
According to the webpage document editing method provided by the embodiment of the invention, the toolbar of the remote program based on the application program can realize online editing of the webpage document, so that the complexity of webpage document editing is reduced.
The webpage document editing method provided by the embodiment of the invention is applied to an application program, the application program provides the webpage document based on the HTML, the application program can load a browser, the browser provides a webpage view, and the webpage view can load the webpage document so as to realize the viewing and editing of the webpage document. Specifically, interaction between the webpage document and the toolbar generated by the native program based on the application program can be realized based on interaction between the webpage document and the document editing tool, so that online editing of the webpage document is realized. Wherein the document editing tool is also generated based on the native program of the application.
As a preferred implementation mode of the embodiment of the invention, because the webpage document is realized based on HTML, and the document editing tool is realized based on the native program of the application program, interaction between the webpage document and the document editing tool cannot be realized directly, and therefore, the embodiment of the invention also provides an interaction mechanism of the webpage document and the document editing tool so as to provide technical support for online editing of the webpage document. The interaction mechanism of the webpage document and the document editing tool provided by the embodiment of the invention is described in detail from the viewpoint of webpage document editing.
Fig. 3 is a schematic diagram of a method for editing a web document according to an embodiment of the present invention. The web document editing method as shown in fig. 3 is applied to a front end and a middle end, wherein a browser in an application program can be regarded as the front end, and a document editing tool in the application program can be regarded as the middle end, and the method comprises:
s301, monitoring a system keyboard display event by a document editing tool, wherein the system keyboard display event is an operation event on a webpage document or an operation event for a first tool option when a keyboard view loaded with the system keyboard is not displayed in an application program;
In the embodiment of the invention, the terminal can monitor the system keyboard display event and report the system keyboard display event to the document editing tool applied to the application program after the system keyboard display event is monitored, so that the document editing tool can control the display of a keyboard view in the application program after receiving the system keyboard display event, and the system keyboard is loaded in the keyboard view.
S302, the browser receives a first operation executed on a webpage document displayed in a webpage view of an application program;
in the embodiment of the invention, the terminal can monitor the first operation executed by the user on the webpage document displayed in the webpage view of the application program and further execute the step S303, and the browser can also receive the first operation executed by the user on the webpage document displayed in the webpage view of the application program and further execute the step S304.
S303, controlling the document editing tool to display a keyboard view loaded with a system keyboard in an application program;
s304, the browser acquires environment information of the current webpage document, wherein the environment information comprises an operation position of a first operation on the webpage document and document format information of the webpage document at the operation position of the first operation;
s305, the browser sends the environment information to the JS layer;
in the embodiment of the invention, after the browser acquires the environment information, the browser cannot directly transmit the environment information to the document editing tool, but transmits the environment information to the JS layer.
As a preferred implementation of the embodiment of the invention, the JS layer can be regarded as a middle layer, and interaction between a browser and a document editing tool in an application program can be realized based on the JS layer. Wherein the JS layer may be considered a javascript layer.
In the embodiment of the present invention, preferably, after receiving the first operation performed on the web document displayed in the web page view of the application program, the browser may acquire the environmental information of the current web page document.
The method for obtaining the environment information of the current webpage document according to the embodiment of the invention can be used for obtaining a preset set of signaling, wherein the set of signaling comprises at least one signaling, for each signaling, a signaling value of the signaling is obtained from the current webpage document, and then a target signaling is obtained, based on the signaling value, for each signaling in the set of signaling, at least one target signaling is obtained, and the obtained at least one target signaling can be regarded as the environment information obtained from the current webpage document.
In this embodiment, the browser may call the native method to obtain the environmental information of the current web document. Wherein at least one target signaling is as follows:
the device comprises a body, a cursor text, a text detection unit and a text detection unit, wherein the body is a signaling, the body is a signaling value of the body, and the body represents that the cursor text is in a thickened state;
italic, ' false ', wherein italic is signaling, false ' is a signaling value of italic, italic, ' false ' indicates that the cursor text is not in an inclined state, italic ' italic ' indicates that the cursor text is in an inclined state;
underline: 'u'; wherein underline is signaling, u is a signaling value of underline, underline: 'u' indicates that the cursor text is underlined, underline: "indicates that the cursor text is not underlined;
The method comprises the steps of (1) determining a strike, wherein the strike is signaling, the strike is a signaling value of the strike signaling, and the strike represents that a cursor text has a deletion line;
size is '24', wherein size is signaling, size is signaling value of 24, size is '24' representing word size of cursor text is 24;
color #000000', wherein color is signaling, color #000000' is signaling value of color, color #000000' represents color corresponding to color #000000 of cursor text;
The list is 'false'// 'ordered'///'bullet', wherein the list is signaling, the list is 'false' which indicates that the cursor text has neither a serial number nor a bulletin, the list is 'ordered' which indicates that the cursor text has a serial number, and the list is 'bullet' which indicates that the cursor text has a bulletin;
the task-list is characterized in that the cursor text is in a to-do format, the cursor text is in the to-do format to indicate that the to-do task exists in the cursor text, and the cursor text is in the non-to-do format to indicate that the to-do task does not exist in the cursor text;
align: 'left'// 'center'// 'right'; wherein align is signaling, align: 'left' indicates left alignment of cursor text, align: 'center' indicates center of cursor text, align: 'right' indicates right alignment of cursor text;
The device comprises an und, a true, a false and a false, wherein undo is a signaling, the true is a signaling value of the und signaling, and the und represents that a revocation tool option is in a starting state;
The method comprises the steps of carrying out a reset, wherein the reset is a signaling, the false is a signaling value of the reset signaling, and the false represents that a recovery tool option is in a disabled state;
hideToolbar, ' false ', hideToolbar is a signaling, false ' is a signaling value of hideToolbar signaling, hideToolbar ' false ' indicates that the operation position of the first operation is located in the text of the web document, and hideToolbar ' true ' indicates that the operation position of the first operation is located in the title of the web document.
The above is merely preferred contents of a set of signaling provided by the embodiment of the present invention, and the inventor regarding preferred contents of signaling in a set of signaling may set according to his own needs, which is not limited herein.
S306, the JS layer stores environment information;
in the embodiment of the invention, after the JS layer receives the environment information, the environment information can be stored in the queue.
S307, the browser sends a specific network request;
In the embodiment of the invention, the network request sent by the browser can be captured by the document editing tool, and after a specific network request sent by the browser is received by the document editing tool, the specific network request is used for triggering the document editing tool to execute the environment information acquisition function provided by the JS layer, for example, qmailbridge.
In an embodiment of the invention, web documents may accumulate operations and send a particular web request using schame, where the particular web request is qqmailapijs:// dispatch_message/.
The above environmental information obtaining function and specific network request are preferred contents provided by the embodiments of the present invention, and the inventor can set the preferred contents of the environmental information obtaining function and specific network request according to his own needs, which is not limited herein.
S308, capturing a specific network request by a document editing tool;
s309, calling a preset environment information acquisition function by a document editing tool, and requesting to acquire environment information from a JS layer;
s310, acquiring environmental information by a document editing tool;
S311, the document editing tool determines whether to display a toolbar view in the application program according to the operation position of the first operation on the webpage document;
s312, if the document editing tool determines that the toolbar view is displayed in the application program, determining a toolbar generated based on the native program of the application program, updating the state of a first tool option in the toolbar based on the display state of the keyboard view in the application program, and updating the document format indicated by a second tool option in the toolbar into a target document format indicated by the document format information to obtain a target toolbar;
s313, controlling the document editing tool to display a toolbar view loaded with a target toolbar in the application program;
S314, the document editing tool acquires operation information of a second operation executed on the target tool option of the target tool bar;
in the embodiment of the invention, after the document editing tool control displays the toolbar view loaded with the target toolbar in the application program, the document editing tool control can also receive a second operation executed by the user on the target tool options in the target toolbar and acquire operation information of the second operation.
S315, searching a preset corresponding relation between tool options and interfaces by the document editing tool, and acquiring a target interface corresponding to the target tool option;
in the embodiment of the invention, H5 provides a group of API interfaces, and after the native directly injects operation information into the API interfaces, the API interfaces are called to execute the operation webpage document.
If the tool options include at least one sub-tool option, the interface corresponding to the sub-tool option is preset for each sub-tool option.
For example, the wedocs. Toggle format (") is a preset interface corresponding to the" thickening "sub-tool option, and if the operation result obtained by performing the second operation on the" thickening "sub-tool option is" bold ", the" bold "is injected into the wedocs. Toggle format (") to obtain the wedocs. Toggle format ('bold'), and the wedocs. Toggle format ('bold') is called to thicken the cursor text of the web document.
And if the operation result obtained by executing the second operation on the sub tool option of the italic is italic, injecting italic into the Wedocs. Toggling Format (") to obtain the Wedocs. Toggling Format ('italic'), and calling the Wedocs. Toggling Format ('italic') to italize the cursor text of the webpage document.
S316, the document editing tool calls a target interface for injecting operation information to operate the webpage document.
Further, referring to steps S317-S319, the document editing tool may also implement control of the keyboard view and toolbar view.
S317, monitoring a system keyboard vanishing event by the document editing tool, wherein the system keyboard vanishing event is a first operation event for a first tool option when a keyboard view is displayed in an application program or a second operation event for a second tool option when the keyboard view is displayed in the application program;
In the embodiment of the invention, when the system keyboard view is displayed in the application program, the operation event of the first tool option in the tool bar can be regarded as a first operation event, and the operation event of the second tool option in the tool bar can be regarded as a second operation event. The operation event for the first tool option in the tool bar may be a click event, and the operation event for the second tool option in the tool bar may be a click event.
S318, if the document editing tool monitors a first operation event, hiding a keyboard view and a toolbar view in the application program;
In the embodiment of the invention, the terminal system can monitor the first operation event and the second operation event, report the monitored first operation event and second operation event to the document editing tool, and if the document editing tool receives the first operation event, control to hide the keyboard view and the toolbar view in the application program.
S319, if the document editing tool monitors a second operation event, hiding a keyboard view in the application program and displaying a tool view of a second tool option in the application program;
In an embodiment of the invention, the document editing tool receives the second operation event, controls hiding the keyboard view in the application program and displays the tool view of the second tool option operated by the second operation event in the application program.
S320, if the tool view of the second tool option includes the target sub-tool option, receiving a trigger operation to the target sub-tool option, hiding the tool view of the second tool option in the application program, and displaying the keyboard view.
In the embodiment of the invention, the second tool option comprises at least one sub-tool option, one or more sub-tool options can be determined from the at least one sub-tool option in advance, and the determined sub-tool option is taken as a target sub-tool option. The first sub-tool option for list control of cursor text in the webpage document can be regarded as a target sub-tool option, and the second sub-tool option for title setting of cursor text in the webpage document can be regarded as a target sub-tool option. The number of the first sub-tool options can be one or more, and the number of the second sub-tool options can be one or more.
As a preferred implementation of the embodiment of the present invention, if the tool view of the second tool option includes the target sub-tool option, if the user performs a triggering operation on the target sub-tool option, the document editing tool may hide the tool view of the second tool option displayed in the application program and display the keyboard view in the application program in response to the triggering operation.
In order to facilitate understanding of a webpage document editing method provided by the embodiment of the present invention, a schematic diagram of a webpage document editing method is provided, and based on the schematic diagram of the webpage document editing method, an application scenario of the webpage document editing method provided by the embodiment of the present invention may be described in detail.
Fig. 4 (a) is a file creation interface loaded in a web view of a browser of a terminal, a user clicks on "new document" or "+" in fig. 4 (a) to display a document selection interface shown in fig. 4 (b) in the web view, the user can select to create "document" or "table", if the user clicks on confirm after selecting to create "document", the document interface shown in fig. 4 (c) is displayed in the web view in a loading manner, and the document is composed of a title and a body. Referring to fig. 4 (d), if the cursor is at the title of the document, the system keyboard is displayed, and referring to fig. 4 (e), if the cursor is at the body of the document, the system keyboard and toolbar are displayed, the toolbar including a plurality of tool options, in turn, keyboard tool option, font tool option, list tool option, picture tool option, undo tool option and resume tool option.
The method comprises the steps of displaying a picture in a webpage text to be inserted in the picture list, displaying a picture in the webpage text to be inserted in the webpage text if a user clicks a font tool option, displaying a picture in the webpage view if a user clicks a list tool option, displaying a picture in the webpage view 4 (g) if a user clicks a list tool option, displaying the picture in the picture list in a terminal if the user clicks a picture tool option, withdrawing the last operation of the history on the webpage text if the user clicks a withdraw tool option, and recovering the last operation of the history on the webpage document if the user clicks a recover tool option. Further, the toolbar may further include an association tool option and a forwarding tool option, which are not described herein.
Further, the interface shown in fig. 4 (e) is displayed if the keyboard tool option shown in fig. 4 (f) is clicked, the interface shown in fig. 4 (e) is displayed if the keyboard tool option shown in fig. 4 (g) is clicked, and the interface shown in fig. 4 (h) is displayed if the keyboard tool option is clicked in the interface shown in fig. 4 (e).
Further, the interface shown in fig. 4 (e) is displayed when any one of the first sub-tool options shown in fig. 4 (f) is clicked, and the interface shown in fig. 4 (e) is displayed when any one of the second sub-tool options shown in fig. 4 (g) is clicked. It should be noted that, the interface shown in fig. 4 (e) herein mainly refers to a keyboard view. Further, when clicking the first sub-tool option/the second sub-tool option, the format of the cursor text in the interface shown in fig. 4 (e) is also modified to a format corresponding to the clicked first sub-tool option/second sub-tool option. For example, when "large title" in the first sub-tool option is clicked, an interface as shown in fig. 4 (e) is displayed, and further, the text format of the cursor text in the interface as shown in fig. 4 (e) is the text format indicated by "large title".
According to the embodiment of the invention, through the interaction between the document editing tool and the webpage document, the interaction between the webpage document and the toolbar can be realized, so that the online editing of the webpage document is realized, and the complexity of editing the webpage document is reduced.
Fig. 5 is a schematic structural diagram of a device for editing a web document according to an embodiment of the present invention.
As shown in fig. 5, the web page editing apparatus includes:
A first receiving unit 501 for receiving a first operation performed on a web document displayed in a web view of an application program;
A first obtaining unit 502, configured to obtain environmental information of a current web document, where the environmental information includes an operation position of a first operation on the web document and document format information of the web document at the operation position of the first operation;
a toolbar view determining unit 503 for determining whether to display a toolbar view in the application program according to an operation position of the first operation on the web document;
A first updating unit 504, configured to update, if it is determined that the toolbar view is displayed in the application program, the document format indicated by the tool option in the toolbar generated based on the native program of the application program to the target document format indicated by the document format information, to obtain a target toolbar, and display, in the application program, the toolbar view loaded with the target toolbar.
The specific principle and execution process of each unit in the webpage document editing device disclosed in the embodiment of the present invention are the same as those of the webpage document editing method disclosed in the embodiment of the present invention, and may refer to the corresponding parts in the webpage document editing method disclosed in the embodiment of the present invention, and will not be described in detail here.
In the embodiment of the invention, if the toolbar view is determined to be displayed in the application program, the toolbar generated based on the native program of the application program can be determined, the toolbar comprises at least one tool option, the document format indicated by the tool option in the toolbar is updated to be the target document format indicated by the document format information, so that the target toolbar is obtained, and then the toolbar view loaded with the target toolbar is displayed in the application program.
Preferably, the web document editing apparatus 500 further includes:
a second acquisition unit configured to acquire operation information of a second operation performed on a target tool option of a target toolbar;
The third acquisition unit is used for searching the corresponding relation between the preset tool options and interfaces and acquiring the target interfaces corresponding to the target tool options;
and the calling unit is used for calling the target interface for injecting the operation information to operate the webpage document.
In the embodiment of the invention, the toolbar of the remote program based on the application program can realize online editing of the webpage document, thereby reducing the complexity of editing the webpage document.
Preferably, the toolbar includes a first tool option, and the first tool option is related to a system keyboard, and the web document editing apparatus 500 further includes:
The system comprises a first monitoring unit, a first tool option and a second monitoring unit, wherein the first monitoring unit is used for monitoring a system keyboard display event, and the system keyboard display event is an operation event on a webpage document or an operation event for a first tool option when a keyboard view loaded with the system keyboard is not displayed in an application program;
And the first display unit is used for displaying a keyboard view in the application program if the system keyboard display event is monitored.
Preferably, the toolbar further includes a second tool option different from the first tool option, and the web document editing apparatus 500 further includes:
The system keyboard vanishing event is a first operation event for a first tool option when a keyboard view is displayed in the application program or a second operation event for a second tool option when the keyboard view is displayed in the application program;
It should be noted that, if the first operation event is detected, the hiding unit is executed, and if the second operation event is detected, the second display unit is executed.
A hiding unit for hiding the keyboard view and the toolbar view in the application program;
And the second display unit is used for hiding the keyboard view in the application program and displaying the tool view of the second tool option in the application program.
Preferably, the tool view of the second tool option comprises a target sub-tool option, wherein the target sub-tool option comprises a first sub-tool option for performing list control on cursor text in a webpage document and/or a second sub-tool option for performing title control on the cursor text in the webpage document, and the webpage document editing device 500 further comprises:
And the second receiving unit is used for receiving the triggering operation of the target sub-tool options, hiding the tool view of the second tool options in the application program and displaying the keyboard view.
Preferably, the tool view further includes a third tool option different from the first tool option and the second tool option, and the web document editing apparatus 500 further includes:
and the second updating unit is used for updating the state of the third option in the toolbar to the target state indicated by the state information of the third option in the environment information when the toolbar view is displayed in the application program.
Preferably, the toolbar view determining unit 503 includes a non-display unit and a third display unit.
A non-display unit, configured to determine not to display the toolbar view in the application program if the operation position of the first operation on the web document is the title of the web document;
and the third display unit is used for determining to display the toolbar view in the application program if the operation position of the first operation on the webpage document is the text of the webpage document.
The webpage document editing method provided by the embodiment of the invention is explained in detail above, and the webpage document editing method provided by the embodiment of the invention is introduced from the perspective of a terminal.
For easy understanding, a terminal to which the method for editing a web document according to the embodiment of the present invention is applicable will be described in detail, with reference to fig. 6.
The terminal may comprise a processor 601, a memory 602, a communication interface 603, an input unit 604 and a display 605 and a communication bus 606 as shown in fig. 6.
The memory 602 is used to store one or more programs, and the programs may include program code, including computer operation instructions, and in an embodiment of the present invention, at least the programs for implementing the following functions are stored in the memory:
receiving a first operation performed on a web document displayed in a web page view of an application program;
Acquiring environment information of a current webpage document, wherein the environment information comprises an operation position of a first operation on the webpage document and document format information of the webpage document at the operation position of the first operation;
Determining whether to display a toolbar view in the application program according to an operation position of the first operation on the webpage document;
If it is determined that the toolbar view is displayed in the application program, updating the document format indicated by the tool option in the toolbar generated based on the native program of the application program to the target document format indicated by the document format information to obtain a target toolbar, and displaying the toolbar view loaded with the target toolbar in the application program.
Alternatively, the refinement function and the extension function of the program can be described with reference to the following.
The processor 601, the memory 602, the communication interface 603, the input unit 604, the display 605 all perform communication with each other via the communication bus 606.
In an embodiment of the present invention, the processor 601 may be a central processing unit (Central Processing Unit, CPU), an application-specific integrated circuit (ASIC), a Digital Signal Processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic device, etc.
The processor may call and execute programs stored in memory 602.
The communication interface 603 may be an interface of a communication module, such as an interface of a GSM module.
The present invention may also include an input unit 604, which may include a touch sensing unit that senses touch events on a touch display panel, a keyboard, and the like.
The display 605 includes a display panel such as a touch display panel or the like. In one possible case, the display panel may be configured in the form of a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), an Organic Light-Emitting Diode (OLED), or the like.
Of course, the terminal structure shown in fig. 6 is not limited to the terminal in the embodiment of the present invention, and the terminal may include more or less components than those shown in fig. 6 or may combine some components in practical applications.
Further, an embodiment of the present invention also provides a computer-readable storage medium, in which computer-executable instructions for executing the above-described web document editing method are stored.
Alternatively, the refinement and expansion functions of the computer-executable instructions may be described with reference to the foregoing.
The embodiment of the invention provides a webpage document editing method, a device, a terminal and a storage medium, which are used for receiving a first operation executed on a webpage document displayed in a webpage view of an application program, acquiring environment information of the current webpage document, determining whether a toolbar view is displayed in the application program according to the environment information, updating a document format indicated by a tool option in a toolbar generated based on a native program of the application program to a target document format indicated by the environment information if the toolbar view is determined to be displayed in the application program, obtaining a target toolbar, and displaying the toolbar view loaded with the target toolbar in the application program so as to realize online editing of the webpage document based on interaction of the toolbar and the webpage document, thereby reducing complexity of document editing.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
In the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, and identical and similar parts between the embodiments are all enough to refer to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.