Detailed Description
The scheme provided by the specification is described below with reference to the accompanying drawings.
Fig. 1 is a schematic diagram of an application scenario of a method for displaying annotations in an online document provided in this specification. In fig. 1, the browser may receive a document opening instruction of a user. And acquiring the document content of the online document to be opened from the database through the corresponding background server according to the document opening instruction. The online document may be written in HyperText Markup Language (html). After the document content is obtained, it may be determined whether the document content includes a custom annotation tag (described later). And if the user-defined annotation tag is contained, acquiring the tag content of the user-defined annotation tag and the attribute value of the identification attribute. And determining the annotation mark of the annotation content corresponding to the annotation object according to the attribute value of the mark attribute. And acquiring annotation content from the database through the background server according to the annotation identification. And finally, displaying the annotation object and other contents except the annotation object in the document contents in a distinguishing manner, and displaying the annotation contents at the corresponding position of the annotation object.
Before describing the method for displaying the annotation in the online document provided by one or more embodiments of the present specification, a method for implementing the annotation and the annotation reply in the online document may be described.
Fig. 2 is an information interaction diagram for implementing annotation in an online document provided in the present specification. As shown in fig. 2, the method may specifically include:
step 202, a new annotation instruction for an annotation object in the original document content is received.
The original document content herein may refer to the document content of the online document to which annotations are to be added. The annotation object may refer to the content of the document selected by the user in the online document, such as selected words, characters, or tables, etc. In one example, the browser can automatically present a button to add annotation content after the user has selected the annotation object in the online document. When the user clicks the button, the browser can receive the new annotation command.
Of course, in practical applications, the button for adding the annotation content may not be dynamically displayed, for example, statically displayed in a menu bar at the top of the online document, which is not limited in this specification. In addition, the new annotation command can be triggered by other means, for example, a fixed combination key pressed by a user can be triggered.
And step 204, displaying the annotation content editing window according to the newly-created annotation instruction.
In one implementation, the annotation content editing window can be presented in a blank area on the right side of the online document. Specifically, the user can input corresponding annotation content through the annotation content editing window. In addition, the comment content editing window can be further provided with a submit button. After the user enters the corresponding annotation content, the submit button can be clicked to submit.
Of course, in practical applications, the annotation content editing window can be displayed in other positions, such as a blank area on the left side of the online document. In addition, the comment content editing window may not be provided with a submit button, and after the user inputs corresponding comment content, the comment content can be submitted by pressing a fixed combination key, which is not limited in this specification.
And step 206, acquiring annotation content corresponding to the annotation object input through the annotation content editing window.
For example, the annotation content may be obtained when a click instruction of the user on the submit button is received.
In step 208, an annotation identification of the annotation content is generated.
Specifically, the annotation identifier of the annotation content may be generated by a background server corresponding to the browser.
Step 210, recording the corresponding relation between the annotation mark and the annotation content.
Similarly, the corresponding relationship between the annotation identifier and the annotation content may be recorded by the background server. In one implementation, the correspondence may be as shown in table 1.
TABLE 1
In table 1, not only the annotation mark and the annotation content, but also the annotation object, the annotation creator, the annotation creation time, and other information are recorded. It will be appreciated that after assigning values to the various fields in table 1, a complete piece of annotation data is obtained. When there are a plurality of pieces of annotation data, the plurality of pieces of annotation data are distinguished by the annotation marks.
It should be understood that the contents of table 1 are for exemplary purposes only, and the present description is in no way limited to the contents explicitly shown in the table.
And 212, embedding the annotation object serving as the label content of the self-defined annotation label into the self-defined annotation label.
The customized annotation labels herein can refer to: < review > </review >. Wherein < review > may be referred to as a start tag and </review > may be referred to as an end tag. The text contained between the start tag and the end tag may be referred to as tag content (context). It is to be understood that the embedding of the annotation object into the custom annotation tag described above can refer to the inclusion of the annotation object between the start tag and the end tag.
And 214, determining the attribute value of the identification attribute of the self-defined annotation label according to the annotation identification.
It should be noted that the customized annotation tag may have tag attributes, such as an identification attribute (id) and a style attribute (style). The identification attribute is used for defining annotation identification of the annotation content. The style attribute is used to define the presentation style of the annotation object. The above-mentioned tag attributes may be included in the start tag. Step 214 may specifically be to assign the annotation identifier generated in step 208 to the identifier attribute.
Step 216, updating the embedded tag content and the customized annotation tag with the determined attribute value of the identification attribute into the original document content, thereby obtaining the updated document content.
For example, assume that the original document content is: "value of innovation to society"; the annotation objects are: "society". Then the updated document content may be: "innovative value for < reviewid ═ 201803120002" style ═ background-color: # f8eb69 "> society </review >. It is understood that the value of id can be randomly generated information that can uniquely identify a piece of annotation content. The style value defines the display style of the annotation object, namely, the annotation object is added with a background color to realize highlighting. Other presentation styles of the annotation object can be defined by modifying the attribute value of the style, for example, the font of the annotation object can be defined as an artistic font, and the like, which is not limited in this specification.
At step 218, the document contents are stored in a database.
It should be noted that, the steps 214, 216 and 218 may be executed by a background server corresponding to the browser.
Step 220, the updated document content is presented to the user.
It should be noted that, for the updated document content, since the style attribute of the annotation object is defined in the customized annotation tag, the annotation object can be presented according to the attribute value of the style attribute. For example, a background color may be added to the annotation object to achieve a highlight. In addition, an annotation frame can be added at the corresponding position of the annotation object, and annotation content is displayed in the annotation frame. The annotation frame may be located in a right blank area of the online document and have the same height as the annotation object. Of course, in practical applications, the annotation frame may also be located in the left blank area or a height difference between the annotation frame and the annotation object is a preset threshold, and the like, which is not limited in this specification.
It can be understood that, through the above steps, corresponding annotation contents can be added to a plurality of annotation objects in the same online document.
Fig. 3 is an information interaction diagram for implementing annotation reply in an online document provided in this specification. As shown in fig. 3, the method may specifically include:
step 302, a reply instruction for the annotation content is received.
And the user can reply to any annotation content for the updated document content. In one example, the annotation content can be presented in an annotation box, and the annotation box can be provided with a corresponding reply button. When the user clicks the reply button, the browser may receive the reply instruction.
And step 304, displaying the reply content editing window according to the reply instruction.
The reply content editing window may be displayed adjacent to the annotation frame, e.g., directly below the annotation frame, etc. Of course, in practical applications, the reply content editing window may be embedded in the annotation frame, which is not limited in this specification.
Specifically, the user can input the corresponding reply content through the reply content editing window. After the user enters the corresponding reply content, the submission may be performed by pressing a fixed combination key (e.g., shift + enter). Of course, in practical applications, the submission may be performed in other manners, for example, the submission may be performed when the reply content editing window loses focus, which is not limited in this specification.
Step 306, obtaining the reply content input through the reply content editing window.
Step 308, generating a reply identifier of the reply content.
Specifically, the reply identifier of the reply content may be generated by a background server corresponding to the browser.
And step 310, recording the corresponding relation between the annotation mark, the reply mark and the reply content.
Similarly, the backend server may record the corresponding relationship between the annotation identifier and the reply content. In one implementation, the correspondence may be as shown in table 2.
TABLE 2
In table 2, not only the annotation identifier, the reply identifier, and the reply content, but also information such as the reply creator and the reply creation time are recorded. It will be appreciated that after assigning values to the various fields in table 2, a complete piece of reply data is obtained. When a plurality of pieces of reply data exist, the plurality of pieces of reply data are distinguished through the reply identifiers. Note that the annotation identifications of the reply data corresponding to the same annotation content are the same.
It should be understood that the contents of table 2 are for exemplary purposes only, and the present description is in no way limited to the contents explicitly shown in the table.
It should be noted that, after recording the correspondence, the background server may return information of success or failure of data recording to the browser.
Step 312, the reply content is presented to the user.
After the browser receives the information that the data recording is successful, the browser can display the reply content to the user. It is understood that there may be multiple corresponding reply contents for the same annotation content. In one implementation, the annotation content can be displayed in the annotation frame first, and then the plurality of reply contents can be displayed. The plurality of reply contents may be arranged in reverse order in the creation time order.
For a certain online document, after adding corresponding annotation content to one or more annotation objects of the online document by the method shown in fig. 2. In addition, after adding reply content to one or more annotation contents by the method shown in fig. 3, the annotation contents and the display method of the reply content of the online document can be described as follows.
Fig. 4 is an information interaction diagram showing annotations in an online document provided in an embodiment of the present specification. As shown in fig. 4, the method may include:
step 402, receiving a document opening instruction.
For example, a document opening instruction of the user may be received by the browser.
Step 404, obtaining the document content of the online document to be opened according to the document opening instruction.
Here, the online document to be opened may be stored in the cloud server. The online document may be written in html language.
Specifically, after receiving the document opening instruction, the browser may acquire the document content of the online document to be opened from the corresponding database by interacting with the backend server.
Step 406, determine whether the document content includes a custom annotation tag.
The customized annotation labels herein can refer to: < review > </review >. Wherein < review > may be referred to as a start tag and </review > may be referred to as an end tag. The customized annotation tag can embed an annotation object. In addition, the custom annotation tag can also have tag attributes, such as an identification attribute (id) and a style attribute (style). The identification attribute is used for defining annotation identification of the annotation content. The style attribute is used to define the presentation style of the annotation object. The above-mentioned tag attributes may be included in the start tag.
Step 408, if the customized annotation tag is included, the tag content of the customized annotation tag and the attribute value of the identification attribute are obtained.
It can be appreciated that when corresponding annotation content is added to a plurality of annotation objects in an online document, the online document can contain a plurality of customized annotation tags. If multiple custom annotation tags are included, they can be stored in a tag list. Specifically, if the tag list is detected not to be empty, a plurality of custom annotation tags in the tag list can be read in sequence. And then, aiming at the read self-defined annotation tag, executing the steps of obtaining the tag content and the attribute value of the identification attribute.
It should be noted that, since the tag content is used to define the annotation object in the online document, step 408 can also be understood as obtaining the annotation object in the online document and the attribute value of the identification attribute.
Step 410, according to the attribute value of the identification attribute, determining the annotation identification of the annotation content corresponding to the annotation object.
Since the generated annotation identifier may be assigned to the identifier attribute in step 214, the obtained attribute value of the identifier attribute may be the annotation identifier of the annotation content.
And step 412, acquiring annotation content according to the annotation mark.
For example, the browser may obtain annotation content corresponding to the current annotation identifier from the corresponding database by interacting with the background server. The database here may include an annotation table and an annotation reply table. The fields contained in the annotation table can be referred to table 1. The annotation table can include a plurality of annotation data, which are distinguished by annotation tags. The fields included in the annotation reply table can be referred to as shown in table 2. The annotation reply table may include a plurality of reply data, which are distinguished by a reply identifier.
It is understood that when the annotation table is included in the database, a piece of annotation data, which may include annotation content, may be obtained from the annotation table of the database according to the annotation identifier. In addition, information such as an annotation object, an annotation creator, and annotation creation time may be included.
It should be noted that, when the database further includes the annotation reply table, one or more pieces of reply data may be obtained from the annotation reply table of the database according to the annotation identifier. It is understood that a piece of reply data for a certain batch of comment content can be determined by the comment identifier and the reply identifier together. The acquired piece of reply data may include reply content. In addition, information such as a reply creator, a reply creation time, and the like can be included.
And step 414, displaying the annotation object and other contents except the annotation object in the document content in a distinguished manner, and displaying the annotation content at the corresponding position of the annotation object.
Specifically, it may be to obtain the attribute value of the style attribute of the customized annotation tag. And determining the display style of the annotation object according to the attribute value of the style attribute. And displaying the annotation object according to the display style. And taking the attribute values of the style attributes as follows: for the example of "background-color: # f8eb 69", the presentation style may be: and adding a background color to the annotation object to realize highlight display. In practical applications, other presentation styles of the annotation object can be defined by modifying the attribute value of the style, for example, the font of the annotation object can be defined as an artistic font, and the like, which is not limited in this specification.
For other contents of the online document, the contents can be presented in a default presentation style, for example, the background color is not added, and the font is a normal font.
In addition, one implementation manner of displaying the annotation content at the corresponding position of the annotation object may be as follows: and creating an annotation frame in a position with the same height as the annotation object in the right blank area of the online document. And displaying the annotation content in the annotation frame. In addition, if multiple pieces of reply content are also acquired, the multiple pieces of reply content can also be displayed in the annotation box. In one example, the annotation content is presented first and then the plurality of pieces of reply content are presented in the annotation box. The plurality of reply contents are arranged in reverse order according to the creation time sequence.
It should be understood that the above only describes one way of presenting the annotation content and the reply content. In other display modes, the annotation frame can be replaced by an annotation window or an annotation interface. In addition, the annotation frame may also be located in a left blank area or a height difference between the annotation frame and the annotation object is a preset threshold, and the like, which is not limited in this specification.
Optionally, a click command of the annotation content may be received for the online document to which the annotation content is added. And then, according to the click command of the annotation content, the online document is rolled to the position of the annotation object for displaying. Therefore, the annotation object aimed at by the current annotation content can be quickly positioned for the user, and the annotation content and the annotation object are well associated.
The implementation process of scrolling the online document to the position of the annotation object for displaying according to the click instruction of the annotation content may be as follows: and acquiring the annotation mark of the annotation content according to the click command of the annotation content. And searching a self-defined annotation label according to the annotation identifier. And determining the position of the annotation object according to the position of the self-defined annotation tag. And rolling the online document to the position of the annotation object for displaying.
In addition, the online document added with the annotation content can also receive a click command of the annotation object. And according to the click instruction of the annotation object, the online document is scrolled to the position of the annotation content for displaying. Therefore, the annotation content added aiming at the current annotation object can be quickly positioned for the user, so that the annotation object and the annotation content are well associated.
The implementation process of scrolling the online document to the position of the annotation content for displaying according to the click instruction of the annotation object may be as follows: and determining a self-defined annotation tag corresponding to the annotation object according to the click instruction of the annotation object. And obtaining the attribute value of the identification attribute of the self-defined annotation tag. And searching the annotation content according to the attribute value of the identification attribute. And scrolling the online document to the position of the annotation content for displaying.
In summary, the method for displaying the annotation in the online document provided by the embodiments of the present disclosure may implement association of the annotation object, the annotation content, and the reply content through the customized annotation tag, so as to improve user experience and efficiency of collaborative work. Specifically, the position of the annotation object in the document may not be recorded in the annotation table. When the browser displays the document, if the user-defined annotation tag is analyzed, the annotation content and the annotation reply content are found through the attribute value of the identification attribute and displayed. Therefore, the corresponding relation between the annotation object and the annotation content and the reply content can be solved, and the corresponding annotation object can be quickly positioned and highlighted after the user selects a certain annotation content. In addition, the corresponding annotation content can be quickly positioned according to the annotation object selected by the user.
Corresponding to the method for displaying annotations in an online document, an embodiment of the present specification further provides an apparatus for displaying annotations in an online document, as shown in fig. 5, where the apparatus may include:
a receiving unit 502, configured to receive a document opening instruction.
An obtaining unit 504, configured to obtain document content of an online document to be opened according to the document opening instruction received by the receiving unit 502.
A judging unit 506, configured to judge whether the document content acquired by the acquiring unit 504 includes a custom annotation tag.
The obtaining unit 504 is further configured to obtain the tag content of the customized annotation tag and the attribute value of the identifier attribute if the determining unit 506 determines that the customized annotation tag is included. The tag content is used to define annotation objects in the document content.
The determining unit 508 is configured to determine, according to the attribute value of the identifier attribute acquired by the acquiring unit 504, an annotation identifier of the annotation content corresponding to the annotation object.
The obtaining unit 504 is further configured to obtain annotation content according to the annotation identifier determined by the determining unit 508.
The display unit 510 is configured to differently display the annotation object and other contents in the document content except the annotation object, and display the annotation content at a corresponding position of the annotation object.
The presentation unit 510 may be specifically configured to:
and obtaining the attribute value of the style attribute of the self-defined annotation tag.
And determining the display style of the annotation object according to the attribute value of the style attribute.
And displaying the annotation object according to the display style.
Optionally, the apparatus may further include: a generating unit 512 and a recording unit 514.
The receiving unit 502 is further configured to receive a new annotation instruction for an annotation object in the original document content.
The displaying unit 510 is further configured to display the annotation content editing window according to the new annotation instruction received by the receiving unit 502.
The obtaining unit 504 is further configured to obtain the annotation content input through the annotation content editing window.
The generating unit 512 is configured to generate an annotation identifier of the annotation content.
And a recording unit 514, configured to record a corresponding relationship between the annotation identifier and the annotation content.
The obtaining unit 504 may specifically be configured to:
and acquiring annotation content from the corresponding relation according to the annotation mark.
Optionally, the apparatus may further include:
and an embedding unit 516, configured to embed the annotation object as the tag content of the customized annotation tag into the customized annotation tag.
The determining unit 508 is further configured to determine an attribute value of the identifier attribute of the customized annotation tag according to the annotation identifier.
An updating unit 518, configured to update the embedded tag content and the customized annotation tag after determining the attribute value of the identification attribute into the original document content, so as to obtain an updated document content.
A storage unit 520, configured to store the document content updated by the updating unit 518 in the database.
The obtaining unit 504 may specifically be configured to:
and acquiring the document content from the database according to the document opening instruction.
Optionally, the receiving unit 502 is further configured to receive a click instruction of the annotation content.
The displaying unit 510 is further configured to scroll the online document to a position where the annotation object is located for displaying according to the click instruction of the annotation content received by the receiving unit 502.
And/or the presence of a gas in the gas,
the receiving unit 502 is further configured to receive a click instruction of the annotation object.
The displaying unit 510 is further configured to scroll the online document to a position where the annotation content is located for displaying according to the click instruction of the annotation object received by the receiving unit 502.
The presentation unit 510 may be specifically configured to:
and acquiring the annotation mark of the annotation content according to the click command of the annotation content.
And searching a self-defined annotation label according to the annotation identifier.
And determining the position of the annotation object according to the position of the self-defined annotation tag.
And rolling the online document to the position of the annotation object for displaying.
Or,
and determining a self-defined annotation tag corresponding to the annotation object according to the click instruction of the annotation object.
And obtaining the attribute value of the identification attribute of the self-defined annotation tag.
And searching the annotation content according to the attribute value of the identification attribute.
And scrolling the online document to the position of the annotation content for displaying.
Optionally, the obtaining unit 504 is further configured to obtain reply content of the annotation content according to the annotation identifier.
The display unit 510 is specifically configured to:
and displaying the annotation content and the reply content of the annotation content at the corresponding position of the annotation object.
Optionally, the receiving unit 502 is further configured to receive a reply instruction for the annotation content.
The displaying unit 510 is further configured to display the reply content editing window according to the reply instruction received by the receiving unit 502.
The obtaining unit 504 is further configured to obtain the reply content input through the reply content editing window displayed by the displaying unit 510.
The generating unit 512 is further configured to generate a reply identifier of the reply content.
The recording unit 514 is further configured to record a corresponding relationship between the annotation identifier and the reply content.
The obtaining unit 504 is specifically configured to:
and acquiring reply content from the corresponding relation according to the annotation mark and the reply mark.
Optionally, the display unit 510 may be further specifically configured to:
and creating an annotation frame in a position with the same height as the annotation object in the right blank area of the online document.
And displaying the annotation content and the plurality of pieces of reply content in the annotation frame.
Optionally, the display unit 510 may be further specifically configured to:
and displaying the annotation content in the annotation frame firstly, and displaying a plurality of reply contents later. The plurality of reply contents are arranged in reverse order according to the creation time sequence.
The functions of each functional module of the device in the above embodiments of the present description may be implemented through each step of the above method embodiments, and therefore, a specific working process of the device provided in one embodiment of the present description is not repeated herein.
In the apparatus for displaying annotations in an online document provided in an embodiment of the present specification, the receiving unit 502 receives a document opening instruction. The acquisition unit 504 acquires document contents of an online document to be opened according to the document opening instruction. The determination unit 506 determines whether the document content includes a custom annotation tag. If the user-defined annotation tag is included, the obtaining unit 504 obtains the tag content of the user-defined annotation tag and the attribute value of the identification attribute. The determining unit 508 determines the annotation tag of the annotation content corresponding to the annotation object according to the attribute value of the tag attribute. The obtaining unit 504 obtains the annotation content according to the annotation identifier. The presentation unit 510 displays the annotation object and other contents in the document content except the annotation object differently, and displays the annotation content at a corresponding position of the annotation object. Therefore, the corresponding relation among the annotation objects, the annotation contents and the reply contents can be well displayed.
The device for displaying annotations in an online document provided by one embodiment of the present specification may be a module or unit of the browser in fig. 1.
Corresponding to the method for displaying annotations in an online document, an embodiment of the present specification further provides a browser, and as shown in fig. 6, the browser may include:
a receiver 602, configured to receive a document opening instruction.
And the at least one processor 604 is configured to obtain the document content of the online document to be opened according to the document opening instruction. And judging whether the document content contains the self-defined annotation tag. And if the user-defined annotation tag is contained, acquiring the tag content of the user-defined annotation tag and the attribute value of the identification attribute. The tag content is used to define annotation objects in the document content. And determining the annotation mark of the annotation content corresponding to the annotation object according to the attribute value of the mark attribute. And acquiring annotation content according to the annotation mark. And displaying the annotation object and other contents except the annotation object in the document content in a distinguishing manner, and displaying the annotation content at the corresponding position of the annotation object.
The browser provided by one embodiment of the specification can improve user experience.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the browser embodiment, since it is substantially similar to the method embodiment, the description is simple, and for relevant points, reference may be made to part of the description of the method embodiment.
The steps of a method or algorithm described in connection with the disclosure herein may be embodied in hardware or may be embodied in software instructions executed by a processor. The software instructions may consist of corresponding software modules that may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an ASIC. Additionally, the ASIC may reside in a server. Of course, the processor and the storage medium may reside as discrete components in a server.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in this invention may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above-mentioned embodiments, objects, technical solutions and advantages of the present specification are further described in detail, it should be understood that the above-mentioned embodiments are only specific embodiments of the present specification, and are not intended to limit the scope of the present specification, and any modifications, equivalent substitutions, improvements and the like made on the basis of the technical solutions of the present specification should be included in the scope of the present specification.