Movatterモバイル変換


[0]ホーム

URL:


CN105843787A - Rich text editing method and system - Google Patents

Rich text editing method and system
Download PDF

Info

Publication number
CN105843787A
CN105843787ACN201610172321.9ACN201610172321ACN105843787ACN 105843787 ACN105843787 ACN 105843787ACN 201610172321 ACN201610172321 ACN 201610172321ACN 105843787 ACN105843787 ACN 105843787A
Authority
CN
China
Prior art keywords
rich text
type
text object
data
rich
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.)
Granted
Application number
CN201610172321.9A
Other languages
Chinese (zh)
Other versions
CN105843787B (en
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.)
Urumqi Bangbangjun Technology Co ltd
Original Assignee
Wuhan Douyu Network Technology 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 Wuhan Douyu Network Technology Co LtdfiledCriticalWuhan Douyu Network Technology Co Ltd
Priority to CN201610172321.9ApriorityCriticalpatent/CN105843787B/en
Publication of CN105843787ApublicationCriticalpatent/CN105843787A/en
Application grantedgrantedCritical
Publication of CN105843787BpublicationCriticalpatent/CN105843787B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了一种富文本编辑方法及系统。所述方法包括以下步骤:(1)获取存储有富文本编辑对象的原始数据数组;(2)对于其中的每一个数据,利用预先定义的富文本对象模型转换为统一的富文本对象;(3)在编辑框中,依次显示解析出的所有富文本对象;(4)在编辑框中插入或删除富文本对象;(5)创建更新后的数据数组,获取处理后的编辑框中所有的富文本对象,对于其中每一个富文本对象,根据其类型按照预先创建的类型字典记载,提取其相应属性加入到更新后的数据数组中。所述系统包括初始化模块、解析模块、呈现模块、编辑模块、返解析模块。本发明能够直观展现编辑框内的富文本编辑效果,所见即所得,大幅降低开发门槛。

The invention discloses a rich text editing method and system. The method comprises the following steps: (1) obtaining an array of original data storing rich text editing objects; (2) converting each data into a unified rich text object using a predefined rich text object model; (3) ) in the edit box, display all the parsed rich text objects in sequence; (4) insert or delete the rich text objects in the edit box; (5) create an updated data array, and obtain all the rich text objects in the processed edit box For text objects, for each rich text object, according to its type according to the pre-created type dictionary records, extract its corresponding attributes and add them to the updated data array. The system includes an initialization module, an analysis module, a presentation module, an editing module and a back-analysis module. The invention can visually display the editing effect of the rich text in the editing frame, what you see is what you get, and the development threshold is greatly reduced.

Description

Translated fromChinese
一种富文本编辑方法及系统A rich text editing method and system

技术领域technical field

本发明属于计算机技术领域,更具体地,涉及一种富文本编辑方法及系统。The invention belongs to the technical field of computers, and more specifically relates to a rich text editing method and system.

背景技术Background technique

目前各种系统的编辑框,一般将不同格式的素材,如文本、图片、和视频在不同的区域进行编辑。例如需要插入文本时,先插入文本框,在文本框内对文本进行编辑;需要插入图片时,图片作为一个独立的编辑对象编辑。这样开发者对于不同对象要理解其后台系统的实现方式,才能实现富文本编辑,从而呈现多媒体效果。Currently, the editing boxes of various systems generally edit materials in different formats, such as text, pictures, and videos, in different areas. For example, when you need to insert text, insert the text box first, and edit the text in the text box; when you need to insert a picture, edit the picture as an independent editing object. In this way, developers need to understand the implementation of the background system for different objects in order to realize rich text editing and present multimedia effects.

现有的技术实现富文本编辑,例如网页开发,对开发者的要求较高,编辑过程复杂、不直观。目前在ios平台并没有一种富文本编辑系统,能通过统一的逻辑编辑不同格式的素材。Existing technologies for rich text editing, such as web page development, have high requirements for developers, and the editing process is complicated and not intuitive. At present, there is no rich text editing system on the ios platform, which can edit materials in different formats through a unified logic.

发明内容Contents of the invention

针对现有技术的以上缺陷或改进需求,本发明提供了一种富文本编辑方法及系统,其目的在于通过对不同类型的素材进行在同一的编辑框中进行编辑,由此解决现有的系统富文本编辑方法操作复杂、开发门槛高、编辑不直观的技术问题。In view of the above defects or improvement needs of the prior art, the present invention provides a rich text editing method and system, the purpose of which is to edit different types of materials in the same editing box, thereby solving the problems of the existing system The rich text editing method has technical problems such as complex operation, high development threshold, and unintuitive editing.

为实现上述目的,按照本发明的一个方面,提供了一种富文本编辑方法,包括以下步骤:In order to achieve the above object, according to one aspect of the present invention, a rich text editing method is provided, comprising the following steps:

(1)初始化:获取存储有富文本编辑对象的原始数据数组;(1) Initialization: obtain the original data array storing the rich text editing object;

(2)解析:对于步骤(1)获取的原始数据数组中的每一个数据,利用预先定义的富文本对象模型转换为统一的富文本对象;所述富文本对象包括类型属性,用于标记所述数据的类型;(2) Parsing: For each data in the original data array obtained in step (1), use a predefined rich text object model to convert it into a unified rich text object; the rich text object includes a type attribute for marking all the type of data described;

(3)呈现:在编辑框中,依次显示步骤(2)解析出的所有富文本对象;(3) Presentation: In the edit box, all rich text objects parsed in step (2) are displayed in sequence;

(4)编辑:在编辑框中插入或删除富文本对象;(4) Edit: insert or delete rich text objects in the edit box;

(5)返解析:创建更新后的数据数组,获取步骤(4)处理后的编辑框中所有的富文本对象,对于其中每一个富文本对象,根据其类型按照预先创建的类型字典记载,提取其相应属性,加入到更新后的数据数组中。(5) Return analysis: create an updated data array, obtain all the rich text objects in the edit box processed in step (4), for each rich text object, according to its type according to the pre-created type dictionary record, extract Its corresponding attributes are added to the updated data array.

优选地,所述富文本编辑方法,其步骤(1)所述富文本编辑对象包括:文本富文本对象、表情富文本对象、图片富文本对象、视频富文本对象、以及超链接富文本对象。Preferably, in the rich text editing method, in step (1), the rich text editing objects include: text rich text objects, emoticon rich text objects, image rich text objects, video rich text objects, and hyperlink rich text objects.

优选地,所述富文本编辑方法,步骤(2)所述对于步骤(1)获取的原始数据数组中的每一个数据,利用预先定义的富文本对象模型转换为统一的富文本对象,具体为:Preferably, in the rich text editing method, in step (2), each data in the raw data array obtained in step (1) is converted into a unified rich text object using a predefined rich text object model, specifically :

对于步骤(1)获取的原始数据数组中的每一个数据,确定其类型并将类型值记录在所述富文本对象模型的类型属性中,根据富文本对象类型属性的值以及预先创建的类型字典,在相应类型的模型中记录该数据。For each data in the original data array obtained in step (1), determine its type and record the type value in the type attribute of the rich text object model, according to the value of the rich text object type attribute and the pre-created type dictionary , record that data in a model of the appropriate type.

优选地,所述富文本编辑方法,其步骤(2)所述类型字典用于记录各富文本对象的类型对应的对象属性。Preferably, in the rich text editing method, in step (2), the type dictionary is used to record the object attributes corresponding to the types of each rich text object.

优选地,所述富文本编辑方法,其步骤(2)所述各富文本对象的类型对应的对象属性可集成系统提供的富文本对象模型的属性。Preferably, in the rich text editing method, in step (2), the object attributes corresponding to the types of each rich text object can be integrated with the attributes of the rich text object model provided by the system.

按照本发明的另一个方面,提供了一种富文本编辑系统,包括:According to another aspect of the present invention, a rich text editing system is provided, including:

初始化模块:用于获取存储有富文本编辑对象的原始数据数组;Initialization module: used to obtain the original data array storing the rich text editing object;

解析模块:用于对所述原始数据数组中的每一个数据,利用预先定义的富文本对象模型转换为统一的富文本对象,提交给呈现模块;所述富文本对象包括类型属性,用于标记所述数据的类型;Parsing module: for converting each data in the original data array into a unified rich text object using a predefined rich text object model, and submitting it to the presentation module; the rich text object includes a type attribute for marking the type of data in question;

呈现模块:用于在编辑框中显示解析模块解析出的所有富文本对象;Presentation module: used to display all rich text objects parsed by the parsing module in the edit box;

编辑模块:包括插入子模块和删除子模块;所述插入子模块,用于将插入对象加入到所述数据数组中,并通过解析模块解析,呈现模块显示在所述编辑框中;所述删除子模块,用于取消被删除对象在呈现模块中的显示状态;Editing module: includes an inserting submodule and a deleting submodule; the inserting submodule is used to add the inserted object into the data array, and resolve it through the parsing module, and the presentation module is displayed in the edit box; the deleting Sub-module, used to cancel the display status of the deleted object in the rendering module;

返解析模块:用于创建更新后的数据数组,获取编辑框中所有的富文本对象,对于其中每一个富文本对象,根据其类型按照预先创建的类型字典记载,提取其相应属性,加入到更新后的数据数组中。Back parsing module: used to create the updated data array, get all the rich text objects in the edit box, for each rich text object, according to its type according to the pre-created type dictionary records, extract its corresponding attributes, add to the update in the subsequent data array.

优选地,所述富文本编辑系统,其所述富文本编辑对象,包括文本富文本对象、表情富文本对象、图片富文本对象、视频富文本对象、以及超链接富文本对象。Preferably, in the rich text editing system, the rich text editing objects include text rich text objects, emoticon rich text objects, picture rich text objects, video rich text objects, and hyperlink rich text objects.

优选地,所述富文本编辑系统,所述解析模块对所述原始数据数组中的每一个数据利用预先定义的富文本对象模型转换为统一的富文本对象,具体为:Preferably, in the rich text editing system, the parsing module uses a predefined rich text object model to convert each data in the original data array into a unified rich text object, specifically:

对于原始数据中的每一个数据,确定其类型并记录在所述富文本对象模型的类型属性中,根据富文本对象类型属性的值以及预先创建的类型字典,在相应类型的模型中记录该数据。For each data in the original data, determine its type and record it in the type attribute of the rich text object model, and record the data in the model of the corresponding type according to the value of the rich text object type attribute and the pre-created type dictionary .

优选地,所述富文本编辑系统,其所述类型字典用于记录各富文本对象的类型对应的对象属性。Preferably, in the rich text editing system, the type dictionary is used to record the object attributes corresponding to the types of each rich text object.

优选地,所述富文本编辑系统,其所述各富文本对象的类型对应的对象属性可集成系统提供的富文本对象模型的属性。Preferably, in the rich text editing system, the object attributes corresponding to the types of the rich text objects can be integrated with the attributes of the rich text object model provided by the system.

总体而言,通过本发明所构思的以上技术方案与现有技术相比,本发明提供的富文本编辑方法及系统由于将不同类型的富文本采用统一的模型转换成统一的富文本对象,进行统一的呈现和编辑,能够直观展现编辑框内的富文本编辑效果,所见即所得,大幅降低开发门槛。Generally speaking, compared with the prior art, the above technical solutions conceived by the present invention, the rich text editing method and system provided by the present invention convert different types of rich text into a unified rich text object using a unified model, so that Unified presentation and editing can intuitively display the rich text editing effect in the edit box, what you see is what you get, greatly reducing the development threshold.

附图说明Description of drawings

图1是本发明实施例1的流程示意图;Fig. 1 is the schematic flow sheet of embodiment 1 of the present invention;

图2是本发明实施例2的结构示意图。Fig. 2 is a schematic structural diagram of Embodiment 2 of the present invention.

具体实施方式detailed description

为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。此外,下面所描述的本发明各个实施方式中所涉及到的技术特征只要彼此之间未构成冲突就可以相互组合。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not constitute a conflict with each other.

本发明提供的富文本编辑方法,包括以下步骤:The rich text editing method provided by the present invention comprises the following steps:

(1)初始化:获取存储有富文本编辑对象的原始数据数组;(1) Initialization: obtain the original data array storing the rich text editing object;

所述富文本编辑对象,包括文本富文本对象、表情富文本对象、图片富文本对象、视频富文本对象、以及超链接富文本对象。The rich text editing objects include text rich text objects, emoticon rich text objects, image rich text objects, video rich text objects, and hyperlink rich text objects.

(2)解析:对于步骤(1)获取的原始数据数组中的每一个数据,利用预先定义的富文本对象模型转换为统一的富文本对象。(2) Parsing: For each data in the original data array obtained in step (1), convert it into a unified rich text object using a predefined rich text object model.

所述富文本对象模型(XXEditThemeModel)其包含一个属性用于标记所述富文本对象的具体类型(style),根据富文本对象类型以及预先创建的类型字典,在相应类型的模型中记录类型相应属性值。The rich text object model (XXEditThemeModel) contains an attribute used to mark the specific type (style) of the rich text object, according to the rich text object type and the pre-created type dictionary, record the corresponding attribute of the type in the model of the corresponding type value.

所述类型字典用于记录各富文本对象的类型对应的对象属性,其中各各富文本对象的类型对应的对象属性可集成系统提供的富文本对象模型的属性,同时根据需要时添加其他属性。The type dictionary is used to record the object attributes corresponding to the types of rich text objects, wherein the object attributes corresponding to the types of rich text objects can be integrated with the attributes of the rich text object model provided by the system, and other attributes can be added as needed.

具体地,对于步骤(1)获取的原始数据数组中的每一个数据,确定其类型并将类型值记录在所述富文本对象模型的类型属性中,根据富文本对象类型属性的值以及预先创建的类型字典,在相应类型的模型中记录该数据。Specifically, for each data in the original data array acquired in step (1), determine its type and record the type value in the type attribute of the rich text object model, according to the value of the rich text object type attribute and the pre-created A dictionary of types that records this data in the model of the corresponding type.

例如在iOS系统下,当类型属性为图片时,即style属性为image,对于该对象取图片模型参数:图片地址(src)、高度(height)、宽度(width)记录在另一个图片模型(XXImageAttachementl)中,所述图片模型继承自iOS系统提供的NSTextAttachement、增加源地址属性。For example, in the iOS system, when the type attribute is an image, that is, the style attribute is image, the image model parameters are taken for this object: the image address (src), height (height), and width (width) are recorded in another image model (XXImageAttachementl ), the image model inherits from the NSTextAttachement provided by the iOS system and adds a source address attribute.

(3)呈现:在编辑框中,依次显示步骤(2)解析出的所有富文本对象;(3) Presentation: In the edit box, all rich text objects parsed in step (2) are displayed in sequence;

(4)编辑:在编辑框中插入或删除富文本对象。当插入富文本对象时:将插入内容利用所述富文本对象模型进行解析,显示在所述编辑框中;当删除富文本对象时,取消被删除富文本对象的显示。(4) Edit: Insert or delete rich text objects in the edit box. When inserting a rich text object: parse the inserted content using the rich text object model and display it in the edit box; when deleting a rich text object, cancel the display of the deleted rich text object.

(5)返解析:创建更新后的数据数组,获取步骤(4)处理后的编辑框中所有的富文本对象,对于其中每一个富文本对象,根据其类型按照预先创建的类型字典记载,提取其相应属性,加入到更新后的数据数组中。(5) Return analysis: create an updated data array, obtain all the rich text objects in the edit box processed in step (4), for each rich text object, according to its type according to the pre-created type dictionary record, extract Its corresponding attributes are added to the updated data array.

本发明提供的富文本编辑系统,包括:The rich text editing system provided by the present invention includes:

初始化模块:用于获取存储有富文本编辑对象的原始数据数组;所述富文本编辑对象,包括文本富文本对象、表情富文本对象、图片富文本对象、视频富文本对象、以及超链接富文本对象。Initialization module: used to obtain the original data array storing rich text editing objects; the rich text editing objects include text rich text objects, emoticon rich text objects, image rich text objects, video rich text objects, and hyperlink rich text objects object.

解析模块:用于对所述原始数据数组中的每一个数据,利用预先定义的富文本对象模型转换为统一的富文本对象,提交给呈现模块。所述富文本对象包括类型属性,用于标记所述数据的类型。Parsing module: for converting each data in the original data array into a unified rich text object by using a predefined rich text object model, and submitting it to the presentation module. The rich text object includes a type attribute for marking the type of the data.

具体地,所述解析模块对于原始数据中的每一个数据,确定其类型并记录在所述富文本对象模型的类型属性中,根据富文本对象类型属性的值以及预先创建的类型字典,在相应类型的模型中记录该数据。Specifically, the parsing module determines the type of each data in the original data and records it in the type attribute of the rich text object model, according to the value of the type attribute of the rich text object and the pre-created type dictionary, in the corresponding This data is recorded in the model of the type.

所述富文本对象模型(XXEditThemeModel)其包含一个属性用于标记所述富文本对象的具体类型(style),根据富文本对象类型以及预先创建的类型字典,在相应类型的模型中记录类型相应属性值。The rich text object model (XXEditThemeModel) contains an attribute used to mark the specific type (style) of the rich text object, according to the rich text object type and the pre-created type dictionary, record the corresponding attribute of the type in the model of the corresponding type value.

所述类型字典用于记录各富文本对象的类型对应的对象属性,其中各富文本对象的类型对应的对象属性可集成系统提供的富文本对象模型的属性,同时根据需要时添加其他属性。The type dictionary is used to record the object attributes corresponding to the types of rich text objects, wherein the object attributes corresponding to the types of rich text objects can be integrated with the attributes of the rich text object model provided by the system, and other attributes can be added as needed.

呈现模块:用于在编辑框中显示解析模块解析出的所有富文本对象;Presentation module: used to display all rich text objects parsed by the parsing module in the edit box;

编辑模块:包括插入子模块和删除子模块;所述插入子模块,用于将插入对象加入到所述数据数组中,并通过解析模块解析,呈现模块显示在所述编辑框中;所述删除子模块,用于取消被删除对象在呈现模块中的显示状态;Editing module: includes an inserting submodule and a deleting submodule; the inserting submodule is used to add the inserted object into the data array, and resolve it through the parsing module, and the presentation module is displayed in the edit box; the deleting Sub-module, used to cancel the display status of the deleted object in the rendering module;

返解析模块:用于创建更新后的数据数组,获取编辑框中所有的富文本对象,对于其中每一个富文本对象,根据其类型按照预先创建的类型字典记载,提取其相应属性,加入到更新后的数据数组中。Back parsing module: used to create the updated data array, get all the rich text objects in the edit box, for each rich text object, according to its type according to the pre-created type dictionary records, extract its corresponding attributes, add to the update in the subsequent data array.

以下为实施例:The following are examples:

实施例1Example 1

一种富文本编辑方法,基于iOS操作系统实现,如图1所示,包括以下步骤:A method for editing rich text, implemented based on the iOS operating system, as shown in Figure 1, comprising the following steps:

(1)初始化:获取存储有富文本编辑对象的原始数据数组;(1) Initialization: obtain the original data array storing the rich text editing object;

所述富文本编辑对象,包括文本富文本对象、表情富文本对象、图片富文本对象、视频富文本对象、以及超链接富文本对象。The rich text editing objects include text rich text objects, emoticon rich text objects, picture rich text objects, video rich text objects, and hyperlink rich text objects.

(2)解析:对于步骤(1)获取的原始数据数组中的每一个数据,利用预先定义的富文本对象模型转换为统一的富文本对象(XXEditThemeModel)。(2) Parsing: For each data in the original data array obtained in step (1), convert it into a unified rich text object (XXEditThemeModel) using a predefined rich text object model.

预先创建的类型字典,如下:The pre-created type dictionary is as follows:

所述富文本对象模型(XXEditThemeModel)包括类型属性,当类型属性,类型属性其值可为:文本、表情、图片、视频、超链接。各种类型转换成统一富文本对象模型过程如下:The rich text object model (XXEditThemeModel) includes a type attribute. When the type attribute, the value of the type attribute can be: text, emoticon, picture, video, hyperlink. The process of converting various types into a unified rich text object model is as follows:

对于文本对象(style=text),不需要创建新模型,富文本对象模型(XXEditThemeModel),同时添加类型字典中内容、颜色、字号属性。For the text object (style=text), there is no need to create a new model, the rich text object model (XXEditThemeModel), and add the content, color, font size attributes in the type dictionary at the same time.

对于表情对象(style=emoji),取表情编号属性,然后记录在模型EmotionAttachmentl里面,EmotionAttachment继承自NSTextAttachment并添加以下属性:表情编号。由于继承自NSTextAttachment,父类会有一个属性image被继承,可以记录本地的表情图片。For the expression object (style=emoji), take the attribute of the expression number, and then record it in the model EmotionAttachmentl. EmotionAttachment inherits from NSTextAttachment and adds the following attribute: expression number. Since it inherits from NSTextAttachment, the parent class will have a property image to be inherited, which can record local emoticon pictures.

对于图片对象(style=image),取图片地址、高度、以及宽度属性,然后记录在模型XXImageAttachment里面,XXImageAttachment继承自NSTextAttachment并添加以下属性:图片地址、高度、以及宽度。For the image object (style=image), take the image address, height, and width attributes, and then record them in the model XXImageAttachment. XXImageAttachment inherits from NSTextAttachment and adds the following attributes: image address, height, and width.

对于视频对象(style=video),取视频图片地址、视频流地址、视频来源、以及安全类型属性,然后记录在模型XXVideoAttachment里面,XXVideoAttachmentl继承自NSTextAttachment并添加以下属性:视频图片地址、视频流地址、视频来源、以及安全类型。For the video object (style=video), get the video picture address, video stream address, video source, and security type attributes, and then record them in the model XXVideoAttachment, XXVideoAttachmentl inherits from NSTextAttachment and adds the following attributes: video picture address, video stream address, source of video, and type of security.

对于超链接对象(style=link),取网页名称、链接、以及安全类型属性,然后记录在模型XXUrlAttachment里面,XXUrlAttachment继承自NSTextAttachment并添加以下属性:网页名称、链接、以及安全类型。For a hyperlink object (style=link), take the webpage name, link, and security type attributes, and then record them in the model XXUrlAttachment, which inherits from NSTextAttachment and adds the following attributes: webpage name, link, and security type.

(3)呈现:在编辑框中,依次显示步骤(2)解析出的所有富文本对象。(3) Presentation: In the edit box, all rich text objects parsed in step (2) are displayed in sequence.

技术上,富文本对象其实就是文本内容,比字符串更为详细记录文本信息,拼接起来可以通过这两句关键代码,给文本框赋值,展示出来:Technically, rich text objects are actually text content, which records text information in more detail than character strings. When spliced together, these two key codes can be used to assign values to the text boxes and display them:

NSAttributedString*attachStr=NSAttributedString *attachStr=

[NSAttributedStringattributedStringWithAttachment:富文本对象];[NSAttributedStringattributedStringWithAttachment: Rich Text Object];

TextView.attributedText=attachStr;TextView.attributedText = attachStr;

通过对这些Attachment进行集成,并扩展新属性,就可以实现文本内显示“图片”这种简单的图文混排逻辑。By integrating these Attachments and extending new attributes, it is possible to realize the simple logic of displaying "pictures" in the text.

(4)编辑:在编辑框中插入或删除富文本对象。当插入富文本对象时:将插入内容利用所述富文本对象模型进行解析,显示在所述编辑框中;当删除富文本对象时,取消被删除富文本对象的显示。(4) Edit: Insert or delete rich text objects in the edit box. When inserting a rich text object: parse the inserted content using the rich text object model and display it in the edit box; when deleting a rich text object, cancel the display of the deleted rich text object.

可采用iOS原生的删除逻辑,即直接取消显示。本实施例采用以下删除逻辑:对于要删除的对象进行选中,可同时选定多个要删除的对象,再执行删除逻辑,取消所有被选中对象的显示。The iOS native deletion logic can be used, that is, the display can be canceled directly. This embodiment adopts the following deletion logic: select the object to be deleted, select multiple objects to be deleted at the same time, and then execute the deletion logic to cancel the display of all selected objects.

插入逻辑,须创建对应的富文本对象,计算光标位置,在光标位置按照步骤(3)的方法,在编辑框中显示所述对象。To insert the logic, it is necessary to create the corresponding rich text object, calculate the cursor position, and display the object in the edit box according to the method in step (3) at the cursor position.

(5)返解析:创建更新后的数据数组,获取步骤(4)处理后的编辑框中所有的富文本对象,对于其中每一个富文本对象,根据其类型按照预先创建的类型字典记载,提取其相应属性,加入到更新后的数据数组中。(5) Return analysis: create an updated data array, obtain all the rich text objects in the edit box processed in step (4), for each rich text object, according to its type according to the pre-created type dictionary record, extract Its corresponding attributes are added to the updated data array.

实施例2Example 2

本发明提供的富文本编辑系统,如图2所示,包括:The rich text editing system provided by the present invention, as shown in Figure 2, includes:

初始化模块:用于获取存储有富文本编辑对象的原始数据数组;所述富文本编辑对象,包括文本富文本对象、表情富文本对象、图片富文本对象、视频富文本对象、以及超链接富文本对象。Initialization module: used to obtain the original data array storing rich text editing objects; the rich text editing objects include text rich text objects, emoticon rich text objects, image rich text objects, video rich text objects, and hyperlink rich text objects object.

解析模块:用于对所述原始数据数组中的每一个数据,利用预先定义的富文本对象模型转换为统一的富文本对象,提交给呈现模块。Parsing module: for converting each data in the original data array into a unified rich text object by using a predefined rich text object model, and submitting it to the presentation module.

对于原始数据中的每一个数据,确定其类型。所述富文本对象模型(XXEditThemeModel)其包含一个属性用于标记所述富文本对象的具体类型(style)。根据富文本对象类型以及预先创建的类型字典,在相应类型的模型中记录类型相应属性值,从而在相应类型的模型中记录该数据。For each piece of data in the original data, its type is determined. The rich text object model (XXEditThemeModel) includes an attribute for marking the specific type (style) of the rich text object. According to the rich text object type and the pre-created type dictionary, record the corresponding attribute value of the type in the model of the corresponding type, so as to record the data in the model of the corresponding type.

所述类型字典用于记录各富文本对象的类型对应的对象属性,其中各富文本对象的类型对应的对象属性可集成系统提供的富文本对象模型的属性,同时根据需要时添加其他属性。所述类型字典具体如实施例1所示。The type dictionary is used to record the object attributes corresponding to the types of rich text objects, wherein the object attributes corresponding to the types of rich text objects can be integrated with the attributes of the rich text object model provided by the system, and other attributes can be added as needed. The type dictionary is specifically as shown in Embodiment 1.

其中,文本类型模型,即富文本对象模型中拼接内容、颜色、字号属性;表情类型模型,即富文本对象模型中拼接模型EmotionAttachmentl,所述模型EmotionAttachmentl继承自NSTextAttachment并添加以下属性:表情编号;所述图片类型模型,即富文本对象模型中拼接模型XXImageAttachment,XXImageAttachment继承自NSTextAttachment并添加以下属性:图片地址、高度、以及宽度;视频类型模型,即富文本对象模型中拼接模型XXVideoAttachment,XXVideoAttachmentl继承自NSTextAttachment并添加以下属性:视频图片地址、视频流地址、视频来源、以及安全类型;所述超链接类型模型,即富文本对象模型中拼接模型XXUrlAttachment,XXUrlAttachment继承自NSTextAttachment并添加以下属性:网页名称、链接、以及安全类型。Among them, the text type model is the splicing content, color, and font size attributes in the rich text object model; the expression type model is the splicing model EmotionAttachmentl in the rich text object model, and the model EmotionAttachmentl inherits from NSTextAttachment and adds the following attributes: expression number; The image type model described above is the splicing model XXImageAttachment in the rich text object model. XXImageAttachment inherits from NSTextAttachment and adds the following attributes: image address, height, and width; the video type model refers to the splicing model XXVideoAttachment in the rich text object model. XXVideoAttachmentl inherits from NSTextAttachment And add the following attributes: video picture address, video stream address, video source, and security type; the hyperlink type model, that is, the splicing model XXUrlAttachment in the rich text object model, XXUrlAttachment inherits from NSTextAttachment and adds the following attributes: web page name, link , and the security type.

呈现模块:用于在编辑框中显示解析模块解析出的所有富文本对象。Presentation module: used to display all rich text objects parsed by the parsing module in the edit box.

编辑模块:包括插入子模块和删除子模块;所述插入子模块,用于将插入对象加入到所述数据数组中,并通过解析模块解析,呈现模块显示在所述编辑框中;所述删除子模块,用于取消被删除对象在呈现模块中的显示状态。Editing module: includes an inserting submodule and a deleting submodule; the inserting submodule is used to add the inserted object into the data array, and resolve it through the parsing module, and the presentation module is displayed in the edit box; the deleting Submodule, used to cancel the display status of deleted objects in the rendering module.

返解析模块:用于创建更新后的数据数组,获取编辑框中所有的富文本对象,对于其中每一个富文本对象,根据其类型按照预先创建的类型字典记载,提取其相应属性,加入到更新后的数据数组中。Back parsing module: used to create the updated data array, get all the rich text objects in the edit box, for each rich text object, according to its type according to the pre-created type dictionary records, extract its corresponding attributes, add to the update in the subsequent data array.

本领域的技术人员容易理解,以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。It is easy for those skilled in the art to understand that the above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention, All should be included within the protection scope of the present invention.

Claims (10)

CN201610172321.9A2016-03-242016-03-24A kind of RichText Edition method and systemActiveCN105843787B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201610172321.9ACN105843787B (en)2016-03-242016-03-24A kind of RichText Edition method and system

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201610172321.9ACN105843787B (en)2016-03-242016-03-24A kind of RichText Edition method and system

Publications (2)

Publication NumberPublication Date
CN105843787Atrue CN105843787A (en)2016-08-10
CN105843787B CN105843787B (en)2018-08-21

Family

ID=56583146

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201610172321.9AActiveCN105843787B (en)2016-03-242016-03-24A kind of RichText Edition method and system

Country Status (1)

CountryLink
CN (1)CN105843787B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106777161A (en)*2016-12-202017-05-31厦门美图移动科技有限公司Memorandum setting method and device and mobile terminal
CN108322807A (en)*2018-02-242018-07-24武汉斗鱼网络科技有限公司A kind of barrage methods of exhibiting and device
CN108804631A (en)*2018-05-312018-11-13北京字节跳动网络技术有限公司Emoticon storage method, device, computer readable storage medium and terminal
CN109753644A (en)*2018-12-262019-05-14百度在线网络技术(北京)有限公司A kind of RichText Edition method, apparatus, mobile terminal and storage medium
CN110516028A (en)*2019-07-292019-11-29贝壳技术有限公司A kind of method and device for realizing complicated editing machine based on react
CN111274760A (en)*2020-01-092020-06-12北京字节跳动网络技术有限公司Rich text data processing method and device, electronic equipment and computer storage medium
CN111523065A (en)*2019-02-022020-08-11阿里巴巴集团控股有限公司Rich text data processing method and device, electronic equipment and computer storage medium
CN115422892A (en)*2022-09-282022-12-02中国建设银行股份有限公司Data labeling method, device, equipment, medium and product

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20040268235A1 (en)*2003-06-262004-12-30International Business Machines CorporationRich text handling for a web application
CN102799592A (en)*2011-05-262012-11-28腾讯科技(深圳)有限公司Parsing method and system of rich text document
CN103279559A (en)*2013-06-132013-09-04北京神鹰城讯科技有限公司Rich text editing method and device based on Android system
CN103389968A (en)*2013-07-102013-11-13福州博远无线网络科技有限公司Method and system for realizing rich text display
US9201852B2 (en)*2013-05-242015-12-01David Wei GeMethod for in-browser visual HTML editing via bi-directional navigation and virtual properties

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20040268235A1 (en)*2003-06-262004-12-30International Business Machines CorporationRich text handling for a web application
CN102799592A (en)*2011-05-262012-11-28腾讯科技(深圳)有限公司Parsing method and system of rich text document
US9201852B2 (en)*2013-05-242015-12-01David Wei GeMethod for in-browser visual HTML editing via bi-directional navigation and virtual properties
CN103279559A (en)*2013-06-132013-09-04北京神鹰城讯科技有限公司Rich text editing method and device based on Android system
CN103389968A (en)*2013-07-102013-11-13福州博远无线网络科技有限公司Method and system for realizing rich text display

Cited By (13)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106777161B (en)*2016-12-202020-05-08厦门美图移动科技有限公司Memorandum setting method and device and mobile terminal
CN106777161A (en)*2016-12-202017-05-31厦门美图移动科技有限公司Memorandum setting method and device and mobile terminal
CN108322807A (en)*2018-02-242018-07-24武汉斗鱼网络科技有限公司A kind of barrage methods of exhibiting and device
CN108804631A (en)*2018-05-312018-11-13北京字节跳动网络技术有限公司Emoticon storage method, device, computer readable storage medium and terminal
CN109753644A (en)*2018-12-262019-05-14百度在线网络技术(北京)有限公司A kind of RichText Edition method, apparatus, mobile terminal and storage medium
CN109753644B (en)*2018-12-262023-11-28百度在线网络技术(北京)有限公司Rich text editing method and device, mobile terminal and storage medium
CN111523065B (en)*2019-02-022023-04-25阿里巴巴集团控股有限公司Rich text data processing method and device, electronic equipment and computer storage medium
CN111523065A (en)*2019-02-022020-08-11阿里巴巴集团控股有限公司Rich text data processing method and device, electronic equipment and computer storage medium
CN110516028A (en)*2019-07-292019-11-29贝壳技术有限公司A kind of method and device for realizing complicated editing machine based on react
CN110516028B (en)*2019-07-292022-04-29贝壳技术有限公司Method and device for realizing complex editor based on act
CN111274760A (en)*2020-01-092020-06-12北京字节跳动网络技术有限公司Rich text data processing method and device, electronic equipment and computer storage medium
CN111274760B (en)*2020-01-092023-07-18抖音视界有限公司Rich text data processing method and device, electronic equipment and computer storage medium
CN115422892A (en)*2022-09-282022-12-02中国建设银行股份有限公司Data labeling method, device, equipment, medium and product

Also Published As

Publication numberPublication date
CN105843787B (en)2018-08-21

Similar Documents

PublicationPublication DateTitle
CN105843787B (en)A kind of RichText Edition method and system
CN111753500B (en)Method for merging and displaying formatted electronic form and OFD (office file format) and generating catalog
CN111753499B (en)Method for merging and displaying electronic form and OFD format file and generating directory
US9098505B2 (en)Framework for media presentation playback
US8375293B2 (en)Method and apparatus for defining documents
US8522130B1 (en)Creating notes in a multilayered HTML document
US20180052843A1 (en)Extracting a portion of a document, such as a web page
US11960525B2 (en)Automatically formatting content items for presentation
US20150248380A1 (en)Extensible framework for ereader tools, including named entity information
GB2423387A (en)Application-Generic Sequence Diagram Generator Driven by a Non-Proprietary Language
US20130191389A1 (en)Paragraph Property Detection and Style Reconstruction Engine
CN101751379B (en)Method and equipment for manufacturing electronic newspaper document
US9684652B2 (en)Multicultural communication management
US11334644B2 (en)Methods and systems for three-way merges of object representations
US20200005387A1 (en)Method and system for automatically generating product visualization from e-commerce content managing systems
CN115129806A (en)Data processing method and device, electronic equipment and computer storage medium
Wilkinson et al.Document computing: Technologies for managing electronic document collections
CN115309476A (en) A browser-based method for displaying and editing ofd files
US20230289527A1 (en)Convergence of document state and application state
CN104424170A (en)Electronic content data packet postprocessing system and method
JP6603929B1 (en) Movie editing server and program
US12159103B1 (en)System and method for comparing multiple HTML documents
CN116108855A (en)Semantic format document generation method and device
CN115879417A (en)Media editing method, device, computer and readable storage medium
CN100583094C (en)Data description and data display separation processing method

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
TR01Transfer of patent right

Effective date of registration:20241210

Address after:830000, Room 17A, Building 17, Block A, Times Square Community, No. 59 Guangming Road, Tianshan District, Urumqi, Xinjiang Uygur Autonomous Region BD00244

Patentee after:Urumqi Bangbangjun Technology Co.,Ltd.

Country or region after:China

Address before:430000 Wuhan Donghu Development Zone, Wuhan, Hubei Province, No. 1 Software Park East Road 4.1 Phase B1 Building 11 Building

Patentee before:WUHAN DOUYU NETWORK TECHNOLOGY Co.,Ltd.

Country or region before:China

TR01Transfer of patent right

[8]ページ先頭

©2009-2025 Movatter.jp