CN112395848A - Rich text display method and device, computer equipment and storage medium - Google Patents

Rich text display method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112395848A
CN112395848A CN202011298509.0A CN202011298509A CN112395848A CN 112395848 A CN112395848 A CN 112395848A CN 202011298509 A CN202011298509 A CN 202011298509A CN 112395848 A CN112395848 A CN 112395848A
Authority
CN
China
Prior art keywords
rich text
text
target
rich
template
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011298509.0A
Other languages
Chinese (zh)
Inventor
罗水生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011298509.0A priority Critical patent/CN112395848A/en
Publication of CN112395848A publication Critical patent/CN112395848A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Bioethics (AREA)
  • Artificial Intelligence (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application relates to the technical field of visualization, and discloses a rich text display method, a rich text display device, computer equipment and a storage medium, wherein the method comprises the following steps: constructing a plurality of rich text templates, and rendering the rich text templates by utilizing preset view controls; setting a label of each rendered rich text template, calculating the height and width of each label to obtain a calculation result, drawing a text part of each rich text template corresponding to the label by using a text drawing frame according to the calculation result, and packaging the drawn rich text templates in a container; and responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from a plurality of rich text templates of the container according to the click instruction, and displaying the content information to which the target text part jumps as the target rich text template. The method and the device reduce the number of codes, have higher development efficiency and enrich the display modes of the content information.

Description

Rich text display method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of visualization technologies, and in particular, to a rich text display method and apparatus, a computer device, and a storage medium.
Background
With the rapid development of the internet and electronic technology, people widely use electronic devices such as mobile phones, tablets, computers and the like to browse information. In some application scenarios, when a user browses an article, the specified text in the article generally refers to the content of other articles as reference material, and the article generally provides an access address for referring to the article for the user to view details.
However, in the prior art, the design mode of clicking the specified characters in the rich text is generally to set the style of the characters through the UITextView control, add the url attribute, and then process the click event by using the UITextView control.
Disclosure of Invention
The application mainly aims to provide a rich text display method, a rich text display device, computer equipment and a storage medium, and aims to solve the technical problems that the number of codes of the existing word click skip design mode is large, the use cost is high, and the development efficiency is low.
In order to achieve the above object, the present application provides a rich text display method, including:
constructing a plurality of rich text templates, and respectively rendering the rich text templates by using preset view controls;
setting a label of each rendered rich text template, calculating the height and width of each label to obtain a calculation result, drawing a text part of the corresponding label in each rich text template by using a text drawing frame according to the calculation result, and packaging the drawn rich text templates in a container;
responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from a plurality of rich text templates of the container according to the click instruction, and displaying content information jumped to by the target text part in the target rich text template.
In one embodiment, the step of calculating the height and width of each label comprises:
acquiring containers for packaging the rich text templates and the text portions to be drawn, calculating the height of the containers according to the font size of the text portions to be displayed in a sub-thread, and calculating the width of the containers according to the number of characters of the text portions;
the height and width of each label is determined from the height and width of the container.
In an embodiment, the step of drawing the text portion of the corresponding label in each rich text template by using a text drawing frame according to the calculation result includes:
setting the font size and the line spacing of the text part by using a text drawing frame according to the calculation result; wherein the font size of the text portion is defined within the height of the label in the calculation result and the line spacing of the text portion is defined within the width of the label in the calculation result.
In one embodiment, the step of responding to a click command of a user to click on a target text portion of the currently displayed rich text comprises:
calling a TextHighliight class function, and responding to a click instruction of a user for clicking the target text part of the currently displayed rich text by the TextHighliight class function.
In an embodiment, after the step of displaying the content information to which the target text portion jumps in the target rich text template, the method further includes:
returning the display interface of the target text part in response to a return instruction of a user;
responding to a double-click event that the user clicks the target text part again, and switching the content information to which the target text part jumps to a standby target rich text template for displaying; the standby target rich text template is a rich text template except the target rich text template, and the content information is a detailed description of the target text part.
In an embodiment, the step of obtaining a target rich text template from a plurality of rich text templates in the container according to the click command includes:
extracting a rich text template identifier of a target rich text template to be obtained from a click instruction;
and determining a target rich text template from the rich text templates according to the rich text template identification.
In an embodiment, before the step of obtaining the target rich text template from the plurality of rich text templates in the container according to the click instruction, the method further includes:
responding to a click instruction of a user, and popping up a password verification box on a display interface;
and acquiring a password input by a user in a password verification box, and after the password is verified successfully, executing a step of acquiring a target rich text template from the rich text templates in the container according to the click command.
The present application also provides a rich text display device, including:
the construction module is used for constructing a plurality of rich text templates and respectively rendering the rich text templates by utilizing preset view controls;
the rendering module is used for setting the label of each rendered rich text template, calculating the height and width of each label to obtain a calculation result, drawing the text part of the corresponding label in each rich text template by using a text drawing frame according to the calculation result, and packaging the drawn rich text templates in a container;
and the display module is used for responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from the rich text templates of the container according to the click instruction, and displaying the content information jumped to by the target text part in the target rich text template.
The present application further provides a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of any of the above methods when executing the computer program.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method of any of the above.
According to the rich text display method, the rich text display device, the computer equipment and the storage medium, a plurality of rich text templates are built, the rich text templates are respectively rendered by utilizing a preset view control, the label of each rendered rich text template is set, the height and the width of each label are calculated to obtain a calculation result, then a text drawing frame is used for drawing the text part of the corresponding label in each rich text template according to the calculation result, and the drawn rich text templates are packaged in a container; responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from a plurality of rich text templates of the container according to the click instruction, and displaying the content information to which the target text part jumps in the target rich text template, so that the rich text template is packaged in the container, the calling is facilitated, the number of codes is reduced, the use cost is reduced, and the development efficiency is higher. In addition, according to the method and the device, the target rich text template is obtained from the container according to the click instruction, the content information jumped to by the target text part is displayed by the target rich text template, the display mode of the content information is enriched, personalized setting is achieved, and the problem that the display mode of the content information jumped to at present is single is solved.
Drawings
FIG. 1 is a diagram of an implementation environment of a rich text display method provided in an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a rich text display method according to an embodiment of the present application;
FIG. 3 is a schematic flow chart diagram of a rich text display method according to another embodiment of the present application, which mainly shows the specific steps of calculating the height and width of each label;
fig. 4 is a schematic flowchart of a rich text display method according to another embodiment of the present application, which mainly shows a specific step of drawing a text portion of a corresponding label in each rich text template by using a text drawing frame according to a calculation result;
fig. 5 is a flowchart illustrating a rich text display method according to another embodiment of the present application, which mainly shows specific steps of obtaining a target rich text template from a plurality of rich text templates in a container according to a click command;
FIG. 6 is a schematic interface diagram of a user service protocol before and after a jump according to an embodiment of the present application;
FIG. 7 is a block diagram illustrating a rich text display device according to an embodiment of the present application;
fig. 8 is a block diagram illustrating a structure of a computer device according to an embodiment of the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Fig. 1 is a diagram of an implementation environment of a rich text display method provided in an embodiment, as shown in fig. 1, in the implementation environment, including a server and a terminal. The terminal is used for browsing content information of a display interface, and is connected with the server through a network to realize information interaction with the server. The network may include the internet, 2G/3G/4G, wifi, etc.
The server may be an independent physical server or terminal, may be a server cluster formed by a plurality of physical servers, and may be a cloud server providing basic cloud computing services such as a cloud server, a cloud database, a cloud storage, and a CDN.
The terminal may be, but is not limited to, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and the like.
In an embodiment of the present application, a rich text display method is provided to solve technical problems of a large number of codes, high use cost, and low development efficiency in a current design manner of word click skip, and referring to fig. 2, in an embodiment, the rich text display method includes the steps of:
s1, constructing a plurality of rich text templates, and rendering the rich text templates by using preset view controls respectively;
s2, setting the label of each rendered rich text template, calculating the height and width of each label to obtain a calculation result, drawing the text part of the corresponding label in each rich text template by using a text drawing frame according to the calculation result, and packaging the drawn rich text templates in a container;
s3, responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from the rich text templates of the container according to the click instruction, and displaying the content information jumped to by the target text part in the target rich text template.
According to the method, a plurality of rich text templates can be constructed in advance, and then each rich text template is rendered by using a view control UIView; setting a Label of each rendered rich Text template, calculating the height and width of each Label to obtain a calculation result containing the height and width of the Label, drawing a Text part of a view where each Label in each rich Text template is located by using a Core Text frame according to the calculation result, packaging the drawn rich Text template in a container for subsequent calling, when a user clicks the Text part in the currently displayed rich Text, determining a target Text part by a server in response to a click instruction of the Text part clicked by the user, acquiring the target rich Text template from the container according to the click instruction, and displaying the content information to which the target Text part is skipped in the target rich Text template. Wherein the content information may be a detailed description of the target text portion. For example, when a user clicks on a target text portion such as a protocol, a jump is made to the specific contents of the protocol so that the user has further knowledge of the protocol.
The text part is similar to a website link and can contain a uniform resource locator, when a user clicks the text part, corresponding content information is inquired from a database according to the uniform resource locator, various items of information of the content information are respectively configured in corresponding information items of the target rich text template, and the configured content information is displayed for the user.
The embodiment can render the rich text template by using the SSLabel class of the view control UIView, which is based on the view control UIView class mainly used for rendering the finally presented container. In addition, the application may also use the CoreText framework of the system for rendering the text portion of the rich text template.
The rich text display method comprises the steps of constructing a plurality of rich text templates, rendering the rich text templates by utilizing a preset view control, setting a label of each rendered rich text template, calculating the height and width of each label to obtain a calculation result, drawing a text part corresponding to the label in each rich text template by using a text drawing frame according to the calculation result, and packaging the drawn rich text templates in a container, wherein the font, the word size, the color and the like are adopted; responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from a plurality of rich text templates of the container according to the click instruction, and displaying the content information to which the target text part jumps in the target rich text template, so that the rich text template is packaged in the container, the calling is facilitated, the number of codes is reduced, the use cost is reduced, and the development efficiency is higher. In addition, according to the method and the device, the target rich text template is obtained from the container according to the click instruction, the content information jumped to by the target text part is displayed by the target rich text template, the display mode of the content information is enriched, personalized setting is achieved, and the problem that the display mode of the content information jumped to at present is single is solved.
In an embodiment, referring to fig. 3, in step S2, the step of calculating the height and width of each label may specifically include:
s21, obtaining containers for packaging the rich text templates and the text portions to be drawn, calculating the height of the containers according to the font sizes of the text portions in a sub-thread, and calculating the width of the containers according to the number of characters of the text portions;
and S22, determining the height and width of each label according to the height and width of the container.
In this embodiment, when the text portion is drawn, the height and width of each Label tag can be calculated in the sub-thread, and the height and width can be determined according to the final height and width of the container calculated by the font size of the characters, the number of the characters, and the like, and meanwhile, the height and width of each Label can be processed by the sub-thread, and then the calculated result is returned to the main thread. The label is used for triggering the skip control, and when a user clicks the text part in the label, the corresponding control is triggered to skip to the content information corresponding to the text part. Thus, when the user selects the label, focus is automatically turned to the control associated with the label.
Wherein, the container is a lightweight independent executable software package of software, and comprises all that is needed for running the container: code, system tools, system libraries, settings. The container isolates the software from its surroundings, such as differences between the development environment and the login environment, and helps to reduce conflicts between teams running different software on the same infrastructure. A Docker container running on a machine may share the operating system kernel of the machine, thereby using less computation and memory. The size of the container is related to the packaged content, and the height and the width of the container need to be set according to the packaged content, so that the height of the container finally used for packaging the rich text template is determined by the size of the font of the text part to be displayed, and when the font is larger, the height of the container corresponding to the rich text template containing the font is higher; similarly, when the number of the characters of the text part is more, the width of the container corresponding to the rich text template containing the text part is also higher, so as to ensure that the container can encapsulate the rich text template.
After the height and the width of the container are set, calculating the height and the width of each Label according to the height and the width of the final container, and calculating the height of each Label according to the height of the final container and the number of required labels during calculation; and calculating the width of each Label according to the width of the final container and the number of the required labels, so as to ensure that the height and the width of each Label do not exceed the packaging range of the container, and ensure that the rich text template can be normally packaged.
In an embodiment, referring to fig. 4, in step S2, the step of drawing the text portion of the corresponding label in each rich text template by using the text drawing frame according to the calculation result may specifically include:
s23, setting the font size and the line spacing of the text part by using a text drawing frame according to the calculation result; wherein the font size of the text portion is defined within the height of the label in the calculation result and the line spacing of the text portion is defined within the width of the label in the calculation result.
In this embodiment, the font size, lines, glyphs, font colors, ground colors, line spacing, and the like of the text portion may also be set. And setting the font size and the line spacing of the text part by using a text drawing frame according to the calculation result, so that the font size of the text part is limited within the height of the label in the calculation result, and the line spacing of the text part is limited within the width of the label in the calculation result.
Setting font lines of the text part refers to compiling the font lines, and the setting includes thickening, inclining and the like of the font lines; editing the font of the text part refers to compiling the font size of the characters; compiling the character fonts refers to adjusting the character fonts, such as a regular script, a Song script and the like; editing the color of the text part refers to modifying the color of characters; editing the background color of a text portion refers to modifying the background color of the text. Specifically, in this embodiment, SSLabel may be used to set an attribute of the text portion, where the attribute includes attribute information such as font size, font color, and line spacing, and the name of SSLabel is called Label, but is different from UILabel of the system, and includes setting font size, font color, and line spacing. Wherein, the attribute of attribute text is the characters set in the Label and finally displayed, and the style of the related characters, namely the style of the characters.
Note that, the text can be edited by a font line such as bold, slant, and underline, and can be executed by calling an application programming interface of a browser. However, for complicated editing of characters, such as editing of font, color and background of characters, currently, there is no corresponding browser application programming interface to implement, so it is necessary to construct an editing script in advance, create an application editing interface, and call the editing script by using the application editing interface to implement complicated editing work of characters.
In an embodiment, in step S3, the step of responding to the click instruction of the user to click the target text portion of the currently displayed rich text may specifically include:
calling a TextHighliight class function, and responding to a click instruction of a user for clicking the target text part of the currently displayed rich text by the TextHighliight class function.
In this embodiment, all displays are rendered by Label tags inherited to UIView, and a click event needs a TextHighhlight class function to complete, wherein the TextHighhlight class function is based on a base class NSObject and is used for managing the styles of all text part displays, the styles of specific text displays, and the callback of the click event of the specific text. The TextHighliight class function is a management class, which corresponds to a management role. The NSObject is the root class of most Objective-C class inheritance systems, the TextHighlight class function follows the NSObject protocol, and provides some universal methods, and the objects can inherit the NSObject to access the interface of the runtime from the object and enable the objects to have the basic capability of Objective-C objects, so that the amount of developed codes can be reduced, and the development efficiency is improved.
In an embodiment, referring to fig. 5, in step S3, the step of obtaining a target rich text template from the rich text templates in the container according to the click instruction may specifically include:
s31, extracting the rich text template identification of the target rich text template to be obtained from the click instruction;
and S32, determining a target rich text template from the rich text templates according to the rich text template identification.
In this embodiment, different click instructions include different rich text template identifiers, so as to accurately invoke corresponding rich text templates according to the rich text template identifiers. Specifically, the user can click the text part through the service end, send the identifier carrying the rich text template to the server, and after the server receives the identifier of the rich text template sent by the service end, the server can determine the target rich text template from at least one rich text template according to the identifier, and then send the target rich text template to the service end for the service end to use.
Further, it is considered that the format of the rich text supported by the service end may not be the same as that of the target rich text template. Based on the method, the target rich text template can be rendered into the rich text format supported by the service end according to the rich text format supported by the service end. For example, the target rich text template is rendered into an HTML document or a PDF document, etc. As shown in fig. 6, when the text portion is the user service agreement, after the user clicks the user service agreement, the target rich text template corresponding to the user service agreement may be obtained, and the specific content information to which the user service agreement is skipped is displayed as the target rich text template.
In an embodiment, after the step of displaying the content information to which the target text portion jumps in the target rich text template, the method may further include:
returning the display interface of the target text part in response to a return instruction of a user;
responding to a double-click event that the user clicks the target text part again, and switching the content information to which the target text part jumps to a standby target rich text template for displaying; the standby target rich text template is a rich text template except the target rich text template, and the content information is a detailed description of the target text part.
According to the method and the device, a plurality of drawn rich text templates are packaged in a container in advance, a click instruction of a user for clicking a target text part of the currently displayed rich text is received in real time, and the rich text templates can be switched according to different click instructions. For example, when the click instruction is determined to be a click instruction, displaying the content information to which the target text part jumps in a target rich text template of the rich text template A; and when the display interface of the target text part is returned again and the click instruction of clicking the target text part again by the user is determined to be a double-click instruction, switching the content information to which the target text part jumps to a standby target rich text template of the B rich text template for display, so that the user can conveniently select the rich text template for displaying the content information according to personal preference, and personalized design is realized.
In an embodiment, before the step of obtaining the target rich text template from the plurality of rich text templates in the container according to the click instruction, the method further includes:
responding to a click instruction of a user, and popping up a password verification box on a display interface;
and acquiring a password input by a user in a password verification box, and after the password is verified successfully, executing a step of acquiring a target rich text template from the rich text templates in the container according to the click command.
In this embodiment, since a series of protocols such as "user service agreement", "user privacy agreement" and the like are easily seen when the APP is registered and logged in, the protocols will be continuously appeared in the future as the countries and related departments pay more and more attention to the privacy authority of the user. In general, a related protocol appears together with some explanatory words, the protocol name has a specific highlight pattern, when the protocol name is clicked, the protocol name jumps to another webpage to display the complete content of the protocol, and the user service protocol has privacy under specific conditions, so that a text part similar to the user service protocol needs to be encrypted to avoid the leakage of the privacy of the user and the loss of the user. Specifically, in this embodiment, when the user clicks the text portion, a password verification box may be popped up on the display interface of the terminal, the password input by the user in the password verification box is obtained, the password is compared with the pre-stored standard password to perform password verification, and when the password input by the user is completely consistent with the pre-stored standard password, the complete content of the user service protocol is displayed, so that the protection of the user privacy is enhanced.
Referring to fig. 7, an embodiment of the present application further provides a rich text display device, including:
the system comprises a construction module 1, a rendering module and a display module, wherein the construction module 1 is used for constructing a plurality of rich text templates and rendering the rich text templates by utilizing preset view controls;
the rendering module 2 is configured to set a label of each rendered rich text template, calculate the height and width of each label to obtain a calculation result, draw a text portion of a corresponding label in each rich text template by using a text drawing frame according to the calculation result, and package the drawn rich text templates in a container;
and the display module 3 is used for responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from the rich text templates of the container according to the click instruction, and displaying the content information jumped to by the target text part in the target rich text template.
According to the method, a plurality of rich text templates can be constructed in advance, and then each rich text template is rendered by using a view control UIView; setting the Label labels of the rendered rich Text templates, calculating the height and width of each Label to obtain a calculation result, drawing the Text part of the view of the Label in each rich Text template by using a Core Text frame according to the calculation result, packaging the drawn rich Text templates in a container for later calling, responding to a click instruction of a user for clicking the target Text part of the currently displayed rich Text by a server, acquiring the target rich Text template from the container according to the click instruction, and displaying the content information to which the target Text part is skipped by using the target rich Text template when the user clicks the Text part in the rich Text.
The text part is similar to a website link and can contain a uniform resource locator, when a user clicks the text part, corresponding content information is inquired from a database according to the uniform resource locator, various items of information of the content information are respectively configured in corresponding information items of the target rich text template, and the configured content information is displayed for the user.
The embodiment can render the rich text template by using the SSLabel class of the view control UIView, which is based on the view control UIView class mainly used for rendering the finally presented container. In addition, the application may also use the CoreText framework of the system for rendering the text portion of the rich text template.
As described above, it can be understood that each component of the rich text display device provided in the present application may implement the function of any one of the above-described rich text display methods, and the detailed structure is not described again.
Referring to fig. 8, a computer device, which may be a server and whose internal structure may be as shown in fig. 8, is also provided in the embodiment of the present application. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer designed processor is used to provide computational and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used for data such as a relational extraction model, a drug discovery model and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a rich text display method.
The processor executes the rich text display method, and the method comprises the following steps:
constructing a plurality of rich text templates, and respectively rendering the rich text templates by using preset view controls;
setting a label of each rendered rich text template, calculating the height and width of each label to obtain a calculation result, drawing a text part of the corresponding label in each rich text template by using a text drawing frame according to the calculation result, and packaging the drawn rich text templates in a container;
responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from a plurality of rich text templates of the container according to the click instruction, and displaying content information jumped to by the target text part in the target rich text template.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, the computer program, when executed by a processor, implementing a rich text display method, including the steps of:
constructing a plurality of rich text templates, and respectively rendering the rich text templates by using preset view controls;
setting a label of each rendered rich text template, calculating the height and width of each label to obtain a calculation result, drawing a text part of the corresponding label in each rich text template by using a text drawing frame according to the calculation result, and packaging the drawn rich text templates in a container;
responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from a plurality of rich text templates of the container according to the click instruction, and displaying content information jumped to by the target text part in the target rich text template.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in the examples may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double-rate SDRAM (SSRSDRAM), Enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
To sum up, the most beneficial effect of this application lies in:
the rich text display method, device, computer equipment and storage medium of the application,
the method comprises the steps of constructing a plurality of rich text templates, respectively rendering the rich text templates by using preset view controls, setting labels of each rendered rich text template, calculating the height and width of each label to obtain a calculation result, then drawing text parts corresponding to the labels in the rich text templates by using a text drawing frame according to the calculation result, and packaging the drawn rich text templates in a container; responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from a plurality of rich text templates of the container according to the click instruction, and displaying the content information to which the target text part jumps in the target rich text template, so that the rich text template is packaged in the container, the calling is facilitated, the number of codes is reduced, the use cost is reduced, and the development efficiency is higher. In addition, according to the method and the device, the target rich text template is obtained from the container according to the click instruction, the content information jumped to by the target text part is displayed by the target rich text template, the display mode of the content information is enriched, personalized setting is achieved, and the problem that the display mode of the content information jumped to at present is single is solved.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method 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, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. A rich text display method, comprising:
constructing a plurality of rich text templates, and respectively rendering the rich text templates by using preset view controls;
setting a label of each rendered rich text template, calculating the height and width of each label to obtain a calculation result, drawing a text part of the corresponding label in each rich text template by using a text drawing frame according to the calculation result, and packaging the drawn rich text templates in a container;
responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from a plurality of rich text templates of the container according to the click instruction, and displaying content information jumped to by the target text part in the target rich text template.
2. The method of claim 1, wherein said step of calculating the height and width of each label comprises:
acquiring containers for packaging the rich text templates and the text portions to be drawn, calculating the height of the containers according to the font sizes of the text portions in a sub-thread, and calculating the width of the containers according to the number of characters of the text portions;
the height and width of each label is determined from the height and width of the container.
3. The method according to claim 1, wherein the step of drawing the text portion of the corresponding label in each rich text template by using a text drawing frame according to the calculation result comprises:
setting the font size and the line spacing of the text part by using a text drawing frame according to the calculation result; wherein the font size of the text portion is defined within the height of the label in the calculation result and the line spacing of the text portion is defined within the width of the label in the calculation result.
4. The method of claim 1, wherein the step of responding to a click command from a user to click on a target text portion of rich text currently displayed comprises:
calling a TextHighliight class function, and responding to a click instruction of a user for clicking the target text part of the currently displayed rich text by the TextHighliight class function.
5. The method according to claim 1, wherein after the step of displaying the content information to which the target text portion is jumped in the target rich text template, the method further comprises:
returning the display interface of the target text part in response to a return instruction of a user;
responding to a double-click event that the user clicks the target text part again, and switching the content information to which the target text part jumps to a standby target rich text template for displaying; the standby target rich text template is a rich text template except the target rich text template, and the content information is a detailed description of the target text part.
6. The method according to claim 1, wherein the step of obtaining a target rich text template from a plurality of rich text templates in the container according to the click command comprises:
extracting a rich text template identifier of a target rich text template to be obtained from a click instruction;
and determining a target rich text template from the rich text templates according to the rich text template identification.
7. The method according to claim 1, wherein the step of obtaining the target rich text template from the plurality of rich text templates of the container according to the click command is preceded by the step of:
responding to a click instruction of a user, and popping up a password verification box on a display interface;
and acquiring a password input by a user in a password verification box, and after the password is verified successfully, executing a step of acquiring a target rich text template from the rich text templates in the container according to the click command.
8. A rich text display device, comprising:
the construction module is used for constructing a plurality of rich text templates and respectively rendering the rich text templates by utilizing preset view controls;
the rendering module is used for setting the label of each rendered rich text template, calculating the height and width of each label to obtain a calculation result, drawing the text part of the corresponding label in each rich text template by using a text drawing frame according to the calculation result, and packaging the drawn rich text templates in a container;
and the display module is used for responding to a click instruction of a user for clicking a target text part of the currently displayed rich text, acquiring a target rich text template from the rich text templates of the container according to the click instruction, and displaying the content information jumped to by the target text part in the target rich text template.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the rich text display method of any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the rich text display method of any one of claims 1 to 7.
CN202011298509.0A 2020-11-18 2020-11-18 Rich text display method and device, computer equipment and storage medium Pending CN112395848A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011298509.0A CN112395848A (en) 2020-11-18 2020-11-18 Rich text display method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011298509.0A CN112395848A (en) 2020-11-18 2020-11-18 Rich text display method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112395848A true CN112395848A (en) 2021-02-23

Family

ID=74606585

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011298509.0A Pending CN112395848A (en) 2020-11-18 2020-11-18 Rich text display method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112395848A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113392268A (en) * 2021-03-31 2021-09-14 百果园技术(新加坡)有限公司 Special effect text rendering method and device, electronic equipment and storage medium
CN113723048A (en) * 2021-09-06 2021-11-30 北京字跳网络技术有限公司 Method and device for setting rich text space, storage medium and electronic equipment
CN114500505A (en) * 2022-01-19 2022-05-13 北京百度网讯科技有限公司 Text processing method and device and electronic equipment
CN115526160A (en) * 2022-10-21 2022-12-27 广州市玄武无线科技股份有限公司 Rich text processing method, device and equipment and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113392268A (en) * 2021-03-31 2021-09-14 百果园技术(新加坡)有限公司 Special effect text rendering method and device, electronic equipment and storage medium
CN113723048A (en) * 2021-09-06 2021-11-30 北京字跳网络技术有限公司 Method and device for setting rich text space, storage medium and electronic equipment
CN114500505A (en) * 2022-01-19 2022-05-13 北京百度网讯科技有限公司 Text processing method and device and electronic equipment
CN114500505B (en) * 2022-01-19 2024-05-28 北京百度网讯科技有限公司 Text processing method and device and electronic equipment
CN115526160A (en) * 2022-10-21 2022-12-27 广州市玄武无线科技股份有限公司 Rich text processing method, device and equipment and storage medium

Similar Documents

Publication Publication Date Title
CN112395848A (en) Rich text display method and device, computer equipment and storage medium
US11403364B2 (en) Method and terminal device for extracting web page content
CN109254773B (en) Skeleton page generation method, device, equipment and storage medium
CN106933722B (en) Webpage application monitoring method, server and system
CN112433799A (en) Page generation method, device, equipment and medium
CN108304172B (en) Web development method and web development engine
EP3518124A1 (en) Webpage rendering method and related device
WO2017088509A1 (en) Page customization method and device
CN108595697B (en) Webpage integration method, device and system
US20180300351A1 (en) System and Method for Display of Document Comparisons on a Remote Device
CN110780868A (en) Website development method, device, equipment and storage medium based on componentized template
CN109582890A (en) Page loading method, device, computer equipment and storage medium
CN115098098A (en) Page generation method, page display method and device
US20240007701A1 (en) Continuing video playback when switching from a dynamic page to a non-dynamic page
CN112631701A (en) Page request method and device, computer equipment and storage medium
CN110046072A (en) Monitoring method, device, terminal and the readable storage medium storing program for executing of the page
CN111783019A (en) Browser sub-page creation method and device, computer equipment and storage medium
CN111367518A (en) Page layout method and device, computing equipment and computer storage medium
CN108319474B (en) Page information generation method, device and equipment
CN109542501B (en) Browser table compatibility method and device, computer equipment and storage medium
CN114491354A (en) Page generation method and device and computer readable storage medium
CN114862470A (en) Advertisement resource adaptation method and device, computer equipment and storage medium
CN113315829B (en) Client offline H5 page loading method and device, computer equipment and medium
CN114461960A (en) Page generation method, page display method and device
RU2634221C2 (en) Method and device for drawing presentation of electronic document on screen

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination