[go: up one dir, main page]

CN118153533A - Table data processing method and device - Google Patents

Table data processing method and device Download PDF

Info

Publication number
CN118153533A
CN118153533A CN202211522148.2A CN202211522148A CN118153533A CN 118153533 A CN118153533 A CN 118153533A CN 202211522148 A CN202211522148 A CN 202211522148A CN 118153533 A CN118153533 A CN 118153533A
Authority
CN
China
Prior art keywords
data structure
cells
rich text
event
column
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
CN202211522148.2A
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.)
Honor Device Co Ltd
Original Assignee
Honor Device 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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202211522148.2A priority Critical patent/CN118153533A/en
Publication of CN118153533A publication Critical patent/CN118153533A/en
Pending legal-status Critical Current

Links

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/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the application provides a method and a device for processing table data, wherein the method comprises the following steps: a form edit event is determined in response to a form edit operation in a graphical user interface acting on the first application. And acquiring a data structure corresponding to the first rich text content in the rich text editor, and updating the data structure according to the table editing event. And displaying second rich text content corresponding to the updated data structure in the rich text editor according to the updated data structure, wherein the first rich text content and/or the second rich text content comprise tables. The technical scheme of the application can simply and effectively realize the function of supporting the table editing by the rich text editor so as to promote the comprehensiveness of the function of the rich text editor.

Description

表格数据处理方法及装置Table data processing method and device

技术领域Technical Field

本申请涉及终端技术领域,尤其涉及表格数据处理方法及装置。The present application relates to the field of terminal technology, and in particular to a table data processing method and device.

背景技术Background Art

随着智能终端的发展,用户在通过备忘录等软件记录信息时,除了基本的文字外,还希望能够记录表格、图片等其他包含更多信息的内容,因此需要借助富文本编辑器编辑富文本内容。With the development of smart terminals, when users record information through software such as memo, in addition to basic text, they also hope to record tables, pictures and other content containing more information. Therefore, they need to use rich text editors to edit rich text content.

表格是一种可以有序的组织整理数据的数据结构,如果可以在富文本编辑器中支持表格的处理,则可以有效的提升富文本编辑器的实用性。然而,目前的富文本编辑器通常都是基于系统的原生框架开发的,而基于系统原生框架实现表格功能以及相应的复杂交互逻辑,是及其困难的,因此目前基于系统原生框架开发的富文本编辑器通常都不支持表格编辑功能。A table is a data structure that can organize data in an orderly manner. If the rich text editor can support table processing, the practicality of the rich text editor can be effectively improved. However, current rich text editors are usually developed based on the system's native framework, and it is extremely difficult to implement table functions and corresponding complex interaction logic based on the system's native framework. Therefore, the rich text editors currently developed based on the system's native framework usually do not support table editing functions.

发明内容Summary of the invention

本申请实施例提供一种表格数据处理方法及装置,应用于终端技术领域。The embodiments of the present application provide a table data processing method and device, which are applied in the field of terminal technology.

第一方面,本申请实施例提出一种表格数据处理方法,应用于第一应用程序,所述第一应用程序中包括富文本编辑器。该方法包括:In a first aspect, an embodiment of the present application provides a table data processing method, which is applied to a first application, wherein the first application includes a rich text editor. The method includes:

响应作用于所述第一应用程序的图形用户界面中的表格编辑操作,确定表格编辑事件;In response to a table editing operation performed in the graphical user interface of the first application, determining a table editing event;

获取所述富文本编辑器中的第一富文本内容所对应的数据结构,并根据所述表格编辑事件更新所述数据结构;Acquire a data structure corresponding to the first rich text content in the rich text editor, and update the data structure according to the table editing event;

根据更新后的数据结构,在所述富文本编辑器中显示所述更新后的数据结构所对应的第二富文本内容,所述第一富文本内容和/或所述第二富文本内容中包括表格;According to the updated data structure, displaying second rich text content corresponding to the updated data structure in the rich text editor, wherein the first rich text content and/or the second rich text content includes a table;

所述富文本编辑器为基于网页视图开发的。The rich text editor is developed based on the web page view.

这种实施方式中,通过网页视图开发富文本编辑器,从而可以通过对富文本编辑器中的富文本内容的数据结构进行更新,以在富文本编辑器中显出编辑之后的富文本内容,其中编辑之前的富文本内容和/或编辑之后的富文本内容中可以包括表格,而表格编辑的具体处理是通过数据结构的更新完成的,因此可以简单有效的实现富文本编辑器支持表格编辑功能,以提升富文本编辑器的功能的全面性。In this implementation, a rich text editor is developed through a web page view, so that the data structure of the rich text content in the rich text editor can be updated to display the edited rich text content in the rich text editor, wherein the rich text content before editing and/or the rich text content after editing may include tables, and the specific processing of table editing is completed by updating the data structure. Therefore, the rich text editor can simply and effectively support the table editing function to enhance the comprehensiveness of the functions of the rich text editor.

在一些实现方式中,所述第一应用程序的图形用户界面中包括表格插入控件;In some implementations, the graphical user interface of the first application includes a table insertion control;

所述响应作用于所述第一应用程序的图形用户界面中的表格编辑操作,确定表格编辑事件,包括:The step of determining a table editing event in response to a table editing operation in a graphical user interface of the first application program comprises:

响应作用于所述表格插入控件的点击操作,在所述图形用户界面中显示调整控件,所述调整控件中包括多个预选单元格和/或文本输入框;In response to a click operation on the table insert control, an adjustment control is displayed in the graphical user interface, wherein the adjustment control includes a plurality of pre-selected cells and/or text input boxes;

响应作用于所述多个预选单元格的选择操作,或者,响应针对于所述文本输入框中的输入内容的确认操作,确定所述表格编辑事件为插入事件,所述选择操作以及所述确认操作用于指示表格尺寸,所述插入事件用于指示在所述富文本编辑器中插入所述表格尺寸对应的表格;In response to a selection operation on the plurality of pre-selected cells, or in response to a confirmation operation on input content in the text input box, determining that the table editing event is an insert event, the selection operation and the confirmation operation are used to indicate a table size, and the insert event is used to indicate inserting a table corresponding to the table size in the rich text editor;

其中,所述表格插入操作为所述选择操作或者所述确认操作。The table insert operation is the selection operation or the confirmation operation.

这种实施方式中,通过为用户提供调整控件,在调整控件中用户可以根据实际需求输入表格尺寸,之后富文本编辑器可以相应的插入用户自定义大小的表格,以提升表格处理的灵活性。In this implementation, by providing the user with an adjustment control, the user can enter the table size in the adjustment control according to actual needs, and then the rich text editor can insert a table of the user-defined size accordingly to improve the flexibility of table processing.

在一些实现方式中,所述根据所述表格编辑事件更新所述数据结构,包括:In some implementations, updating the data structure according to the table editing event includes:

根据所述插入事件,确定待插入表格的表格尺寸;Determine the table size of the table to be inserted according to the insert event;

根据所述表格尺寸,生成所述待插入表格对应的表格数据结构,所述表格数据结构中包括所述待插入表格中的多个单元格各自对应的子数据;Generate a table data structure corresponding to the table to be inserted according to the table size, wherein the table data structure includes sub-data corresponding to each of the plurality of cells in the table to be inserted;

将所述表格数据结构添加至所述数据结构中的目标位置,以得到更新后的数据结构。The table data structure is added to a target position in the data structure to obtain an updated data structure.

这种实施方式中,通过生成待插入表格的表格数据结构,并将表格数据结构添加至数据结构中的目标位置,从而可以实现将插入的表格更新至数据结构中,之后再基于更新后的数据结构进行渲染,就可以有效的实现在富文本编辑器中插入表格。In this implementation, by generating a table data structure for the table to be inserted and adding the table data structure to the target position in the data structure, the inserted table can be updated to the data structure, and then rendered based on the updated data structure, thereby effectively inserting a table in the rich text editor.

在一些实现方式中,所述方法还包括:In some implementations, the method further includes:

针对所述富文本编辑器中所显示的表格,响应作用于所述表格的选区操作,确定所述选区操作所对应的选中单元格;For a table displayed in the rich text editor, in response to a selection operation performed on the table, determining a selected cell corresponding to the selection operation;

根据所述选区操作所对应的选中单元格,确定选中框的位置信息,所述位置信息包括宽度、高度以及坐标位置;Determine the position information of the selected box according to the selected cell corresponding to the selection operation, wherein the position information includes width, height and coordinate position;

根据所述选中框的位置信息,在所述富文本编辑器中渲染并显示所述选中框。The check box is rendered and displayed in the rich text editor according to the position information of the check box.

在这种实现方式中,通过根据用户选中的单元格在富文本编辑器中显示选中框,可以有效的实现在表格中对用户选中的区域进行特殊显示,以有效的提升富文本编辑器中表格操作的多样性。In this implementation, by displaying a selection box in the rich text editor according to the cell selected by the user, special display of the area selected by the user in the table can be effectively achieved, thereby effectively improving the diversity of table operations in the rich text editor.

在一些实现方式中,所述富文本编辑器中显示有行选中控件和列选中控件;In some implementations, a row selection control and a column selection control are displayed in the rich text editor;

所述选区操作为针对所述行选择控件的点击操作,则所述选区操作所对应的选中单元格为所述行选择控件对应的选中行中的多个单元格;或者,The selection operation is a click operation on the row selection control, and the selected cells corresponding to the selection operation are multiple cells in the selected row corresponding to the row selection control; or,

所述选区操作为针对所述列选中控件的点击操作,则所述选区操作所对应的选中单元格为所述列选择控件对应的选中列中的多个单元格。The selection operation is a click operation on the column selection control, and the selected cells corresponding to the selection operation are multiple cells in the selected column corresponding to the column selection control.

在这种实现方式中,通过在富文本编辑器中提供行选中控件和列选中控件,可以快速有效的实现对某一行或者某一列的选择。In this implementation, by providing a row selection control and a column selection control in the rich text editor, selection of a row or a column can be achieved quickly and effectively.

在一些实现方式中,所述选区操作为作用于所述表格的拖拽操作;In some implementations, the selection operation is a drag operation on the table;

所述选区操作所对应的选中单元格为所述拖拽操作所形成的拖拽范围内所包括的单元格。The selected cells corresponding to the area selection operation are cells included in the drag range formed by the drag operation.

在这种实现方式中,通过用户的拖拽操作确定用户所选中的单元格,从而可以灵活并且有效的实现对表格中用户所需要的单元格的选中。In this implementation, the cell selected by the user is determined through the dragging operation of the user, so that the cell required by the user in the table can be selected flexibly and effectively.

在一些实现方式中,所述响应作用于所述第一应用程序的图形用户界面中的表格编辑操作,确定表格编辑事件,包括:In some implementations, determining a table editing event in response to a table editing operation in a graphical user interface of the first application includes:

响应作用于所述选中单元格的触发操作,显示至少一个选择控件,所述选择控件包括如下中的至少一种:删除控件、第一添加控件以及第二添加控件;In response to a trigger operation acting on the selected cell, displaying at least one selection control, the selection control comprising at least one of the following: a delete control, a first add control, and a second add control;

响应作用于所述至少一个选择控件中的目标选择控件的点击操作,确定所述表格编辑事件为修改事件。In response to a click operation on a target selection control among the at least one selection control, the table editing event is determined to be a modification event.

在这种实现方式中,通过响应于用户针对选中单元格的触发操作,从而显示至少一个控件,从而可以为用户提供针对选中单元格的多种可能的修改操作的选择,以提升表格交互方式的多样性。In this implementation, at least one control is displayed in response to a trigger operation of a user on a selected cell, thereby providing the user with a variety of possible modification operations on the selected cell, thereby increasing the diversity of table interaction methods.

在一些实现方式中,所述选中单元格在所述表格中位于同一行,则所述第一添加控件用于指示在所述选中单元格所在行的上方添加一行单元格,所述第二添加控件用于指示在所述选中单元格所在行的下方添加一行单元格,所述删除控件用于指示删除所述选中单元格所在行的单元格。In some implementations, the selected cells are located in the same row in the table, and the first add control is used to indicate adding a row of cells above the row where the selected cells are located, the second add control is used to indicate adding a row of cells below the row where the selected cells are located, and the delete control is used to indicate deleting the cells in the row where the selected cells are located.

在一些实现方式中,若所述目标选择控件为所述删除控件,则所述修改事件为删除行事件;In some implementations, if the target selection control is the delete control, the modification event is a delete row event;

所述根据所述表格编辑事件更新所述数据结构,包括:The updating of the data structure according to the table editing event comprises:

在所述数据结构中,删除所述选中单元格所在行的各个单元格所对应的子数据,以得到更新后的数据结构;In the data structure, deleting the sub-data corresponding to each cell in the row where the selected cell is located, to obtain an updated data structure;

若所述目标选择控件为所述第一添加控件,则所述修改事件为第一添加行事件;If the target selection control is the first add control, the modification event is a first add row event;

所述根据所述表格编辑事件更新所述数据结构,包括:The updating of the data structure according to the table editing event comprises:

在所述数据结构中的第一位置添加一行单元格所对应的子数据,以得到更新后的数据结构,所述第一位置用于使得添加行的单元格位于所述选中单元格所在行的单元格的上方;Adding sub-data corresponding to a row of cells at a first position in the data structure to obtain an updated data structure, wherein the first position is used to make the cells of the added row be located above the cells of the row where the selected cell is located;

若所述目标选择控件为所述第二添加控件,则所述修改事件为第二添加行事件;If the target selection control is the second adding control, the modification event is a second adding row event;

所述根据所述表格编辑事件更新所述数据结构,包括:The updating of the data structure according to the table editing event comprises:

在所述数据结构中的第二位置添加一行单元格所对应的子数据,以得到更新后的数据结构,所述第二位置用于使得添加行的单元格位于所述选中单元格所在行的单元格的下方。Sub-data corresponding to a row of cells are added at a second position in the data structure to obtain an updated data structure, wherein the second position is used to make the cells of the added row located below the cells of the row where the selected cell is located.

在这种实现方式中,针对删除行、在上方添加行和在下方添加行的三种不同的事件,按照对应的方式,可以对数据结构中的相应位置进行相应的更新,从而可以有效的在表格中实现相应的事件操作,同时又可以保证表格中原有的内容的正确性。In this implementation, for the three different events of deleting rows, adding rows above, and adding rows below, the corresponding positions in the data structure can be updated accordingly, so that the corresponding event operations can be effectively implemented in the table while ensuring the correctness of the original content in the table.

在一些实现方式中,所述选中单元格在所述表格中位于同一列,则所述第一添加控件用于指示在所述选中单元格所在列的左侧添加一列单元格,所述第二添加控件用于指示在所述选中单元格所在列的右侧添加一列单元格,所述删除控件用于指示删除所述选中单元格所在列的单元格。In some implementations, the selected cells are located in the same column in the table, and the first add control is used to indicate adding a column of cells to the left of the column where the selected cells are located, the second add control is used to indicate adding a column of cells to the right of the column where the selected cells are located, and the delete control is used to indicate deleting the cells in the column where the selected cells are located.

在一些实现方式中,若所述目标选择控件为所述删除控件,则所述修改事件为删除列事件;In some implementations, if the target selection control is the delete control, the modification event is a delete column event;

所述根据所述表格编辑事件更新所述数据结构,包括:The updating of the data structure according to the table editing event comprises:

在所述数据结构中,删除所述选中单元格所在列的各个单元格所对应的子数据,以得到更新后的数据结构;In the data structure, deleting the sub-data corresponding to each cell in the column where the selected cell is located, to obtain an updated data structure;

若所述目标选择控件为所述第一添加控件,则所述修改事件为第一添加列事件;If the target selection control is the first adding control, the modification event is a first adding column event;

所述根据所述表格编辑事件更新所述数据结构,包括:The updating of the data structure according to the table editing event comprises:

在所述数据结构中的第三位置添加一列单元格所对应的子数据,以得到更新后的数据结构,所述第三位置用于使得添加列的单元格位于所述选中单元格所在列的单元格的左侧;Adding sub-data corresponding to a column of cells at a third position in the data structure to obtain an updated data structure, wherein the third position is used to make the cells of the added column be located to the left of the cells in the column where the selected cell is located;

若所述目标选择控件为所述第二添加控件,则所述修改事件为第二添加列事件;If the target selection control is the second adding control, the modification event is a second adding column event;

所述根据所述表格编辑事件更新所述数据结构,包括:The updating of the data structure according to the table editing event comprises:

在所述数据结构中的第四位置添加一列单元格所对应的子数据,以得到更新后的数据结构,所述第四位置用于使得添加列的单元格位于所述选中单元格所在列的单元格的右侧。Add sub-data corresponding to a column of cells at a fourth position in the data structure to obtain an updated data structure, wherein the fourth position is used to make the cells of the added column to the right of the cells in the column where the selected cell is located.

在一些实现方式中,所述富文本编辑器中包括表格编辑插件和数据处理单元;In some implementations, the rich text editor includes a table editing plug-in and a data processing unit;

所述根据所述表格编辑事件更新所述数据结构,包括:The updating of the data structure according to the table editing event comprises:

通过所述表格编辑插件,确定所述表格编辑事件对应的更新指令;Determining, by means of the table editing plug-in, an update instruction corresponding to the table editing event;

所述表格编辑插件向所述数据处理单元发送所述更新指令,以使得所述数据处理单元根据所述更新指令更新所述数据结构。The table editing plug-in sends the update instruction to the data processing unit, so that the data processing unit updates the data structure according to the update instruction.

在这种实现方式中,针对删除列、在左侧添加列和右侧添加列的三种不同的事件,按照对应的方式,可以对数据结构中的相应位置进行相应的更新,从而可以有效的在表格中实现相应的事件操作,同时又可以保证表格中原有的内容的正确性。In this implementation, for the three different events of deleting columns, adding columns on the left, and adding columns on the right, the corresponding positions in the data structure can be updated accordingly, so that the corresponding event operations can be effectively implemented in the table while ensuring the correctness of the original content in the table.

第二方面,本申请实施例提出一种表格数据处理装置。该装置包括:In a second aspect, an embodiment of the present application provides a table data processing device. The device includes:

确定模块,用于响应作用于第一应用程序的图形用户界面中的表格编辑操作,确定表格编辑事件;a determination module, configured to determine a table editing event in response to a table editing operation in a graphical user interface of the first application;

获取模块,用于获取所述富文本编辑器中的第一富文本内容所对应的数据结构,并根据所述表格编辑事件更新所述数据结构;An acquisition module, used for acquiring a data structure corresponding to the first rich text content in the rich text editor, and updating the data structure according to the table editing event;

处理模块,用于根据更新后的数据结构,在所述富文本编辑器中显示所述更新后的数据结构所对应的第二富文本内容,所述第一富文本内容和/或所述第二富文本内容中包括表格;a processing module, configured to display, in the rich text editor, second rich text content corresponding to the updated data structure according to the updated data structure, wherein the first rich text content and/or the second rich text content includes a table;

所述富文本编辑器为基于网页视图开发的。The rich text editor is developed based on the web page view.

在一些实现方式中,所述第一应用程序的图形用户界面中包括表格插入控件;In some implementations, the graphical user interface of the first application includes a table insertion control;

所述确定模块具体用于:The determination module is specifically used for:

响应作用于所述表格插入控件的点击操作,在所述图形用户界面中显示调整控件,所述调整控件中包括多个预选单元格和/或文本输入框;In response to a click operation on the table insert control, an adjustment control is displayed in the graphical user interface, wherein the adjustment control includes a plurality of pre-selected cells and/or text input boxes;

响应作用于所述多个预选单元格的选择操作,或者,响应针对于所述文本输入框中的输入内容的确认操作,确定所述表格编辑事件为插入事件,所述选择操作以及所述确认操作用于指示表格尺寸,所述插入事件用于指示在所述富文本编辑器中插入所述表格尺寸对应的表格;In response to a selection operation on the plurality of pre-selected cells, or in response to a confirmation operation on input content in the text input box, determining that the table editing event is an insert event, the selection operation and the confirmation operation are used to indicate a table size, and the insert event is used to indicate inserting a table corresponding to the table size in the rich text editor;

其中,所述表格插入操作为所述选择操作或者所述确认操作。The table insert operation is the selection operation or the confirmation operation.

在一些实现方式中,所述处理模块具体用于:In some implementations, the processing module is specifically configured to:

根据所述插入事件,确定待插入表格的表格尺寸;Determine the table size of the table to be inserted according to the insert event;

根据所述表格尺寸,生成所述待插入表格对应的表格数据结构,所述表格数据结构中包括所述待插入表格中的多个单元格各自对应的子数据;Generate a table data structure corresponding to the table to be inserted according to the table size, wherein the table data structure includes sub-data corresponding to each of the plurality of cells in the table to be inserted;

将所述表格数据结构添加至所述数据结构中的目标位置,以得到更新后的数据结构。The table data structure is added to a target position in the data structure to obtain an updated data structure.

在一些实现方式中,所述处理模块还用于:In some implementations, the processing module is further configured to:

针对所述富文本编辑器中所显示的表格,响应作用于所述表格的选区操作,确定所述选区操作所对应的选中单元格;For a table displayed in the rich text editor, in response to a selection operation performed on the table, determining a selected cell corresponding to the selection operation;

根据所述选区操作所对应的选中单元格,确定选中框的位置信息,所述位置信息包括宽度、高度以及坐标位置;Determine the position information of the selected box according to the selected cell corresponding to the selection operation, wherein the position information includes width, height and coordinate position;

根据所述选中框的位置信息,在所述富文本编辑器中渲染并显示所述选中框。The check box is rendered and displayed in the rich text editor according to the position information of the check box.

在一些实现方式中,所述富文本编辑器中显示有行选中控件和列选中控件;In some implementations, a row selection control and a column selection control are displayed in the rich text editor;

所述选区操作为针对所述行选择控件的点击操作,则所述选区操作所对应的选中单元格为所述行选择控件对应的选中行中的多个单元格;或者,The selection operation is a click operation on the row selection control, and the selected cells corresponding to the selection operation are multiple cells in the selected row corresponding to the row selection control; or,

所述选区操作为针对所述列选中控件的点击操作,则所述选区操作所对应的选中单元格为所述列选择控件对应的选中列中的多个单元格。The selection operation is a click operation on the column selection control, and the selected cells corresponding to the selection operation are multiple cells in the selected column corresponding to the column selection control.

在一些实现方式中,所述选区操作为作用于所述表格的拖拽操作;In some implementations, the selection operation is a drag operation on the table;

所述选区操作所对应的选中单元格为所述拖拽操作所形成的拖拽范围内所包括的单元格。The selected cells corresponding to the area selection operation are cells included in the drag range formed by the drag operation.

在一些实现方式中,所述确定模块具体用于:In some implementations, the determining module is specifically configured to:

响应作用于所述选中单元格的触发操作,显示至少一个选择控件,所述选择控件包括如下中的至少一种:删除控件、第一添加控件以及第二添加控件;In response to a trigger operation acting on the selected cell, displaying at least one selection control, the selection control comprising at least one of the following: a delete control, a first add control, and a second add control;

响应作用于所述至少一个选择控件中的目标选择控件的点击操作,确定所述表格编辑事件为修改事件。In response to a click operation on a target selection control among the at least one selection control, the table editing event is determined to be a modification event.

在一些实现方式中,所述选中单元格在所述表格中位于同一行,则所述第一添加控件用于指示在所述选中单元格所在行的上方添加一行单元格,所述第二添加控件用于指示在所述选中单元格所在行的下方添加一行单元格,所述删除控件用于指示删除所述选中单元格所在行的单元格。In some implementations, the selected cells are located in the same row in the table, and the first add control is used to indicate adding a row of cells above the row where the selected cells are located, the second add control is used to indicate adding a row of cells below the row where the selected cells are located, and the delete control is used to indicate deleting the cells in the row where the selected cells are located.

在一些实现方式中,若所述目标选择控件为所述删除控件,则所述修改事件为删除行事件;In some implementations, if the target selection control is the delete control, the modification event is a delete row event;

所述处理模块具体用于:The processing module is specifically used for:

在所述数据结构中,删除所述选中单元格所在行的各个单元格所对应的子数据,以得到更新后的数据结构;In the data structure, deleting the sub-data corresponding to each cell in the row where the selected cell is located, to obtain an updated data structure;

若所述目标选择控件为所述第一添加控件,则所述修改事件为第一添加行事件;If the target selection control is the first add control, the modification event is a first add row event;

所述处理模块具体用于:The processing module is specifically used for:

在所述数据结构中的第一位置添加一行单元格所对应的子数据,以得到更新后的数据结构,所述第一位置用于使得添加行的单元格位于所述选中单元格所在行的单元格的上方;Adding sub-data corresponding to a row of cells at a first position in the data structure to obtain an updated data structure, wherein the first position is used to make the cells of the added row be located above the cells of the row where the selected cell is located;

若所述目标选择控件为所述第二添加控件,则所述修改事件为第二添加行事件;If the target selection control is the second adding control, the modification event is a second adding row event;

所述处理模块具体用于:The processing module is specifically used for:

在所述数据结构中的第二位置添加一行单元格所对应的子数据,以得到更新后的数据结构,所述第二位置用于使得添加行的单元格位于所述选中单元格所在行的单元格的下方。Sub-data corresponding to a row of cells are added at a second position in the data structure to obtain an updated data structure, wherein the second position is used to make the cells of the added row located below the cells of the row where the selected cell is located.

在一些实现方式中,所述选中单元格在所述表格中位于同一列,则所述第一添加控件用于指示在所述选中单元格所在列的左侧添加一列单元格,所述第二添加控件用于指示在所述选中单元格所在列的右侧添加一列单元格,所述删除控件用于指示删除所述选中单元格所在列的单元格。In some implementations, the selected cells are located in the same column in the table, and the first add control is used to indicate adding a column of cells to the left of the column where the selected cells are located, the second add control is used to indicate adding a column of cells to the right of the column where the selected cells are located, and the delete control is used to indicate deleting the cells in the column where the selected cells are located.

在一些实现方式中,若所述目标选择控件为所述删除控件,则所述修改事件为删除列事件;In some implementations, if the target selection control is the delete control, the modification event is a delete column event;

所述处理模块具体用于:The processing module is specifically used for:

在所述数据结构中,删除所述选中单元格所在列的各个单元格所对应的子数据,以得到更新后的数据结构;In the data structure, deleting the sub-data corresponding to each cell in the column where the selected cell is located, to obtain an updated data structure;

若所述目标选择控件为所述第一添加控件,则所述修改事件为第一添加列事件;If the target selection control is the first adding control, the modification event is a first adding column event;

所述处理模块具体用于:The processing module is specifically used for:

在所述数据结构中的第三位置添加一列单元格所对应的子数据,以得到更新后的数据结构,所述第三位置用于使得添加列的单元格位于所述选中单元格所在列的单元格的左侧;Adding sub-data corresponding to a column of cells at a third position in the data structure to obtain an updated data structure, wherein the third position is used to make the cells of the added column be located to the left of the cells in the column where the selected cell is located;

若所述目标选择控件为所述第二添加控件,则所述修改事件为第二添加列事件;If the target selection control is the second adding control, the modification event is a second adding column event;

所述处理模块具体用于:The processing module is specifically used for:

在所述数据结构中的第四位置添加一列单元格所对应的子数据,以得到更新后的数据结构,所述第四位置用于使得添加列的单元格位于所述选中单元格所在列的单元格的右侧。Add sub-data corresponding to a column of cells at a fourth position in the data structure to obtain an updated data structure, wherein the fourth position is used to make the cells of the added column to the right of the cells in the column where the selected cell is located.

在一些实现方式中,所述富文本编辑器中包括表格编辑插件和数据处理单元;In some implementations, the rich text editor includes a table editing plug-in and a data processing unit;

所述处理模块具体用于:The processing module is specifically used for:

通过所述表格编辑插件,确定所述表格编辑事件对应的更新指令;Determining, by means of the table editing plug-in, an update instruction corresponding to the table editing event;

所述表格编辑插件向所述数据处理单元发送所述更新指令,以使得所述数据处理单元根据所述更新指令更新所述数据结构。The table editing plug-in sends the update instruction to the data processing unit, so that the data processing unit updates the data structure according to the update instruction.

第三方面,本申请实施例提供一种终端设备,终端设备也可以称为终端(terminal)、用户设备(user equipment,UE)、移动台(mobile station,MS)、移动终端(mobile terminal,MT)等。终端设备可以是手机(mobile phone)、智能电视、穿戴式设备、平板电脑(Pad)、带无线收发功能的电脑、虚拟现实(virtual reality,VR)终端设备、增强现实(augmented reality,AR)终端设备、工业控制(industrial control)中的无线终端、无人驾驶(self-driving)中的无线终端、远程手术(remote medical surgery)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端等等。In a third aspect, an embodiment of the present application provides a terminal device, which may also be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. The terminal device may be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, etc.

该终端设备包括:包括:处理器和存储器;存储器存储计算机执行指令;处理器执行存储器存储的计算机执行指令,使得终端设备执行如第一方面的方法。The terminal device comprises: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the method of the first aspect.

第四方面,本申请实施例提供一种计算机可读存储介质,计算机可读存储介质存储有计算机程序。计算机程序被处理器执行时实现如第一方面的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the method of the first aspect is implemented.

第五方面,本申请实施例提供一种计算机程序产品,计算机程序产品包括计算机程序,当计算机程序被运行时,使得计算机执行如第一方面的方法。In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the method of the first aspect.

第六方面,本申请实施例提供了一种芯片,芯片包括处理器,处理器用于调用存储器中的计算机程序,以执行如第一方面所述的方法。In a sixth aspect, an embodiment of the present application provides a chip, the chip including a processor, the processor being used to call a computer program in a memory to execute the method described in the first aspect.

应当理解的是,本申请的第二方面至第五方面与本申请的第一方面的技术方案案相对应,各方面及对应的可行实施方式所取得的有益效果相似,不再赘述。It should be understood that the second to fifth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here.

本申请实施例提供一种表格数据处理方法及装置,该方法包括:响应作用于第一应用程序的图形用户界面中的表格编辑操作,确定表格编辑事件。获取富文本编辑器中的第一富文本内容所对应的数据结构,并根据表格编辑事件更新数据结构。根据更新后的数据结构,在富文本编辑器中显示更新后的数据结构所对应的第二富文本内容,第一富文本内容和/或第二富文本内容中包括表格。通过网页视图开发富文本编辑器,从而可以通过对富文本编辑器中的富文本内容的数据结构进行更新,以在富文本编辑器中显出编辑之后的富文本内容,其中编辑之前的富文本内容和/或编辑之后的富文本内容中可以包括表格,而表格编辑的具体处理是通过数据结构的更新完成的,因此可以简单有效的实现富文本编辑器支持表格编辑功能,以提升富文本编辑器的功能的全面性。An embodiment of the present application provides a table data processing method and device, the method comprising: responding to a table editing operation in a graphical user interface acting on a first application, determining a table editing event. Obtaining a data structure corresponding to a first rich text content in a rich text editor, and updating the data structure according to a table editing event. According to the updated data structure, displaying a second rich text content corresponding to the updated data structure in the rich text editor, wherein the first rich text content and/or the second rich text content include a table. A rich text editor is developed through a web page view, so that the data structure of the rich text content in the rich text editor can be updated to display the edited rich text content in the rich text editor, wherein the rich text content before editing and/or the rich text content after editing may include a table, and the specific processing of the table editing is completed by updating the data structure, so that the rich text editor can simply and effectively support the table editing function to enhance the comprehensiveness of the functions of the rich text editor.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1为本申请实施例提供的富文本编辑器的架构示意图;FIG1 is a schematic diagram of the architecture of a rich text editor provided in an embodiment of the present application;

图2为本申请实施例提供的富文本编辑器对应的第一应用程序的界面示意图一;FIG2 is a first schematic diagram of an interface of a first application corresponding to a rich text editor provided in an embodiment of the present application;

图3为本申请实施例提供的富文本编辑器对应的第一应用程序的界面示意图二;FIG3 is a second schematic diagram of an interface of a first application corresponding to a rich text editor provided in an embodiment of the present application;

图4为本申请实施例提供的表格数据处理方法的流程图;FIG4 is a flow chart of a table data processing method provided in an embodiment of the present application;

图5为本申请实施例提供的表格数据处理方法的流程图二;FIG5 is a second flowchart of the table data processing method provided in an embodiment of the present application;

图6为本申请实施例提供的插入表格的实现示意图;FIG6 is a schematic diagram of an implementation of an insert table provided in an embodiment of the present application;

图7为本申请实施例提供的表格数据处理方法的流程图三;FIG. 7 is a flowchart of a third method for processing table data provided in an embodiment of the present application;

图8为本申请实施例提供的在表格中确定选取的实现示意图一;FIG8 is a schematic diagram of a method for determining a selection in a table according to an embodiment of the present application;

图9为本申请实施例提供的在表格中确定选取的实现示意图二;FIG9 is a second schematic diagram of an implementation of determining a selection in a table provided in an embodiment of the present application;

图10为本申请实施例提供的在表格中确定选取的实现示意图三;FIG10 is a third schematic diagram of an implementation of determining a selection in a table provided in an embodiment of the present application;

图11为本申请实施例提供的表格数据处理方法的流程图四;FIG11 is a fourth flowchart of the table data processing method provided in an embodiment of the present application;

图12为本申请实施例提供的修改表格的实现示意图一;FIG12 is a schematic diagram of a modification table provided in an embodiment of the present application;

图13为本申请实施例提供的修改表格的实现示意图二;FIG13 is a second schematic diagram of implementing a modification table provided in an embodiment of the present application;

图14为本申请实施例提供的表格处理方法的处理过程示意图;FIG14 is a schematic diagram of the processing process of the table processing method provided in an embodiment of the present application;

图15为本申请实施例提供的表格数据处理装置的结构示意图;FIG15 is a schematic diagram of the structure of a table data processing device provided in an embodiment of the present application;

图16为本申请实施例提供的终端设备的硬件结构示意图。FIG16 is a schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

为了便于清楚描述本申请实施例的技术方案,本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

本申请实施例中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b,或c中的至少一项(个),可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And/or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and/or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character "/" generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c can be single or multiple.

需要说明的是,本申请实施例中的“在……时”,可以为在某种情况发生的瞬时,也可以为在某种情况发生后的一段时间内,本申请实施例对此不作具体限定。此外,本申请实施例提供的显示界面仅作为示例,显示界面还可以包括更多或更少的内容。It should be noted that the "at..." in the embodiment of the present application can be the instant when a certain situation occurs, or can be a period of time after a certain situation occurs, and the embodiment of the present application does not specifically limit this. In addition, the display interface provided in the embodiment of the present application is only an example, and the display interface can also include more or less content.

为了更好的理解本申请的技术方案,下面对本申请所涉及的相关技术进行进一步的详细介绍。In order to better understand the technical solution of the present application, the relevant technologies involved in the present application are further introduced in detail below.

随着信息技术的发展,智能终端在人们生活中发挥着越来越重要的作用,用户在有待办事项或需要记录的事件时,倾向于将相关内容记录在备忘录等应用软件中。用户所要记录的内容,除了简单的基本文字外,还可能包括表格、图片等信息,这时候要求备忘录等应用具备富文本编辑功能。With the development of information technology, smart terminals are playing an increasingly important role in people's lives. When users have to-do items or events that need to be recorded, they tend to record the relevant content in applications such as memos. In addition to simple basic text, the content that users want to record may also include tables, pictures and other information. At this time, applications such as memos are required to have rich text editing functions.

表格是一种可以有序的组织整理数据的数据结构,如果可以在富文本编辑器中支持表格的处理,则可以有效的提升富文本编辑器的实用性。然而,目前的富文本编辑器通常都是基于系统的原生框架开发的,而基于系统原生框架实现表格功能以及相应的复杂交互逻辑,是及其困难的,因此目前基于系统原生框架开发的富文本编辑器通常都不支持表格编辑功能。A table is a data structure that can organize data in an orderly manner. If the processing of tables can be supported in a rich text editor, the practicality of the rich text editor can be effectively improved. However, current rich text editors are usually developed based on the system's native framework, and it is extremely difficult to implement table functions and corresponding complex interaction logic based on the system's native framework. Therefore, the current rich text editors developed based on the system's native framework usually do not support table editing functions.

比如说目前安卓系统的终端设备所内置的备忘录就缺少表格相关的操作,因为基于安卓系统原生的native框架实现表格以及相应的复杂交互逻辑是非常困难的,因此目前众多的系统自带备忘录中都缺失了编辑表格的功能,或者是不支持较为复杂的表格编辑功能。并且可以理解的是,不仅仅是系统自带的备忘录存在上述问题,也不仅仅是安卓系统存在上述问题,各个系统中的轻量级的富文本编辑器都是类似的,因为系统原生框架的限制以及表格功能实现的复杂程度,富文本编辑器实现表格编辑功能是较为困难的,进而会导致富文本编辑器的功能缺少全面性。For example, the memo built into the terminal devices of the current Android system lacks table-related operations, because it is very difficult to implement tables and the corresponding complex interaction logic based on the native framework of the Android system. Therefore, many of the system's built-in memos currently lack the function of editing tables, or do not support more complex table editing functions. And it is understandable that the above problems exist not only in the system's built-in memos, nor in the Android system. The lightweight rich text editors in various systems are similar. Due to the limitations of the system's native framework and the complexity of implementing table functions, it is difficult for rich text editors to implement table editing functions, which in turn leads to the lack of comprehensiveness of the rich text editor's functions.

基于相关技术中的技术问题,本申请提出了如下技术构思:基于网页视图(webview)开发富文本编辑器,其中webview技术可以通过对JSON(JavaScript ObjectNotation,JS对象简谱)格式的数据结构的修改,以实现对富文本编辑器中的富文本内容的显示样式的修改,因此富文本编辑器就可以简单有效的实现对表格编辑功能的支持,从而可以有效的提升富文本编辑器的功能全面性。Based on the technical problems in the related technology, the present application proposes the following technical concept: developing a rich text editor based on a web view (webview), wherein the webview technology can modify the display style of the rich text content in the rich text editor by modifying the data structure in the JSON (JavaScript Object Notation, JS object notation) format. Therefore, the rich text editor can simply and effectively support the table editing function, thereby effectively improving the comprehensiveness of the functions of the rich text editor.

在介绍本申请提供的表格处理方法之前,比如说可以首先结合图1进行理解富文本编辑器的相关架构,图1为本申请实施例提供的富文本编辑器的架构示意图。Before introducing the table processing method provided by the present application, for example, you can first understand the relevant architecture of the rich text editor in conjunction with Figure 1. Figure 1 is a schematic diagram of the architecture of the rich text editor provided in an embodiment of the present application.

如图1所示,本申请的技术方案中可以开发一个富文本编辑器产品,之后将这个富文本编辑器产品集成到不同的终端平台上。As shown in FIG. 1 , in the technical solution of the present application, a rich text editor product can be developed, and then the rich text editor product can be integrated into different terminal platforms.

在图1的示例中,以Android平台和Windows平台两个平台为例,介绍富文本编辑器的架构。参照图1可以确定的是,本实施例中的富文本编辑器可以同时作为Android平台中的Android产品以及Windows平台中的桌面(Desktop)产品。In the example of Figure 1, the architecture of the rich text editor is introduced by taking the Android platform and the Windows platform as examples. Referring to Figure 1, it can be determined that the rich text editor in this embodiment can be used as an Android product in the Android platform and a desktop product in the Windows platform at the same time.

在一种可能的实现方式中,富文本编辑器通常都是集成在应用程序中,从而为相应的应用程序提供富文本编辑功能,下面以Android端的备忘录和PC端的备忘录这两个应用程序为例进行说明。然而可以理解的是,针对其余的需要集成富文本编辑器的应用程序,其实现方式是类似的,此处不再赘述。In a possible implementation, a rich text editor is usually integrated into an application, thereby providing a rich text editing function for the corresponding application. The following takes the Android-side memo and the PC-side memo as examples for illustration. However, it is understandable that for other applications that need to integrate a rich text editor, the implementation method is similar and will not be repeated here.

下面结合图1首先对Android段的备忘录进行说明,其中Android端备忘录为具有富文本编辑功能的一款应用程序。参照图1可以确定的是,在Android端备忘录中,包括Native(原生)层和Webview(网页视图)层。The following first describes the memo of the Android side in conjunction with Figure 1, wherein the Android side memo is an application with a rich text editing function. Referring to Figure 1, it can be determined that the Android side memo includes a Native layer and a Webview layer.

其中,Native层中包含Activity(活动)组件、View(视图)组件、Button(按键)组件和用户事件处理单元,Activity组件、View组件和Button组件为Android原生用户界面(User Interface,UI)框架的一部分,可以实现UI渲染,用户在使用该备忘录过程中交互的可视界面由Native层中的组件渲染所得。用户事件处理单元可以监听UI界面中的事件,从而获取用户的意图,例如对文字部分设置粗体、设置斜体或设置文字字号。The Native layer includes Activity components, View components, Button components, and a user event processing unit. Activity components, View components, and Button components are part of the Android native user interface (UI) framework, which can implement UI rendering. The visual interface that users interact with during the use of the memo is rendered by components in the Native layer. The user event processing unit can monitor events in the UI interface to obtain the user's intention, such as setting bold, italic, or font size for a text part.

通过JS-Android通信接口,事件处理单元可以将监听到的事件传递至Webview层。Webview层包括接口层和富文本编辑器,接口层中的Html(Hyper Text Markup Language,超文本标记语言)布局、CSS(Cascading Style Sheets,层叠样式表)样式、JS加载单元用于渲染除了富文本编辑器之外的组件,JS接口作为承载JS和Android层的通信接口。富文本编辑器用于实现用户对富文本内容的编辑。Through the JS-Android communication interface, the event processing unit can pass the monitored events to the Webview layer. The Webview layer includes the interface layer and the rich text editor. The Html (Hyper Text Markup Language) layout, CSS (Cascading Style Sheets) style, and JS loading unit in the interface layer are used to render components other than the rich text editor. The JS interface serves as the communication interface between the JS and Android layers. The rich text editor is used to enable users to edit rich text content.

下面再结合图1对个人电脑(Personal Computer,PC)端的备忘录进行说明。其中PC端备忘录可以运行在Windows平台中,如图1所示,对于PC端备忘录而言,该应用程序建立在网页视图层上。其中,在网页视图层中可以包括UI渲染单元、用户事件处理单元、指令处理单元以及富文本编辑器。The following is an explanation of the memo on the personal computer (PC) side in conjunction with Figure 1. The PC side memo can run on the Windows platform. As shown in Figure 1, for the PC side memo, the application is built on the web view layer. The web view layer may include a UI rendering unit, a user event processing unit, a command processing unit, and a rich text editor.

在UI渲染单元中又包括React组件、Html布局子单元和CSS样式子单元。其中,PC端备忘录可以通过React框架进行UI渲染,以及用户事件处理单元可以监听UI层的事件,并识别用户意图。在指令处理单元中,可以进一步的将用户意图转化为指令,通过一系列的指令订阅、指令匹配、指令分发等操作,将指令传递到富文本编辑器中,富文本编辑器根据所接受到的指令实现用户意图的编辑行为。The UI rendering unit includes React components, Html layout subunits, and CSS style subunits. Among them, the PC-side memo can be rendered in the UI through the React framework, and the user event processing unit can monitor events at the UI layer and identify user intentions. In the instruction processing unit, the user intention can be further converted into instructions, and the instructions are passed to the rich text editor through a series of instruction subscription, instruction matching, instruction distribution and other operations. The rich text editor implements the editing behavior of the user's intention according to the received instructions.

在图1的示意中,在Windows平台对应的PC端备忘录中部署有富文本编辑器,以及在安卓平台所对应的安卓端备忘录中也部署有富文本编辑器,在不同的平台上部署的实际上都是图1的中间部分所示的富文本编辑器。以及图1仅仅是示例性的介绍了将富文本编辑器部署在Windows平台和安卓平台的实现,实际上富文本编辑器可以部署在各种可能的平台中,具体的部署平台可以根据实际需求进行选择和设置。In the diagram of FIG1 , a rich text editor is deployed in the PC-side memo corresponding to the Windows platform, and a rich text editor is also deployed in the Android-side memo corresponding to the Android platform. In fact, the rich text editors deployed on different platforms are all the rich text editors shown in the middle part of FIG1 . FIG1 is merely an exemplary introduction to the implementation of deploying the rich text editor on the Windows platform and the Android platform. In fact, the rich text editor can be deployed on various possible platforms, and the specific deployment platform can be selected and set according to actual needs.

以及参照图1可以确定的是,本实施例中的富文本编辑器中可以包括五部分,分别是:渲染机制、历史记录、插件机制、行为控制和数据结构。As can be determined with reference to FIG. 1 , the rich text editor in this embodiment may include five parts, namely: a rendering mechanism, a history record, a plug-in mechanism, a behavior control, and a data structure.

其中,渲染机制还可以称为第一渲染单元,用于对富文本编辑器中的内容进行渲染并显示。历史记录也可以称为记录单元,用于记录富文本编辑器中的操作。插接机制也可以称为插件单元,在插件单元中包括多个插件,每个插件用于实现不同的功能,比如说本实施例中的表格编辑操作就可以是插件单元中的表格编辑插件实现的。行为控制也可以称为执行单元,用于对插件机制解析得到的相关数据进行封装,以得到数据结构可以识别的指令。数据结构也可以称为数据处理单元,用于根据行为控制生成的指令,对JSON格式富文本数据对应的数据结构进行更改。Among them, the rendering mechanism can also be called the first rendering unit, which is used to render and display the content in the rich text editor. The history record can also be called a recording unit, which is used to record the operations in the rich text editor. The plug-in mechanism can also be called a plug-in unit, which includes multiple plug-ins, and each plug-in is used to implement different functions. For example, the table editing operation in this embodiment can be implemented by the table editing plug-in in the plug-in unit. Behavior control can also be called an execution unit, which is used to encapsulate the relevant data parsed by the plug-in mechanism to obtain instructions that can be recognized by the data structure. The data structure can also be called a data processing unit, which is used to change the data structure corresponding to the rich text data in JSON format according to the instructions generated by the behavior control.

在上述介绍内容的基础上,下面比如说可以结合图2和图3对PC端的备忘录和安卓端的备忘录的操作界面进行理解。图2为本申请实施例提供的富文本编辑器对应的第一应用程序的界面示意图一,图3为本申请实施例提供的富文本编辑器对应的第一应用程序的界面示意图二。Based on the above introduction, the operation interface of the memo on the PC side and the memo on the Android side can be understood by combining Figures 2 and 3. Figure 2 is a schematic diagram of the interface of the first application corresponding to the rich text editor provided in the embodiment of the present application, and Figure 3 is a schematic diagram of the interface of the first application corresponding to the rich text editor provided in the embodiment of the present application.

如图2所示,备忘录的图形用户界面包括文件列表、笔记列表和用户事件响应区。其中,文件列表显示用户的文件分类,笔记列表显示文件夹中存储的富文本列表,用户事件响应区显示用户可以对富文本内容执行的编辑操作。以及备忘录的图形用户界面中还包括富文本编辑器区,用户可以在该区域内进行富文本内容的编辑。As shown in Figure 2, the graphical user interface of the memo includes a file list, a note list, and a user event response area. The file list displays the user's file classification, the note list displays the rich text list stored in the folder, and the user event response area displays the editing operations that the user can perform on the rich text content. The graphical user interface of the memo also includes a rich text editor area, in which the user can edit the rich text content.

以及图3示意了安卓端的备忘录的界面示意图,其与图2介绍的PC端备忘录的界面类似,此处不再赘述。FIG3 is a schematic diagram of the interface of the memo on the Android side, which is similar to the interface of the memo on the PC side introduced in FIG2 , and will not be described again here.

结合图2和图3可以理解的是,在不同平台的设备中均可以设置有包含富文本编辑器的应用程序,这类应用程序基于富文本编辑器就可以提供富文本编辑功能,本申请的技术方案的具体应用设备以及具体应用平台,可以根据实际需求进行选择和设置,本实施例对此不做限制。In combination with Figures 2 and 3, it can be understood that an application program including a rich text editor can be provided in devices of different platforms. Such an application program can provide rich text editing functions based on the rich text editor. The specific application device and specific application platform of the technical solution of the present application can be selected and set according to actual needs, and this embodiment does not impose any restrictions on this.

在上述介绍内容的基础上,下面结合图4对本申请提供的表格数据处理方法的具体实现进行说明。图4为本申请实施例提供的表格数据处理方法的流程图。Based on the above introduction, the specific implementation of the table data processing method provided by the present application is described below in conjunction with Figure 4. Figure 4 is a flow chart of the table data processing method provided by an embodiment of the present application.

如图4所示,该方法包括:As shown in FIG4 , the method includes:

S401、响应作用于第一应用程序的图形用户界面中的表格编辑操作,确定表格编辑事件。S401: In response to a table editing operation in a graphical user interface of a first application, determine a table editing event.

本实施例的方法可以应用于第一应用程序中,在第一应用程序中包括富文本编辑器。在实际实现过程中,第一应用程序比如说可以是上述介绍的备忘录应用程序,但是并不限于上述介绍的备忘录,其可以是任意的需要富文本编辑功能的应用程序,比如说支持富文本编辑功能的即时通信应用程序、支持富文本编辑功能的文档应用程序等等,本实施例对第一应用程序的具体实现不做限制。The method of this embodiment can be applied to a first application, and the first application includes a rich text editor. In the actual implementation process, the first application can be, for example, the memo application introduced above, but is not limited to the memo introduced above, and can be any application that requires a rich text editing function, such as an instant messaging application that supports a rich text editing function, a document application that supports a rich text editing function, etc. This embodiment does not limit the specific implementation of the first application.

因为本实施例中的第一应用程序可以支持表格编辑的功能,用户可以在第一应用程序的图形用户界面中输入表格编辑操作,其中表格编辑操作比如说可以是针对表格编辑控件的点击操作、长按操作、滑动操作等等,本实施例对表格编辑操作的具体实现方式不做限制,其取决于第一应用程序具体如何设置表格编辑功能的相关控件。Because the first application in this embodiment can support the table editing function, the user can input the table editing operation in the graphical user interface of the first application, where the table editing operation can be, for example, a click operation, a long press operation, a sliding operation, etc. on the table editing control. This embodiment does not limit the specific implementation method of the table editing operation, which depends on how the first application specifically sets the relevant controls of the table editing function.

在第一应用程序监听到用户输入的表格编辑操作之后,可以响应于该表格编辑操作,确定表格编辑操作所触发的表格编辑事件。可以理解的是,不同的表格编辑操作可以对应触发不同的表格编辑事件,在一种可能的实现方式中,表格编辑事件比如说可以包括插入表格的插入事件,或者还可以包括修改表格的修改事件,或者还可以包括删除表格的删除事件。After the first application monitors the table editing operation input by the user, the table editing event triggered by the table editing operation can be determined in response to the table editing operation. It can be understood that different table editing operations can trigger different table editing events. In a possible implementation, the table editing event can include an insert event for inserting a table, or a modify event for modifying a table, or a delete event for deleting a table.

S402、获取富文本编辑器中的第一富文本内容所对应的数据结构,并根据表格编辑事件更新数据结构。S402: Acquire a data structure corresponding to the first rich text content in the rich text editor, and update the data structure according to a table editing event.

基于上述介绍可以确定的是,用户可以在富文本编辑器中编辑富文本内容,本实施例中将进行表格编辑操作之前的富文本编辑器中的富文本内容称为第一富文本内容,其中第一富文本内容可能为空,也可能不为空,其取决于具体的实现,本实施例对此不做限制。Based on the above introduction, it can be determined that users can edit rich text content in a rich text editor. In this embodiment, the rich text content in the rich text editor before the table editing operation is performed is referred to as the first rich text content, where the first rich text content may be empty or not empty, which depends on the specific implementation, and this embodiment does not limit this.

在本实施例中,针对富文本编辑器中的第一富文本内容,在初始化富文本编辑器的过程中,例如已经生成了第一富文本内容所对应的数据结构。在一种可能的实现方式中,若第一富文本内容为空,则第一富文本内容所对应的数据结构就是一个空的数据结构。或者,若第一富文本内容不为空,则数据结构可以反映出第一富文本内容具体的富文本结构以及富文本内容。其中数据结构比如说可以是JSON格式的。In this embodiment, for the first rich text content in the rich text editor, in the process of initializing the rich text editor, for example, a data structure corresponding to the first rich text content has been generated. In one possible implementation, if the first rich text content is empty, the data structure corresponding to the first rich text content is an empty data structure. Alternatively, if the first rich text content is not empty, the data structure can reflect the specific rich text structure and rich text content of the first rich text content. The data structure can be in JSON format, for example.

则可以直接获取第一富文本编辑器中的第一富文本内容所对应的数据结构,可以理解的是,上述的表格编辑操作用于指示在第一富文本编辑器中触发相应的表格编辑事件,其中具体的表格编辑事件就可以指示在第一富文本编辑器进行相应的表格编辑,比如说插入表格、修改表格或者删除表格。那么相应的,这些表格编辑事件就会对富文本编辑器中的第一符文本内容进行相应的修改,那么对应的,第一富文本内容所对应的数据结构也需要进行相应的更新,因此本实施例中可以根据表格编辑事件更新第一富文本内容所对应的数据结构。Then the data structure corresponding to the first rich text content in the first rich text editor can be directly obtained. It can be understood that the above-mentioned table editing operation is used to indicate the triggering of the corresponding table editing event in the first rich text editor, wherein the specific table editing event can indicate the corresponding table editing in the first rich text editor, such as inserting a table, modifying a table, or deleting a table. Then correspondingly, these table editing events will make corresponding modifications to the first rich text content in the rich text editor, and correspondingly, the data structure corresponding to the first rich text content also needs to be updated accordingly. Therefore, in this embodiment, the data structure corresponding to the first rich text content can be updated according to the table editing event.

在一种可能的实现方式中,针对不同的表格编辑事件,其相应的数据结构更新方式也存在一定的差异,其中具体的表格编辑事件以及相应的数据结构的更新方式均可以根据实际需求进行选择和设置,只要保证修改之后的数据结构可以反映出来表格编辑事件所指示的改变即可。In one possible implementation, there are certain differences in the corresponding data structure update methods for different table editing events. The specific table editing events and the corresponding data structure update methods can be selected and set according to actual needs, as long as the modified data structure can reflect the changes indicated by the table editing event.

S403、根据更新后的数据结构,在富文本编辑器中显示更新后的数据结构所对应的第二富文本内容,第一富文本内容和/或第二富文本内容中包括表格;S403: displaying, in a rich text editor, second rich text content corresponding to the updated data structure according to the updated data structure, wherein the first rich text content and/or the second rich text content includes a table;

可以理解的是,基于网页视图所开发的富文本编辑器,在富文本编辑器中所显示的富文本内容具体的显示样式和显示内容,就是根据数据结构进行相应的渲染实现的。因此本实施例中在更新数据结构之后,可以在富文本编辑器中渲染并显示更新后的数据结构所对应的第二富文本内容。It is understandable that the specific display style and content of the rich text content displayed in the rich text editor developed based on the web page view are realized by rendering the data structure accordingly. Therefore, in this embodiment, after the data structure is updated, the second rich text content corresponding to the updated data structure can be rendered and displayed in the rich text editor.

因此本实施例中的更新后的数据结构,是基于表格编辑操作所对应的表格更新事件,对第一富文本内容的数据结构进行更新得到的,因此基于更新后的数据结构所渲染得到的第二富文本内容,实际上就是表格编辑操作针对第一富文本内容触发相应的表格编辑事件后,所呈现出的修改后的富文本内容,因此可以有效的在富文本编辑器中实现表格操作。Therefore, the updated data structure in this embodiment is obtained by updating the data structure of the first rich text content based on the table update event corresponding to the table editing operation. Therefore, the second rich text content rendered based on the updated data structure is actually the modified rich text content presented after the table editing operation triggers the corresponding table editing event for the first rich text content. Therefore, table operations can be effectively implemented in the rich text editor.

在本实施例中,在第一富文本内容和/或第二富文本内容中可以包括表格。在一种可能的实现方式中,比如说第一富文本内容中本身不存在表格,其中表格编辑操作用于触发在富文本编辑器中插入表格,则基于上述介绍的处理过程之后,在第二富文本内容中就包括表格。In this embodiment, a table may be included in the first rich text content and/or the second rich text content. In a possible implementation, for example, if there is no table in the first rich text content itself, and the table editing operation is used to trigger the insertion of a table in the rich text editor, then based on the above-described processing procedure, the table is included in the second rich text content.

或者,比如说在第一富文本内容中本身存在表格,其中表格编辑操作用于触发删除第一富文本内容中的表格,则基于上述介绍的处理过程之后,在第二富文本内容中就不存在被删除了的表格。Or, for example, if there is a table in the first rich text content, and the table editing operation is used to trigger deletion of the table in the first rich text content, then based on the processing procedure described above, the deleted table will not exist in the second rich text content.

或者,比如说在第一富文本内容中本身存在表格,其中表格编辑操作用于触发修改第一富文本内容中的表格,则基于上述介绍的处理过程之后,在第二富文本内容中所包括的表格,相对于第一富文本内容中所包括的表格,就进行了相应的修改。Or, for example, if there is a table in the first rich text content, and the table editing operation is used to trigger the modification of the table in the first rich text content, then based on the processing procedure introduced above, the table included in the second rich text content is modified accordingly relative to the table included in the first rich text content.

本申请实施例提供的表格数据处理方法,包括:响应作用于第一应用程序的图形用户界面中的表格编辑操作,确定表格编辑事件。获取富文本编辑器中的第一富文本内容所对应的数据结构,并根据表格编辑事件更新数据结构。根据更新后的数据结构,在富文本编辑器中显示更新后的数据结构所对应的第二富文本内容,第一富文本内容和/或第二富文本内容中包括表格。通过网页视图开发富文本编辑器,从而可以通过对富文本编辑器中的富文本内容的数据结构进行更新,以在富文本编辑器中显出编辑之后的富文本内容,其中编辑之前的富文本内容和/或编辑之后的富文本内容中可以包括表格,而表格编辑的具体处理是通过数据结构的更新完成的,因此可以简单有效的实现富文本编辑器支持表格编辑功能,以提升富文本编辑器的功能的全面性。The table data processing method provided in the embodiment of the present application includes: responding to the table editing operation in the graphical user interface acting on the first application, determining the table editing event. Obtaining the data structure corresponding to the first rich text content in the rich text editor, and updating the data structure according to the table editing event. According to the updated data structure, the second rich text content corresponding to the updated data structure is displayed in the rich text editor, and the first rich text content and/or the second rich text content include a table. The rich text editor is developed through the web page view, so that the data structure of the rich text content in the rich text editor can be updated to display the edited rich text content in the rich text editor, wherein the rich text content before editing and/or the rich text content after editing may include a table, and the specific processing of the table editing is completed by updating the data structure, so that the rich text editor can simply and effectively support the table editing function to enhance the comprehensiveness of the functions of the rich text editor.

在上述介绍内容的基础上,可以理解的是,可以存在多种表格编辑事件,以及触发表格编辑事件的表格编辑操作也可以存在相应的实现,下面结合具体的实施例对多种不同的表格编辑事件分别进行介绍。Based on the above introduction, it can be understood that there may be a variety of table editing events, and the table editing operations that trigger the table editing events may also have corresponding implementations. The following introduces a variety of different table editing events in conjunction with specific embodiments.

在一种可能的实现方式中,表格编辑操作比如说可以包括插入表格的插入事件,下面结合图5至图6对插入表格的相关实现进行说明。图5为本申请实施例提供的表格数据处理方法的流程图二,图6为本申请实施例提供的插入表格的实现示意图。In a possible implementation, the table editing operation may include, for example, an insert event of inserting a table, and the relevant implementation of inserting a table is described below in conjunction with Figures 5 and 6. Figure 5 is a flowchart 2 of the table data processing method provided in an embodiment of the present application, and Figure 6 is a schematic diagram of the implementation of inserting a table provided in an embodiment of the present application.

如图5所示,该方法包括:As shown in FIG5 , the method includes:

S501、响应作用于表格插入控件的点击操作,在图形用户界面中显示调整控件,调整控件中包括多个预选单元格和/或文本输入框。S501. In response to a click operation on a table insert control, an adjustment control is displayed in a graphical user interface, where the adjustment control includes a plurality of pre-selected cells and/or text input boxes.

在本实施例中,在第一应用程序的图形用户界面中可以包括表格插入控件,其中表格插入控件用于响应于用户的操作显示调整控件。In this embodiment, a table insert control may be included in the graphical user interface of the first application, wherein the table insert control is used to display an adjustment control in response to a user's operation.

比如说可以结合图2进行理解,如图2所示,在第一应用程序的图形用户界面中存在用户事件响应区,以及在用户事件响应区中存在图2所示的表格插入控件201。For example, it can be understood in conjunction with FIG. 2 . As shown in FIG. 2 , there is a user event response area in the graphical user interface of the first application, and there is a table insertion control 201 shown in FIG. 2 in the user event response area.

假设用户对图2所示的表格插入控件201进行了点击操作,之后第一应用程序可以响应于针对表格插入控件201的点击操作,在图形用户界面中显示图2所示的调整控件202。Assume that a user clicks on the table insertion control 201 shown in FIG. 2 , and then the first application may display the adjustment control 202 shown in FIG. 2 in the graphical user interface in response to the click operation on the table insertion control 201 .

参照图2可以确定的是,在调整控件202中可以包括多个预选单元203,以及文本输入框204。It can be determined with reference to FIG. 2 that the adjustment control 202 may include a plurality of pre-selection units 203 and a text input box 204 .

在一种可能的实现方式中,在调整控件中可以仅包括预选单元格,或者也可以仅包括文本输入框,或者也可以既包括预选单元格又包括文本输入框,其可以根据实际需求进行选择和设置。以及在实际实现过程中,表格插入控件的具体显示样式、调整控件的具体显示样式,以及调整控件中所具体包括的内容均可以根据实际需求进行选择和设置,本实施例对此不做限制。In a possible implementation, the adjustment control may include only pre-selected cells, or only text input boxes, or both pre-selected cells and text input boxes, which can be selected and set according to actual needs. In the actual implementation process, the specific display style of the table insertion control, the specific display style of the adjustment control, and the specific content included in the adjustment control can all be selected and set according to actual needs, and this embodiment does not limit this.

S502、响应作用于多个预选单元格的选择操作,或者,响应针对于文本输入框中的输入内容的确认操作,确定表格编辑事件为插入事件,选择操作以及确认操作用于指示表格尺寸,插入事件用于指示在富文本编辑器中插入表格尺寸对应的表格。S502. In response to a selection operation on a plurality of preselected cells, or in response to a confirmation operation on input content in a text input box, a table editing event is determined to be an insert event. The selection operation and the confirmation operation are used to indicate a table size. The insert event is used to indicate inserting a table corresponding to the table size in a rich text editor.

其中,调整控件中的预选单元格用于接收用户的选中操作,从而确定待插入表格的表格尺寸。以及文本输入框用户接收用户输入的文本内容,并根据用户输入的文本内容确定表格尺寸,也就是说调整控件中所包括的控件内容都是用于提供给用户调整表格尺寸的。Among them, the pre-selected cell in the adjustment control is used to receive the user's selection operation, so as to determine the table size to be inserted into the table. And the text input box receives the text content input by the user and determines the table size according to the text content input by the user, that is, the control content included in the adjustment control is used to provide the user with the ability to adjust the table size.

则在一种可能的实现方式中,可以响应作用于多个预选单元格的选择操作,确定表格编辑事件为插入事件,其中选择操作可以用于指示表格尺寸,比如说用户在预选单元格中的选择操作,选择了n行m列个预选单元格,则相应的表格尺寸就是n行m列。以及本实施例中的插入事件用于指示在富文本编辑器中插入表格尺寸所对应的表格。In a possible implementation, the table editing event can be determined as an insert event in response to a selection operation on multiple pre-selected cells, where the selection operation can be used to indicate the table size. For example, if the user selects n rows and m columns of pre-selected cells in the pre-selected cells, the corresponding table size is n rows and m columns. The insert event in this embodiment is used to indicate the insertion of a table corresponding to the table size in the rich text editor.

针对这种实现方式,比如说可以结合图2进行理解,如图2所示,假设作用于多个预选单元格的选择操作,在多个预选单元格中选择了3行4列个预选单元格,则可以确定表格尺寸就是3行4列,以及相应的插入事件就用于指示在富文本编辑器中插入表格尺寸为3行4列。For this implementation method, for example, it can be understood in conjunction with Figure 2. As shown in Figure 2, assuming that a selection operation is applied to multiple pre-selected cells, 3 rows and 4 columns of pre-selected cells are selected from the multiple pre-selected cells, then it can be determined that the table size is 3 rows and 4 columns, and the corresponding insert event is used to indicate that the size of the table inserted in the rich text editor is 3 rows and 4 columns.

或者在另一种可能的实现方式中,可以响应针对于文本输入框中的输入内容的确认操作,确定表格编辑事件为插入事件。其中文本输入框中的输入内容用于指示表格尺寸,比如说用户在文本输入框中输入了n-m,并且针对该输入内容触发了确认操作,则可以确定相应的表格尺寸就是n行m列。以及本实施例中的插入事件用于指示在富文本编辑器中插入表格尺寸所对应的表格。Or in another possible implementation, the table editing event can be determined as an insert event in response to a confirmation operation on the input content in the text input box. The input content in the text input box is used to indicate the table size. For example, if the user enters n-m in the text input box and a confirmation operation is triggered for the input content, the corresponding table size can be determined to be n rows and m columns. And the insert event in this embodiment is used to indicate the insertion of a table corresponding to the table size in the rich text editor.

针对这种实现方式,比如说可以结合图2进行理解,如图2所示,假设文本输入框中的输入内容为3-4(图2未示出),并且参照图2可以确定的是,在调整控件202中还存在确认控件205,假设用户点击了确认控件205,则可以生成针对文本输入框中的输入内容的确认操作,那么在图2的示例中,就可以确定表格尺寸就是3行4列,以及相应的插入事件就用于指示在富文本编辑器中插入表格尺寸为3行4列。For this implementation method, for example, it can be understood in conjunction with Figure 2. As shown in Figure 2, assuming that the input content in the text input box is 3-4 (not shown in Figure 2), and referring to Figure 2, it can be determined that there is also a confirmation control 205 in the adjustment control 202. Assuming that the user clicks the confirmation control 205, a confirmation operation can be generated for the input content in the text input box. Then in the example of Figure 2, it can be determined that the table size is 3 rows and 4 columns, and the corresponding insert event is used to indicate that the size of the table inserted in the rich text editor is 3 rows and 4 columns.

基于上述的介绍,本实施例中的表格插入操作就是上述介绍的选择操作或者确认操作,或者表格插入操作还可以包括上述介绍的针对表格插入控件的点击操作。Based on the above introduction, the table insert operation in this embodiment is the selection operation or confirmation operation introduced above, or the table insert operation may also include the click operation on the table insert control introduced above.

S503、获取富文本编辑器中的第一富文本内容所对应的数据结构。S503: Obtain a data structure corresponding to the first rich text content in the rich text editor.

其中,S503的实现方式与上述介绍的S402的实现方式类似,此处不再赘述。The implementation of S503 is similar to the implementation of S402 described above, and will not be described in detail here.

S504、根据插入事件,确定待插入表格的表格尺寸。S504: Determine the table size of the table to be inserted according to the insert event.

在本实施例中,假设确定表格编辑操作所对应的表格编辑事件为插入事件,其中插入事件用于指示在富文本编辑器中插入表格尺寸所对应的表格。则可以根据插入事件,确定待插入表格的表格尺寸。In this embodiment, assuming that the table editing event corresponding to the table editing operation is determined to be an insert event, wherein the insert event is used to indicate inserting a table corresponding to the table size in the rich text editor, then the table size of the table to be inserted can be determined according to the insert event.

S505、根据表格尺寸,生成待插入表格对应的表格数据结构,表格数据结构中包括待插入表格中的多个单元格各自对应的子数据。S505 . Generate a table data structure corresponding to the table to be inserted according to the table size. The table data structure includes sub-data corresponding to each of the multiple cells in the table to be inserted.

在确定表格尺寸之后,本实施例中就可以生成待插入表格所对应的表格数据结构,则表格数据结构中可以包括待插入表格中多个单元格各自对应的子数据,其中待插入表格中的单元格的数量就是根据表格尺寸确定的,比如说表格尺寸为n行m列,那么相应的待插入表格中的单元格的数量就是n乘m个,其中n和m均为大于等于1的整数。After determining the table size, in this embodiment, a table data structure corresponding to the table to be inserted can be generated. The table data structure may include sub-data corresponding to multiple cells in the table to be inserted, where the number of cells to be inserted into the table is determined according to the table size. For example, if the table size is n rows and m columns, then the corresponding number of cells to be inserted into the table is n times m, where n and m are both integers greater than or equal to 1.

其中,表格数据结构比如说可以是JSON格式的,在一种可能的实现方式中,比如说针对上述介绍的待插入表格的表格尺寸为3行4列的示例,其对应的表格数据结构就如下所示:The table data structure may be in JSON format, for example. In a possible implementation, for example, for the example of the table size of the table to be inserted being 3 rows and 4 columns, the corresponding table data structure is as follows:

基于上述介绍的表格数据结构可以确定的是,在表格数据结构中包括待插入表格中的每一个单元格各自对应的子数据,其中子数据可以指示单元格在表格中的位置,以及还可以指示单元格中的具体文本内容。Based on the table data structure introduced above, it can be determined that the table data structure includes sub-data corresponding to each cell to be inserted into the table, wherein the sub-data can indicate the position of the cell in the table and can also indicate the specific text content in the cell.

同时还需要介绍的是,在上述介绍的表格数据结构中,在单元格的对应的子数据之前存在一个光标元素,这个光标元素就是位于整体的表格之前的光标,可以根据用户的点击操作在表格之前显示相应的光标。It is also necessary to introduce that in the table data structure introduced above, there is a cursor element before the corresponding sub-data of the cell. This cursor element is the cursor located before the entire table. The corresponding cursor can be displayed before the table according to the user's click operation.

以及在单元格对应的子数据之后也存在一个光标元素,这个光标元素就是位于整体的表格之后的光标,可以根据用户的点击操作在表格之后显示相应的光标,比如说在图6的示例中,在整体的表格之后就显示了相应的光标。There is also a cursor element after the sub-data corresponding to the cell. This cursor element is the cursor located after the entire table. The corresponding cursor can be displayed after the table according to the user's click operation. For example, in the example of Figure 6, the corresponding cursor is displayed after the entire table.

S506、将表格数据结构添加至数据结构中的目标位置,以得到更新后的数据结构。S506: Add the table data structure to the target position in the data structure to obtain an updated data structure.

在确定表格数据结构之后,就可以将表格数据结构添加至第一富文本内容所对应的数据结构中的目标位置,以得到更新后的数据结构。After the table data structure is determined, the table data structure may be added to a target location in the data structure corresponding to the first rich text content to obtain an updated data structure.

在一种可能的实现方式中,当第一富文本内容为空的时候,第一富文本内容所对应的数据结构也为空,那么在这种情况下可以直接将表格数据结构确定为更新后的数据结构。In a possible implementation, when the first rich text content is empty, the data structure corresponding to the first rich text content is also empty. In this case, the table data structure can be directly determined as the updated data structure.

或者,当第一富文本内容不为空的时候,用户插入表格必然是在第一富文本内容中的相应位置进行插入,比如说是在文本和图片之间插入表格,或者还可以是在文本后面插入表格,等等,总之是在第一富文本内容中的某个位置插入表格。则目标位置对应的就是第一富文本内容中的插入位置对应在数据结构中的节点位置,其可以根据实际需求进行选择和设置。Alternatively, when the first rich text content is not empty, the user must insert the table at the corresponding position in the first rich text content, for example, between the text and the picture, or after the text, etc. In short, the table is inserted at a certain position in the first rich text content. The target position corresponds to the node position in the data structure corresponding to the insertion position in the first rich text content, which can be selected and set according to actual needs.

在确定目标位置之后,将表格数据结构添加至数据结构中的目标位置,就可以得到更新后的数据结构。After the target position is determined, the table data structure is added to the target position in the data structure to obtain an updated data structure.

S507、根据更新后的数据结构,在富文本编辑器中显示更新后的数据结构所对应的第二富文本内容,第一富文本内容和/或第二富文本内容中包括表格。S507: Displaying second rich text content corresponding to the updated data structure in a rich text editor according to the updated data structure, wherein the first rich text content and/or the second rich text content includes a table.

其中,S507的实现方式与上述介绍的S403的实现方式类似。The implementation of S507 is similar to the implementation of S403 described above.

进一步的,在上述介绍的示例的基础上,在更新后的数据结构中包括上述介绍的3行4列的待插入表格所对应的表格数据结构,则可以根据更新后的数据结构,在富文本编辑器中显示更新后的数据结构所对应的第二富文本内容。其中显示的第二富文本内容比如说可以结合图6进行理解,如图6所示,富文本编辑器中所显示的第二富文本内容就包括图6中所示的3行4列的表格。Further, based on the above-described example, if the updated data structure includes the table data structure corresponding to the table to be inserted with 3 rows and 4 columns, the second rich text content corresponding to the updated data structure can be displayed in the rich text editor according to the updated data structure. The displayed second rich text content can be understood, for example, in conjunction with FIG6 . As shown in FIG6 , the second rich text content displayed in the rich text editor includes the table with 3 rows and 4 columns shown in FIG6 .

本申请实施例提供的表格数据处理方法,通过响应于针对表格插入控件的点击操作,在图形用户界面中显示调整控件,在调整控件中可以包括预选单元和/或输入文本,从而可以使得用户自定义的输入需要的表格尺寸。之后再基于用户输入的表格尺寸,确定相应的表格编辑事件为插入事件,其中插入事件用于指示在富文本编辑器中插入表格尺寸所对应的表格。之后根据该插入事件,可以生成待插入表格所对应的表格数据结构,在表格数据结构中包括待插入表格中的多个单元格所各自对应的子数据,其中待插入表格中的单元格数量也就是符合用户所输入的表格尺寸的,最后再基于更新后的数据结构进行相应的富文本内容渲染,从而可以有效的实现在富文本编辑器中插入用户自定义大小的表格,并且上述介绍过程是通过对数据结构进行相应更新,再基于更新后的数据结构进行渲染就可以实现表格插入,因此可以简单有效的实现富文本编辑器支持表格插入功能。The table data processing method provided by the embodiment of the present application, by responding to the click operation on the table insert control, displays the adjustment control in the graphical user interface, and the adjustment control may include pre-selected cells and/or input text, so that the user can customize the table size required for input. Then, based on the table size input by the user, the corresponding table editing event is determined to be an insert event, wherein the insert event is used to indicate the insertion of a table corresponding to the table size in the rich text editor. Then, according to the insert event, a table data structure corresponding to the table to be inserted can be generated, and the table data structure includes sub-data corresponding to each of the multiple cells in the table to be inserted, wherein the number of cells in the table to be inserted is in accordance with the table size input by the user, and finally, the corresponding rich text content rendering is performed based on the updated data structure, so that the insertion of a table of a user-defined size in the rich text editor can be effectively realized, and the above-mentioned introduction process is to realize the table insertion by updating the data structure accordingly, and then rendering based on the updated data structure, so that the rich text editor can simply and effectively realize the support of the table insertion function.

在上述介绍内容的基础上,用户针对插入至富文本编辑器中的表格中的单元格可以进行选中,下面再结合图7至图10对本申请提供的表格数据处理方法中,在表格中进行选区的实现方式进行介绍。图7为本申请实施例提供的表格数据处理方法的流程图三,图8为本申请实施例提供的在表格中确定选取的实现示意图一,图9为本申请实施例提供的在表格中确定选取的实现示意图二,图10为本申请实施例提供的在表格中确定选取的实现示意图三。Based on the above introduction, users can select cells in a table inserted into a rich text editor. The following is an introduction to the implementation method of selecting an area in a table in the table data processing method provided by the present application in combination with Figures 7 to 10. Figure 7 is a flowchart of the table data processing method provided in an embodiment of the present application, Figure 8 is a schematic diagram of the implementation of determining the selection in a table provided in an embodiment of the present application, Figure 9 is a schematic diagram of the implementation of determining the selection in a table provided in an embodiment of the present application, and Figure 10 is a schematic diagram of the implementation of determining the selection in a table provided in an embodiment of the present application.

如图7所示,该方法包括:As shown in FIG. 7 , the method includes:

S701、针对富文本编辑器中所显示的表格,响应作用于表格的选区操作,确定选区操作所对应的选中单元格。S701. For a table displayed in a rich text editor, in response to a selection operation on the table, determine a selected cell corresponding to the selection operation.

在本实施例中,用户可以针对富文本编辑器中所显示的表格进行选区操作,其中富文本编辑器中所显示的表格,比如说可以是第一富文本内容中的表格,也就是说执行上述介绍的插入表格的操作之前,在富文本编辑器中本身就存在表格。或者还可以是第二富文本内容中的表格,也就是说执行上述介绍的插入表格的操作之后,在富文本编辑器中所插入的表格,也就是说无论插入表格是什么时候进行的,针对富文本编辑器中所显示的表格,均可以进行选区操作。In this embodiment, the user can perform a selection operation on a table displayed in the rich text editor, wherein the table displayed in the rich text editor may be, for example, a table in the first rich text content, that is, the table itself exists in the rich text editor before the above-mentioned operation of inserting the table is performed. Or it may be a table in the second rich text content, that is, the table inserted in the rich text editor after the above-mentioned operation of inserting the table is performed, that is, no matter when the table is inserted, the selection operation can be performed on the table displayed in the rich text editor.

在接收到用户输入的选区操作之后,可以响应于选区操作,确定选区操作所对应的选中单元格。After receiving the area selection operation input by the user, a selected cell corresponding to the area selection operation may be determined in response to the area selection operation.

在一种可能的实现方式中,富文本编辑器中显示有行选中控件;则选区操作为针对行选择控件的点击操作,那么选区操作所对应的选中单元格为行选择控件对应的选中行中的多个单元格。In a possible implementation, a row selection control is displayed in the rich text editor; the selection operation is a click operation on the row selection control, and the selected cells corresponding to the selection operation are multiple cells in the selected row corresponding to the row selection control.

比如说可以结合图8进行理解,如图8所示,在富文本编辑器中显示有行选中控件801,其中行选中控件用于选中某一行,以及行选中控件还可以指示当前用户所操作的单元格位于哪一行,比如说用户在第一行的单元格中进行编辑操作,则行选中控件801就如图8所示,位于第一行的位置。For example, it can be understood in conjunction with Figure 8. As shown in Figure 8, a row selection control 801 is displayed in the rich text editor, where the row selection control is used to select a row, and the row selection control can also indicate which row the cell currently operated by the user is located in. For example, if the user performs an editing operation in a cell in the first row, the row selection control 801 is located in the first row as shown in Figure 8.

其中,选取操作比如说可以是针对行选择控件的点击操作,那么在这种情况下,选取操作所对应的选中单元格,也就是行选择控件所对应的选中行中的多个单元格。比如说在图8的示例中,行选择控件所对应的选中行就是第一行,那么第一行的多个单元格也就是选中单元格。The selection operation may be, for example, a click operation on a row selection control. In this case, the selected cells corresponding to the selection operation are the multiple cells in the selected row corresponding to the row selection control. For example, in the example of FIG8 , the selected row corresponding to the row selection control is the first row, and the multiple cells in the first row are the selected cells.

在另一种可能的实现方式中,富文本编辑器中显示有列选中控件;则选区操作为针对列选择控件的点击操作,那么选区操作所对应的选中单元格为列选择控件对应的选中列中的多个单元格。In another possible implementation, a column selection control is displayed in the rich text editor; the selection operation is a click operation on the column selection control, and the selected cells corresponding to the selection operation are multiple cells in the selected column corresponding to the column selection control.

比如说可以结合图9进行理解,如图9所示,在富文本编辑器中显示有列选中控件901,其中列选中控件用于选中某一列,以及列选中控件还可以指示当前用户所操作的单元格位于哪一列,比如说用户在第一列的单元格中进行编辑操作,则列选中控件901就如图9所示,位于第一列的位置。For example, it can be understood in conjunction with Figure 9. As shown in Figure 9, a column selection control 901 is displayed in the rich text editor, wherein the column selection control is used to select a column, and the column selection control can also indicate in which column the cell currently operated by the user is located. For example, if the user performs an editing operation in a cell in the first column, the column selection control 901 is located in the first column as shown in Figure 9.

其中,选取操作比如说可以是针对列选择控件的点击操作,那么在这种情况下,选取操作所对应的选中单元格,也就是列选择控件所对应的选中列中的多个单元格。比如说在图9的示例中,列选择控件所对应的选中列就是第一列,那么第一列的多个单元格也就是选中单元格。The selection operation may be, for example, a click operation on a column selection control. In this case, the selected cells corresponding to the selection operation are the multiple cells in the selected column corresponding to the column selection control. For example, in the example of FIG. 9 , the selected column corresponding to the column selection control is the first column, and the multiple cells in the first column are the selected cells.

或者在另一种可能的实现方式中,选区操作还可以是作用于表格的拖拽操作,那么选区操作所对应的选中单元格,也就是拖拽操作所形成的拖拽范围内所包括的单元格。Or in another possible implementation, the selection operation may also be a drag operation on the table, and the selected cells corresponding to the selection operation are the cells included in the drag range formed by the drag operation.

比如说可以结合图10进行理解,如图10所示,假设用户所进行的拖拽操作的操作轨迹为图10中的箭头所示,那么比如说将拖拽操作的拖拽轨迹的外接矩形,确定为拖拽操作所形成的拖拽范围,也就是图10中的1001所指示的范围,之后可以将拖拽范围1001内所包括的单元格,也就是1行1列、1行2列、2行1列以及2行2列的四个单元格,确定为选中单元格。For example, it can be understood in conjunction with Figure 10. As shown in Figure 10, assuming that the operation trajectory of the drag operation performed by the user is as shown by the arrow in Figure 10, then the circumscribed rectangle of the drag trajectory of the drag operation is determined as the drag range formed by the drag operation, that is, the range indicated by 1001 in Figure 10, and then the cells included in the drag range 1001, that is, the four cells of 1 row and 1 column, 1 row and 2 columns, 2 rows and 1 column, and 2 rows and 2 columns, can be determined as selected cells.

S702、根据选区操作所对应的选中单元格,确定选中框的位置信息,位置信息包括宽度、高度以及坐标位置。S702. Determine the position information of the selection box according to the selected cell corresponding to the selection operation, where the position information includes width, height and coordinate position.

在确定选中单元格之后,就可以根据选中单元格确定选中框的位置信息,其中位置信息可以包括选中框的宽度、选中框的高度以及选中框的坐标位置。After the selected cell is determined, the position information of the selected box can be determined according to the selected cell, wherein the position information may include the width of the selected box, the height of the selected box, and the coordinate position of the selected box.

其中,选中框的宽度和选中框的高度取决于具体存在哪些选中单元格。而选中框的位置信息例如可以是选中框的左上角的顶点所对应的坐标信息,在一种可能的实现方式中,比如说可以将表格的左上角作为坐标原点,以及将坐标原点朝右的方向确定为x轴正方向,以及将坐标原点朝下的方向确定为y轴正方向。在此基础上,选中框的左上角顶点的位置就可以指示选中框在表格中的位置,因此可以将其确定为选中框的坐标位置。Among them, the width and height of the selected box depend on which specific selected cells exist. The position information of the selected box can be, for example, the coordinate information corresponding to the vertex of the upper left corner of the selected box. In a possible implementation, for example, the upper left corner of the table can be used as the coordinate origin, and the direction of the coordinate origin to the right is determined as the positive direction of the x-axis, and the direction of the coordinate origin downward is determined as the positive direction of the y-axis. On this basis, the position of the upper left corner vertex of the selected box can indicate the position of the selected box in the table, so it can be determined as the coordinate position of the selected box.

或者在实际实现过程中,表格对应的坐标系的具体实现还可以根据实际需求进行调整,那么相应的选中框的坐标位置也可以根据实际需求进行选择和设置,只要选中框的坐标位置可以指示其在表格对应的坐标系中的位置即可。Alternatively, in the actual implementation process, the specific implementation of the coordinate system corresponding to the table can be adjusted according to actual needs, so the coordinate position of the corresponding selection box can also be selected and set according to actual needs, as long as the coordinate position of the selection box can indicate its position in the coordinate system corresponding to the table.

以及在一种可能的实现方式中,本实施例中在创建表格的时候,针对创建的每一个表格都挂载有一个选中框,当未选中任何单元格的时候,选中框的长度、宽度、横坐标和纵坐标均为0,也就是说可以认为其存在与表格的左上角,但是没有大小。之后当存在选中单元格的时候,就可以根据根据选中单元格的具体位置,修改选中框的长度、宽度以及坐标位置,以使得选中框可以在相应的位置显示出来。And in a possible implementation, when creating a table in this embodiment, a check box is mounted for each created table. When no cell is selected, the length, width, horizontal coordinate and vertical coordinate of the check box are all 0, that is, it can be considered to exist in the upper left corner of the table, but has no size. Afterwards, when there is a selected cell, the length, width and coordinate position of the check box can be modified according to the specific position of the selected cell, so that the check box can be displayed at the corresponding position.

S703、根据选中框的位置信息,在富文本编辑器中渲染并显示选中框。S703: Render and display the check box in the rich text editor according to the position information of the check box.

在确定选中框的位置信息之后,就可以根据选中框的位置信息,在富文本编辑器中的表格中的相应位置,以预设样式渲染并显示选中框。After the position information of the check box is determined, the check box can be rendered and displayed in a preset style at a corresponding position in the table in the rich text editor according to the position information of the check box.

比如说参照图8、图9和图10都可以理解,图8中的802、图9中的902以及图10中的1001表示的都是显示的选中框。在实际实现过程中,选中框的具体显示样式可以根据实际需求进行选择和设置,本实施例对此不做特别限制。For example, referring to FIG8, FIG9 and FIG10, it can be understood that 802 in FIG8, 902 in FIG9 and 1001 in FIG10 all represent displayed check boxes. In the actual implementation process, the specific display style of the check box can be selected and set according to actual needs, and this embodiment does not impose any special restrictions on this.

本申请实施例提供的表格数据处理方法,通过针对创建的表格搭载选中框,之后根据用户的选区操作确定选中单元格,并且基于选中单元格确定选中框的位置信息,之后根据选中框的位置信息对选中框进行渲染以及显示,就可以有效的实现在表格中插入选区,并且对相应的单元格实现选中,其中选中单元格是很多表格操作的基础,本实施例中的富文本编辑器可以有效的实现表格中单元格的选中,以及可以通过选中框指示具体选中的单元格的位置。The table data processing method provided in the embodiment of the present application can effectively insert a selection in the table and select the corresponding cells by adding a check box to the created table, then determining the selected cell according to the user's selection operation, and determining the position information of the check box based on the selected cell, and then rendering and displaying the check box according to the position information of the check box. The rich text editor in this embodiment can effectively select the cells in the table and indicate the position of the specific selected cell through the check box.

在上述介绍的内容的基础上,本申请中的表格编辑事件比如说还可以是针对表格的修改事件,则下面结合图11至图13对本申请实施例提供的表格数据处理方法中修改表格的相应实现进行介绍,图11为本申请实施例提供的表格数据处理方法的流程图四,图12为本申请实施例提供的修改表格的实现示意图一,图13为本申请实施例提供的修改表格的实现示意图二。Based on the above introduction, the table editing event in the present application can also be, for example, a modification event for the table. The corresponding implementation of modifying the table in the table data processing method provided in the embodiment of the present application is introduced below in combination with Figures 11 to 13. Figure 11 is a flowchart four of the table data processing method provided in the embodiment of the present application, Figure 12 is a schematic diagram one of the implementation of modifying the table provided in the embodiment of the present application, and Figure 13 is a schematic diagram two of the implementation of modifying the table provided in the embodiment of the present application.

如图11所示,该方法包括:As shown in FIG. 11 , the method includes:

S1101、响应作用于选中单元格的触发操作,显示至少一个选择控件,选择控件包括如下中的至少一种:删除控件、第一添加控件以及第二添加控件。S1101. In response to a trigger operation acting on a selected cell, display at least one selection control, where the selection control includes at least one of the following: a delete control, a first add control, and a second add control.

在本实施例中,当需要针对表格进行修改的时候,比如说可以是针对选中单元格进行修改,则例如可以响应作用于选中单元格的触发操作,在富文本编辑器中显示至少一个选择控件。In this embodiment, when it is necessary to modify the table, for example, it may be necessary to modify the selected cell, then at least one selection control may be displayed in the rich text editor in response to a trigger operation acting on the selected cell.

其中,触发操作比如说可以是作用于选中单元格的鼠标右键点击操作,或者还可以是作用于单元格的长按操作,其中触发操作的具体实现方式可以根据实际需求进行选择和设置,只要触发操作可以触发至少一个选择控件的显示即可。Among them, the trigger operation can be, for example, a right-click operation of the mouse on the selected cell, or it can also be a long press operation on the cell. The specific implementation method of the trigger operation can be selected and set according to actual needs, as long as the trigger operation can trigger the display of at least one selection control.

以及本实施例中的选择控件例如可以包括如下中的至少一种:删除控件、第一添加控件以及第二添加控件。And the selection control in this embodiment may include, for example, at least one of the following: a delete control, a first add control, and a second add control.

在一种可能的实现方式中,如果选中单元格在表格中位于同一行,则第一添加控件用于指示在选中单元格所在行的上方添加一行单元格,第二添加控件用于指示在选中单元格所在行的下方添加一行单元格,删除控件用于指示在删除选中单元格所在行的单元格。In one possible implementation, if the selected cells are located in the same row in the table, the first add control is used to indicate adding a row of cells above the row where the selected cells are located, the second add control is used to indicate adding a row of cells below the row where the selected cells are located, and the delete control is used to indicate deleting the cells in the row where the selected cells are located.

比如说可以结合图12进行理解,如图12所示,当前选中单元格都是第一行的单元格,例如可以相应针对选中单元格的触发操作,显示图12所示的3个选择控件,分别是第一添加控件1201,第二添加控件1202和删除控件1203。For example, it can be understood in conjunction with Figure 12. As shown in Figure 12, the currently selected cells are all cells in the first row. For example, a trigger operation can be performed accordingly for the selected cells to display the three selection controls shown in Figure 12, namely the first add control 1201, the second add control 1202 and the delete control 1203.

其中,第一添加控件1201用于指示在选中单元格所在行的上方添加一行单元格,也就是在第一行上方再添加一行。第二添加控件1202用于指示在选中单元格所在行的下方添加一行单元格,也就是在第一行下方再添加一行。删除控件1203用于指示在删除选中单元格所在行的单元格,也就是在表格中删除第一行。The first add control 1201 is used to indicate adding a row of cells above the row where the selected cell is located, that is, adding another row above the first row. The second add control 1202 is used to indicate adding a row of cells below the row where the selected cell is located, that is, adding another row below the first row. The delete control 1203 is used to indicate deleting the cells in the row where the selected cell is located, that is, deleting the first row in the table.

在另一种可能的实现方式中,如果选中单元格在表格中位于同一列,则第一添加控件用于指示在选中单元格所在列的左侧添加一列单元格,第二添加控件用于指示在选中单元格所在列的右侧添加一列单元格,删除控件用于指示在删除选中单元格所在列的单元格。In another possible implementation, if the selected cells are located in the same column in the table, the first add control is used to indicate adding a column of cells to the left of the column where the selected cells are located, the second add control is used to indicate adding a column of cells to the right of the column where the selected cells are located, and the delete control is used to indicate deleting the cells in the column where the selected cells are located.

比如说可以结合图13进行理解,如图13所示,当前选中单元格都是第一列的单元格,例如可以相应针对选中单元格的触发操作,显示图13所示的3个选择控件,分别是第一添加控件1301,第二添加控件1302和删除控件1303。For example, it can be understood in conjunction with Figure 13. As shown in Figure 13, the currently selected cells are all cells in the first column. For example, a trigger operation can be performed accordingly for the selected cells to display the three selection controls shown in Figure 13, namely the first add control 1301, the second add control 1302 and the delete control 1303.

其中,第一添加控件1301用于指示在选中单元格所在列的左侧添加一列单元格,也就是在第一列左侧再添加一列。第二添加控件1302用于指示在选中单元格所在列的右侧添加一列单元格,也就是在第一列右侧再添加一列。删除控件1303用于指示删除选中单元格所在列的单元格,也就是在表格中删除第一列。The first add control 1301 is used to indicate adding a column of cells to the left of the column where the selected cell is located, that is, adding another column to the left of the first column. The second add control 1302 is used to indicate adding a column of cells to the right of the column where the selected cell is located, that is, adding another column to the right of the first column. The delete control 1303 is used to indicate deleting the cells in the column where the selected cell is located, that is, deleting the first column in the table.

S1102、响应作用于至少一个选择控件中的目标选择控件的点击操作,确定表格编辑事件为修改事件。S1102: In response to a click operation on a target selection control in at least one selection control, determine that the table editing event is a modification event.

基于上述介绍可以确定的是,不同的选择控件用于触发不同的操作,则可以响应作用于至少一个选择控件中的目标选择控件的点击操作,确定表格编辑事件为修改事件,其中目标选择控件的不同,对应的修改事件也不同。Based on the above introduction, it can be determined that different selection controls are used to trigger different operations. Therefore, in response to a click operation on a target selection control in at least one selection control, the table editing event can be determined as a modification event, wherein different target selection controls have different corresponding modification events.

在一种可能的实现方式中,如果选中单元格在表格中位于同一行,若目标选择控件为删除控件,则修改事件为删除行事件,删除行事件用于指示删除选中单元格所在行的单元格;若目标选择控件为第一添加控件,则修改事件为第一添加行事件,第一添加行事件用于指示在选中单元格所在行的上方添加一行单元格;若目标选择控件为第二添加控件,则修改事件为第二添加行事件,第二添加行事件用于指示在选中单元格所在行的下方添加一行单元格。In a possible implementation, if the selected cells are located in the same row in the table, if the target selection control is a delete control, the modification event is a delete row event, and the delete row event is used to indicate deleting the cells in the row where the selected cells are located; if the target selection control is a first add control, the modification event is a first add row event, and the first add row event is used to indicate adding a row of cells above the row where the selected cells are located; if the target selection control is a second add control, the modification event is a second add row event, and the second add row event is used to indicate adding a row of cells below the row where the selected cells are located.

在另一种可能的实现方式中,如果选中单元格在表格中位于同一列,若目标选择控件为删除控件,则修改事件为删除列事件,删除列事件用于指示删除选中单元格所在列的单元格;若目标选择控件为第一添加控件,则修改事件为第一添加列事件,第一添加列事件用于指示在选中单元格所在列的左侧添加一列单元格;若目标选择控件为第二添加控件,则修改事件为第二添加列事件,第二添加列事件用于指示在选中单元格所在列的右侧添加一列单元格。In another possible implementation, if the selected cells are located in the same column in the table, if the target selection control is a delete control, the modification event is a delete column event, and the delete column event is used to indicate deleting the cells in the column where the selected cells are located; if the target selection control is a first add control, the modification event is a first add column event, and the first add column event is used to indicate adding a column of cells to the left of the column where the selected cells are located; if the target selection control is a second add control, the modification event is a second add column event, and the second add column event is used to indicate adding a column of cells to the right of the column where the selected cells are located.

S1103、获取富文本编辑器中的第一富文本内容所对应的数据结构。S1103: Obtain a data structure corresponding to the first rich text content in the rich text editor.

其中,S1103的实现方式与上述介绍的S402的实现方式类似,此处不再赘述。The implementation of S1103 is similar to the implementation of S402 described above, and will not be described in detail here.

S1104、根据表格编辑事件更新数据结构。S1104: Update the data structure according to the table editing event.

基于上述介绍可以确定的是,本实施例中的表格编辑事件存在多种可能的实现方式,其中每一种实现方式对应的更新数据结构的实现方式可能存在一定的差异,下面针对多种不同的插入事件的数据结构更新的实现分别进行说明。Based on the above introduction, it can be determined that there are multiple possible implementation methods for the table editing event in this embodiment, and the implementation method of updating the data structure corresponding to each implementation method may be different. The implementation of data structure update for multiple different insertion events is explained below.

在一种可能的实现方式中,若修改事件为删除行事件,则在更新数据结构的时候,可以是在数据结构中,删除选中单元格所在行的各个单元格所对应的子数据,以得到更新后的数据结构。以及,除了删除相应的子数据之外,还可以针对剩余的单元格各自的子数据中的行列标识进行适应性的更新。In a possible implementation, if the modification event is a row deletion event, when updating the data structure, the sub-data corresponding to each cell in the row where the selected cell is located may be deleted in the data structure to obtain an updated data structure. In addition to deleting the corresponding sub-data, the row and column identifiers in the sub-data of the remaining cells may also be adaptively updated.

比如说在上述介绍的插入表格的表格尺寸是3行4列的基础上,假设选中单元格为第一行的单元格,则可以在上述介绍的数据结构中,删除1行1列的单元格对应的子数据、1行2列的单元格对应的子数据、1行3列的单元格对应的子数据以及1行4列的单元格对应的子数据,并且针对剩余两行的单元格的子数据的行列标识进行更新,也就是说原来的第2行变为第1行,原来的第3行变为第2行,具体的更新方式可以参照上述介绍的数据结构进行理解,此处不再赘述。For example, based on the above-mentioned table size of 3 rows and 4 columns for the inserted table, assuming that the selected cell is a cell in the first row, then in the above-mentioned data structure, the sub-data corresponding to the cells in 1 row and 1 column, the sub-data corresponding to the cells in 1 row and 2 columns, the sub-data corresponding to the cells in 1 row and 3 columns, and the sub-data corresponding to the cells in 1 row and 4 columns can be deleted, and the row and column identifiers of the sub-data of the cells in the remaining two rows can be updated, that is, the original 2nd row becomes the 1st row, and the original 3rd row becomes the 2nd row. The specific updating method can be understood by referring to the above-mentioned data structure, and will not be repeated here.

在另一种可能的实现方式中,若修改事件为第一添加行事件,也就是说在选中单元格所在行的上方添加一行单元格,则在更新数据结构的时候,可以是在数据结构中的第一位置添加一行单元格所对应的子数据,以得到更新后的数据结构,第一位置用于使得添加行的单元格位于选中单元格所在行的单元格的上方。以及,除了增加相应的子数据之外,还可以针对每个单元格各自的子数据中的行列标识进行适应性的更新。In another possible implementation, if the modification event is the first row adding event, that is, adding a row of cells above the row where the selected cell is located, then when updating the data structure, the sub-data corresponding to a row of cells may be added at the first position in the data structure to obtain an updated data structure, and the first position is used to make the cells of the added row located above the cells of the row where the selected cell is located. In addition, in addition to adding the corresponding sub-data, the row and column identifiers in the sub-data of each cell may also be adaptively updated.

可以理解的是,在数据结构中包括表格中的每一个单元格各自对应的子数据,如果说多个单元格的子数据是按照上述介绍的先行后列的方式排序的,那么第一位置比如说可以是选中单元格所在行的第一个单元格的子数据之前,在这种情况下,在第一位置直接插入连续的一行单元格的子数据即可。又或者,如果多个单元格的子数据是按照先列后行的方式排序的,那么第一位置可以是分散的,例如是选中单元格所在行的每一个单元格的子数据之前所共同构成的位置,在这种情况下,需要在分散的多个位置,分别插入一行单元格的的各个单元格的子数据。It is understandable that the data structure includes the sub-data corresponding to each cell in the table. If the sub-data of multiple cells are sorted in the manner of first row and then column as described above, then the first position, for example, may be before the sub-data of the first cell in the row where the selected cell is located. In this case, the sub-data of a continuous row of cells can be directly inserted in the first position. Alternatively, if the sub-data of multiple cells are sorted in the manner of first column and then row, then the first position may be scattered, for example, a position jointly constituted before the sub-data of each cell in the row where the selected cell is located. In this case, the sub-data of each cell in a row of cells needs to be inserted in multiple scattered positions respectively.

比如说在上述介绍的插入表格的表格尺寸是3行4列的基础上,假设选中单元格为第一行的单元格,则可以在上述介绍的数据结构中,因为其是按照先行后列的方式排序子数据的,因此可以将1行1列的单元格的子数据之前的位置确定为第一位置,并且在第一位置之前直接插入连续的一行单元格的子数据。并且针对原本三行的单元格的子数据的行列标识进行更新,也就是说原来的第1行变为第2行,原来的第2行变为第3行,原来的第3行变为第4行,针对上述介绍的示例,更新之后的数据结构比如说可以变为:For example, based on the table size of the inserted table described above being 3 rows and 4 columns, assuming that the selected cell is a cell in the first row, then in the data structure described above, because the sub-data is sorted in the order of rows first and columns later, the position before the sub-data of the cell in row 1 and column 1 can be determined as the first position, and a row of sub-data of cells can be directly inserted before the first position. The row and column identifiers of the sub-data of the original three rows of cells are updated, that is, the original row 1 becomes the second row, the original row 2 becomes the third row, and the original row 3 becomes the fourth row. For the example described above, the updated data structure can be, for example, changed to:

对比上述介绍更新前后的数据结构,可以确定的是,更新前的数据结构描述的是一个3行4列的表格,更新后的数据结构描述的是一个4行4列的表格,因此就可以实现在原本的表格的基础上添加一行,得到更新后的表格。Comparing the data structures before and after the update described above, it can be determined that the data structure before the update describes a table with 3 rows and 4 columns, and the data structure after the update describes a table with 4 rows and 4 columns. Therefore, it is possible to add a row to the original table to obtain the updated table.

在另一种可能的实现方式中,若修改事件为第二添加行事件,也就是说在选中单元格所在行的下方添加一行单元格,则在更新数据结构的时候,可以是在数据结构中的第二位置添加一行单元格所对应的子数据,以得到更新后的数据结构,第二位置用于使得添加行的单元格位于选中单元格所在行的单元格的下方。以及,除了增加相应的子数据之外,还可以针对每个单元格各自的子数据中的行列标识进行适应性的更新。In another possible implementation, if the modification event is a second row adding event, that is, a row of cells is added below the row where the selected cell is located, then when updating the data structure, the sub-data corresponding to a row of cells may be added at the second position in the data structure to obtain an updated data structure, and the second position is used to make the cells of the added row located below the cells of the row where the selected cell is located. In addition, in addition to adding the corresponding sub-data, the row and column identifiers in the sub-data of each cell may also be adaptively updated.

可以理解的是,在数据结构中包括表格中的每一个单元格各自对应的子数据,如果说多个单元格的子数据是按照上述介绍的先行后列的方式排序的,那么第二位置比如说可以是选中单元格所在行的最后一个单元格的子数据之后,在这种情况下,在第二位置直接插入连续的一行单元格的子数据即可。又或者,如果多个单元格的子数据是按照先列后行的方式排序的,那么第二位置可以是分散的,例如是选中单元格所在行的每一个单元格的子数据之后所共同构成的位置,在这种情况下,需要在分散的多个位置,分别插入一行单元格的的各个单元格的子数据。It is understandable that the data structure includes the sub-data corresponding to each cell in the table. If the sub-data of multiple cells are sorted in the manner of first row and then column as described above, then the second position, for example, may be after the sub-data of the last cell in the row where the selected cell is located. In this case, the sub-data of a continuous row of cells can be directly inserted in the second position. Alternatively, if the sub-data of multiple cells are sorted in the manner of first column and then row, then the second position may be scattered, for example, a position jointly formed after the sub-data of each cell in the row where the selected cell is located. In this case, the sub-data of each cell in a row of cells needs to be inserted in the scattered multiple positions respectively.

比如说在上述介绍的插入表格的表格尺寸是3行4列的基础上,假设选中单元格为第一行的单元格,则可以在上述介绍的数据结构中,因为其是按照先行后列的方式排序子数据的,因此可以将1行4列的单元格的子数据之后的位置确定为第一位置,并且在第一位置之前直接插入连续的一行单元格的子数据。并且针对原本三行的单元格的子数据的行列标识进行更新,也就是说第一行不变,原来的第2行变为第3行,原来的第3行变为第4行,具体的更新方式可以参照上述介绍的数据结构进行理解,此处不再赘述。For example, based on the table size of 3 rows and 4 columns of the inserted table introduced above, assuming that the selected cell is a cell in the first row, then in the data structure introduced above, because the sub-data is sorted in the order of rows first and columns later, the position after the sub-data of the cell of 1 row and 4 columns can be determined as the first position, and a continuous row of sub-data of cells can be directly inserted before the first position. And the row and column identifiers of the sub-data of the original three rows of cells are updated, that is, the first row remains unchanged, the original 2nd row becomes the 3rd row, and the original 3rd row becomes the 4th row. The specific update method can be understood by referring to the data structure introduced above, and will not be repeated here.

在另一种可能的实现方式中,若修改事件为删除列事件,则在更新数据结构的时候,可以是在数据结构中,删除选中单元格所在列的各个单元格所对应的子数据,以得到更新后的数据结构。以及,除了删除相应的子数据之外,还可以针对剩余的单元格各自的子数据中的行列标识进行适应性的更新。In another possible implementation, if the modification event is a column deletion event, when updating the data structure, the sub-data corresponding to each cell in the column where the selected cell is located may be deleted in the data structure to obtain an updated data structure. In addition to deleting the corresponding sub-data, the row and column identifiers in the sub-data of the remaining cells may also be adaptively updated.

比如说在上述介绍的插入表格的表格尺寸是3行4列的基础上,假设选中单元格为第一列的单元格,则可以在上述介绍的数据结构中,删除1行1列的单元格对应的子数据、2行1列的单元格对应的子数据以及3行1列的单元格对应的子数据,并且针对剩余三行的单元格的子数据的行列标识进行更新,也就是说原来的第2列变为第1列,原来的第3列变为第2列,原来的第4列变为第3列,具体的更新方式可以参照上述介绍的数据结构进行理解,此处不再赘述。For example, based on the above-mentioned table size of 3 rows and 4 columns, assuming that the selected cell is the cell in the first column, then in the above-mentioned data structure, the sub-data corresponding to the cells in 1 row and 1 column, the sub-data corresponding to the cells in 2 rows and 1 column, and the sub-data corresponding to the cells in 3 rows and 1 column can be deleted, and the row and column identifiers of the sub-data of the cells in the remaining three rows can be updated, that is, the original 2nd column becomes the 1st column, the original 3rd column becomes the 2nd column, and the original 4th column becomes the 3rd column. The specific updating method can be understood by referring to the above-mentioned data structure, and will not be repeated here.

在另一种可能的实现方式中,若修改事件为第一添加列事件,也就是说在选中单元格所在行的左侧添加一列单元格,则在更新数据结构的时候,可以是在数据结构中的第三位置添加一列单元格所对应的子数据,以得到更新后的数据结构,第三位置用于使得添加列的单元格位于选中单元格所在列的单元格的左侧。以及,除了增加相应的子数据之外,还可以针对每个单元格各自的子数据中的行列标识进行适应性的更新。In another possible implementation, if the modification event is the first column adding event, that is, adding a column of cells to the left of the row where the selected cell is located, then when updating the data structure, the sub-data corresponding to the column of cells may be added to the third position in the data structure to obtain an updated data structure, and the third position is used to make the cells of the added column to the left of the cells in the column where the selected cell is located. In addition, in addition to adding the corresponding sub-data, the row and column identifiers in the sub-data of each cell may also be adaptively updated.

可以理解的是,在数据结构中包括表格中的每一个单元格各自对应的子数据,如果说多个单元格的子数据是按照上述介绍的先行后列的方式排序的,那么第三位置比如说可以是分散的,例如是选中单元格所在列的每一个单元格的子数据之前所共同构成的位置,在这种情况下,需要在分散的多个位置,分别插入一列单元格的的各个单元格的子数据。又或者,如果多个单元格的子数据是按照先列后行的方式排序的,那么第三位置可以是选中单元格所在列的第一个单元格的子数据之前的位置,在这种情况下,在第三位置直接插入连续的一列单元格的子数据即可。It is understandable that the data structure includes the sub-data corresponding to each cell in the table. If the sub-data of multiple cells are sorted in the manner of first row and then column as described above, then the third position can be scattered, for example, the position jointly constituted before the sub-data of each cell in the column where the selected cell is located. In this case, it is necessary to insert the sub-data of each cell in a column of cells in the scattered multiple positions. Alternatively, if the sub-data of multiple cells are sorted in the manner of first column and then row, then the third position can be the position before the sub-data of the first cell in the column where the selected cell is located. In this case, the sub-data of a continuous column of cells can be directly inserted in the third position.

比如说在上述介绍的插入表格的表格尺寸是3行4列的基础上,假设选中单元格为第一列的单元格,则可以在上述介绍的数据结构中,因为其是按照先行后列的方式排序子数据的,因此可以将1行1列的单元格的子数据之前的位置、2行1列的单元格的子数据之前的位置以及3行1列的单元格的子数据之前的位置,确定为第三位置,并且在3个分散的第三位置之前,分别分散的插入一列中的多个单元格的子数据。并且针对原本四列的单元格的子数据的行列标识进行更新,也就是说原来的第1列变为第2列,原来的第2列变为第3列,原来的第3列变为第4列,原来的第4列变为第5列,具体的更新方式可以参照上述介绍的数据结构进行理解,此处不再赘述。For example, based on the table size of the inserted table described above being 3 rows and 4 columns, assuming that the selected cell is a cell in the first column, then in the data structure described above, because the sub-data is sorted in the order of rows first and columns later, the position before the sub-data of the cell in 1 row and 1 column, the position before the sub-data of the cell in 2 rows and 1 column, and the position before the sub-data of the cell in 3 rows and 1 column can be determined as the third position, and the sub-data of multiple cells in one column can be inserted separately before the three scattered third positions. And the row and column identifiers of the sub-data of the cells in the original four columns are updated, that is, the original 1st column becomes the 2nd column, the original 2nd column becomes the 3rd column, the original 3rd column becomes the 4th column, and the original 4th column becomes the 5th column. The specific update method can be understood by referring to the data structure described above, and will not be repeated here.

在另一种可能的实现方式中,若修改事件为第二添加列事件,也就是说在选中单元格所在行的右侧添加一列单元格,则在更新数据结构的时候,可以是在数据结构中的第四位置添加一列单元格所对应的子数据,以得到更新后的数据结构,第四位置用于使得添加列的单元格位于选中单元格所在列的单元格的右侧。以及,除了增加相应的子数据之外,还可以针对每个单元格各自的子数据中的行列标识进行适应性的更新。In another possible implementation, if the modification event is a second column adding event, that is, a column of cells is added to the right of the row where the selected cell is located, then when updating the data structure, the sub-data corresponding to the column of cells may be added to the fourth position in the data structure to obtain an updated data structure, and the fourth position is used to make the cells of the added column to the right of the cells in the column where the selected cell is located. In addition, in addition to adding the corresponding sub-data, the row and column identifiers in the sub-data of each cell may also be adaptively updated.

可以理解的是,在数据结构中包括表格中的每一个单元格各自对应的子数据,如果说多个单元格的子数据是按照上述介绍的先行后列的方式排序的,那么第四位置比如说可以是分散的,例如是选中单元格所在列的每一个单元格的子数据之后所共同构成的位置,在这种情况下,需要在分散的多个位置,分别插入一列单元格的的各个单元格的子数据。又或者,如果多个单元格的子数据是按照先列后行的方式排序的,那么第四位置可以是选中单元格所在列的最后一个单元格的子数据之后的位置,在这种情况下,在第四位置直接插入连续的一列单元格的子数据即可。It is understandable that the data structure includes the sub-data corresponding to each cell in the table. If the sub-data of multiple cells are sorted in the manner of first row and then column as described above, then the fourth position can be scattered, for example, the position jointly constituted after the sub-data of each cell in the column where the selected cell is located. In this case, it is necessary to insert the sub-data of each cell in a column of cells in the scattered multiple positions. Alternatively, if the sub-data of multiple cells are sorted in the manner of first column and then row, then the fourth position can be the position after the sub-data of the last cell in the column where the selected cell is located. In this case, the sub-data of a continuous column of cells can be directly inserted in the fourth position.

比如说在上述介绍的插入表格的表格尺寸是3行4列的基础上,假设选中单元格为第一列的单元格,则可以在上述介绍的数据结构中,因为其是按照先行后列的方式排序子数据的,因此可以将1行1列的单元格的子数据之后的位置、2行1列的单元格的子数据之后的位置以及3行1列的单元格的子数据之后的位置,确定为第四位置,并且在3个分散的第四位置之前,分别分散的插入一列中的多个单元格的子数据。并且针对原本四列的单元格的子数据的行列标识进行更新,也就是说原来的第1列不变,原来的第2列变为第3列,原来的第3列变为第4列,原来的第4列变为第5列,具体的更新方式可以参照上述介绍的数据结构进行理解,此处不再赘述。For example, based on the table size of the inserted table described above being 3 rows and 4 columns, assuming that the selected cell is a cell in the first column, then in the data structure described above, because the sub-data is sorted in the order of rows first and columns later, the position after the sub-data of the cell in 1 row and 1 column, the position after the sub-data of the cell in 2 rows and 1 column, and the position after the sub-data of the cell in 3 rows and 1 column can be determined as the fourth position, and the sub-data of multiple cells in one column can be inserted separately before the three scattered fourth positions. And the row and column identifiers of the sub-data of the cells in the original four columns are updated, that is, the original first column remains unchanged, the original second column becomes the third column, the original third column becomes the fourth column, and the original fourth column becomes the fifth column. The specific update method can be understood by referring to the data structure described above, and will not be repeated here.

以及需要说明的是,然而,之所以在添加行列的时候要按照上述介绍的方式进行处理,是因为针对新添加的行或者列,其子数据中的文本内容通常都是空的,但是原本表格中的单元格中的文本内容可能不为空,因此为了保证表格中的文本内容显示的正确性,需要在数据结构中的相应位置进行单元格的添加,以保证基于更新后的数据结构可以有效的显示出添加行或者添加列的效果,同时又可以保证原本表格中的文本内容的显示是正确的。It should be noted that, however, the reason why the above-mentioned method should be used when adding rows and columns is because the text content in the sub-data of the newly added rows or columns is usually empty, but the text content in the cells of the original table may not be empty. Therefore, in order to ensure the correct display of the text content in the table, cells need to be added at the corresponding positions in the data structure to ensure that the effect of adding rows or columns can be effectively displayed based on the updated data structure, while ensuring that the display of the text content in the original table is correct.

S1105、根据更新后的数据结构,在富文本编辑器中显示更新后的数据结构所对应的第二富文本内容,第一富文本内容和/或第二富文本内容中包括表格。S1105 . Displaying second rich text content corresponding to the updated data structure in a rich text editor according to the updated data structure, wherein the first rich text content and/or the second rich text content includes a table.

其中,S1105的实现方式与上述介绍的S403的实现方式类似,基于更新后的数据结构渲染并显示第二富文本内容,就可以保证第二富文本内容中的表格,相对于第一富文本内容中的表格,进行了用户所触发的更新操作。Among them, the implementation method of S1105 is similar to the implementation method of S403 introduced above. By rendering and displaying the second rich text content based on the updated data structure, it can be ensured that the table in the second rich text content is updated as triggered by the user relative to the table in the first rich text content.

本申请实施例提供的表格数据处理方法,通过对响应于用户对选中单元格的触发操作,在图形用户界面中为用户提供至少一个选择控件,其中选择控件可以支持用户删除行列或者添加行列,并且具体的选择控件到底是针对行的操作还是针对列的操作,取决于选中单元格的具体实现,因此可以针对用户实际的单元格选择情况,为用户提供不同的选择控件,以使得用户可以根据实际情况进行相应的表格修改操作。以及针对删除行、删除列、添加行、添加列的多种事件,可以根据实际的事件情况以及实际的数据结构的组成情况,在数据结构中的相应位置添加单元格或者删除单元格,从而可以有效的保证基于更新后的数据结构进行表格渲染,可以有效的表现出用户需要的表格更新,同时又可以保证原本表格中的内容显示正确。同时,上述介绍的表格更新是基于数据结构的更新并渲染完成的,因此可以简单有效的实现富文本编辑器支持表格修改功能。The table data processing method provided by the embodiment of the present application provides at least one selection control for the user in the graphical user interface in response to the user's trigger operation on the selected cell, wherein the selection control can support the user to delete rows and columns or add rows and columns, and whether the specific selection control is for the operation of rows or columns depends on the specific implementation of the selected cell. Therefore, different selection controls can be provided to the user according to the user's actual cell selection situation, so that the user can perform corresponding table modification operations according to the actual situation. And for various events such as deleting rows, deleting columns, adding rows, and adding columns, cells can be added or deleted at the corresponding position in the data structure according to the actual event situation and the composition of the actual data structure, so that the table rendering based on the updated data structure can be effectively guaranteed, and the table update required by the user can be effectively displayed, while ensuring that the content in the original table is displayed correctly. At the same time, the table update introduced above is based on the update and rendering of the data structure, so the rich text editor can simply and effectively realize the support of the table modification function.

因此下面再结合图14对第一应用程序中的表格数据处理过程中,富文本编辑器的架构中的各个单元所发挥的作用进行介绍。图14为本申请实施例提供的表格处理方法的处理过程示意图。Therefore, the following describes the role played by each unit in the rich text editor architecture during the table data processing process in the first application program in conjunction with Figure 14. Figure 14 is a schematic diagram of the processing process of the table processing method provided in an embodiment of the present application.

如图14所示,在第一应用程序中可以包括数据库和富文本编辑器。以及在富文本编辑器中包括数据处理单元、记录单元、插件单元、渲染单元和事件监听单元。As shown in FIG14 , the first application may include a database and a rich text editor, and the rich text editor may include a data processing unit, a recording unit, a plug-in unit, a rendering unit, and an event monitoring unit.

其过程包括:The process includes:

1、数据处理单元接收第一应用程序触发的表格的插入事件,并根据插入事件,初始化插入表格的表格数据结构。1. The data processing unit receives an insert event of a table triggered by a first application program, and initializes a table data structure of the insert table according to the insert event.

其中,初始化插入表格的表格数据结构,也就是按照上述实施例介绍的实现方式,生成待插入表格的表格数据结构,并且将表格数据结构添加到第一富文本内容的数据结构中的目标位置,以得到更新后的数据结构,具体的实现方式可以参照上述实施例的介绍,此处不再赘述。Among them, the table data structure of the inserted table is initialized, that is, according to the implementation method introduced in the above embodiment, the table data structure of the table to be inserted is generated, and the table data structure is added to the target position in the data structure of the first rich text content to obtain an updated data structure. The specific implementation method can refer to the introduction of the above embodiment and will not be repeated here.

2、数据处理单元向记录单元发送事件信息。2. The data processing unit sends event information to the recording unit.

比如说当前情况下,数据处理单元就可以是向记录单元发送插入事件所对应的事件信息,其中事件信息比如说可以包括插入的内容、插入的位置等等。For example, in the current situation, the data processing unit may send event information corresponding to the insertion event to the recording unit, wherein the event information may include, for example, the inserted content, the inserted position, and the like.

3、记录单元根据事件信息,记录插入表格的历史记录。3. The recording unit records the history of the insertion table according to the event information.

在一种可能的实现方式中,为了便于进行操作的回溯,本实施例中的富文本编辑器中还包括记录单元。记录单元在接收到事件信息之后,可以将插入表格的历史记录存储在第一堆栈中,其中第一堆栈用于存储已完成的操作所对应的信息。In a possible implementation, in order to facilitate the backtracking of operations, the rich text editor in this embodiment further includes a recording unit. After receiving the event information, the recording unit can store the history record of inserting the table in a first stack, wherein the first stack is used to store information corresponding to the completed operation.

其中,第一堆栈可以理解为undos(撤销)堆栈,当用户需要撤销操作的时候,就可以从第一堆栈的栈顶获取记录信息,并根据记录信息对富文本内容对应的数据结构中,记录信息所对应的更新操作进行撤销,以实现相应指令的撤销。Among them, the first stack can be understood as an undo stack. When the user needs to undo an operation, the record information can be obtained from the top of the first stack, and the update operation corresponding to the record information in the data structure corresponding to the rich text content can be undoed according to the record information to realize the undo of the corresponding instruction.

以及在记录单元中比如说还可以包括第二堆栈,当富文本编辑器接收到撤销指令时,比如说可以通过插件单元获取位于第一堆栈的栈顶的记录信息;插件单元在富文本内容对应的数据结构中,撤销位于栈顶的记录信息所对应的更新操作;根据撤销更新操作之后的数据结构,渲染并显示富文本内容;将位于栈顶的记录信息存储至第二堆栈中,第二堆栈用于存储已撤销的操作所对应的指示信息。And the record unit may also include a second stack, for example. When the rich text editor receives an undo instruction, the record information at the top of the first stack can be obtained through the plug-in unit; the plug-in unit undoes the update operation corresponding to the record information at the top of the stack in the data structure corresponding to the rich text content; renders and displays the rich text content according to the data structure after the update operation is undone; the record information at the top of the stack is stored in the second stack, and the second stack is used to store the indication information corresponding to the undone operation.

4、记录单元通知渲染单元操作记录完成。4. The recording unit notifies the rendering unit that the operation recording is completed.

5、渲染单元根据更新后的数据结构,渲染并显示插入表格的表格样式。5. The rendering unit renders and displays the table style of the inserted table according to the updated data structure.

6、渲染单元通知事件监听单元渲染完成。6. The rendering unit notifies the event listening unit that rendering is complete.

7、事件监听单元针对插入的该表格,添加事件监听。7. The event monitoring unit adds an event monitoring for the inserted table.

其中监听的事件就可以包括上述介绍的各种类型的修改事件,比如说可以通过监听用户的操作,从而确定相应的事件,其具体实现方式可以参照上述实施例的介绍,此处不再赘述。The monitored events may include the various types of modification events introduced above. For example, the corresponding events may be determined by monitoring the user's operations. The specific implementation method may refer to the introduction of the above embodiment and will not be repeated here.

基于上述介绍可以确定的是,针对插入事件,因为用户是在第一应用程序的相应控件区域触发的,因此插入事件是第一应用程序负责监听的。而修改事件是在富文本编辑器中的表格区域触发的,因此修改事件可以由富文本编辑器负责监听。当富文本编辑器中存在多个表格的时候,每个表格都对应当前的一套处理逻辑,也就是说富文本编辑器可以针对每一个表格都分别进行事件监听,以确定用户是针对哪一个表格进行相应的修改。Based on the above introduction, it can be determined that for the insert event, because the user triggered it in the corresponding control area of the first application, the insert event is monitored by the first application. The modification event is triggered in the table area of the rich text editor, so the modification event can be monitored by the rich text editor. When there are multiple tables in the rich text editor, each table corresponds to the current set of processing logic, that is, the rich text editor can monitor events for each table separately to determine which table the user is making corresponding modifications to.

8、事件监听单元向插件单元发送监听到的事件。8. The event monitoring unit sends the monitored events to the plug-in unit.

9、插件单元格根据监听到的事件,确定更新指令。9. The plug-in cell determines the update instructions based on the events it monitors.

在一种可能的实现方式中,插件单元中比如说可以存在表格编辑插件,其中针对不同的事件,存在不同的处理逻辑。则例如可以由表格编辑插件根据监听到的事件,确定监听到的事件所对应的更新指令,该更新指令就可以指示针对当前监听到的事件进行对应的逻辑处理,也就是说按照监听到的事件所对应的处理逻辑。进行相应的数据结构的更新。In a possible implementation, for example, a table editing plug-in may exist in the plug-in unit, in which different processing logics exist for different events. For example, the table editing plug-in may determine the update instruction corresponding to the monitored event based on the monitored event, and the update instruction may indicate the corresponding logical processing for the currently monitored event, that is, according to the processing logic corresponding to the monitored event, the corresponding data structure is updated.

以及在一种可能的实现方式中,插件单元在确定更新指令的时候,比如说是由插件单元确定事件所对应的处理逻辑,之后将处理逻辑相关的信息,发送给上述介绍的执行单元,由执行单元对相关信息进行封装,从而得到更新指令,其中更新指令的具体生成方式可以根据实际需求进行选择和设置,本实施例对此不做限制。And in a possible implementation method, when the plug-in unit determines the update instruction, for example, the plug-in unit determines the processing logic corresponding to the event, and then sends the information related to the processing logic to the execution unit introduced above, and the execution unit encapsulates the relevant information to obtain the update instruction, wherein the specific generation method of the update instruction can be selected and set according to actual needs, and this embodiment does not limit this.

10、插件单元向数据处理单元发送更新指令。10. The plug-in unit sends an update instruction to the data processing unit.

11、数据处理单元根据更新指令更新数据结构。11. The data processing unit updates the data structure according to the update instruction.

其中,更新指令可以指示数据结构具体的更新方式,其中不同的事件对应有不同的数据结构更新的处理方式,数据结构的具体实现可以参照上述实施例的介绍,此处不再赘述。The update instruction may indicate a specific update method of the data structure, wherein different events correspond to different processing methods for updating the data structure. The specific implementation of the data structure may refer to the introduction of the above embodiment and will not be repeated here.

12、数据处理单元向记录单元发送事件信息。12. The data processing unit sends event information to the recording unit.

比如说当前情况下,数据处理单元就可以是向记录单元发送修改事件所对应的事件信息,其中事件信息比如说可以包括修改的内容、修改的位置等等。For example, in the current situation, the data processing unit may send event information corresponding to the modification event to the recording unit, wherein the event information may include, for example, the modified content, the modified location, and the like.

13、记录单元根据事件信息,记录插入表格的历史记录。13. The recording unit records the history of the insertion table according to the event information.

在一种可能的实现方式中,,记录单元在接收到事件信息之后,可以将修改表格的历史记录存储在第一堆栈中,其中第一堆栈用于存储已完成的操作所对应的信息。In a possible implementation, after receiving the event information, the recording unit may store the history record of modifying the table in a first stack, where the first stack is used to store information corresponding to the completed operation.

14、记录单元通知渲染单元操作记录完成。14. The recording unit notifies the rendering unit that the operation recording is completed.

15、渲染单元根据更新后的数据结构,渲染并显示插入表格的表格样式。15. The rendering unit renders and displays the table style of the inserted table according to the updated data structure.

16、渲染单元将更新后的数据结构保存在数据库中,以实现对富文本编辑器中的修改后的富文本内容的存储。16. The rendering unit saves the updated data structure in the database to implement storage of the modified rich text content in the rich text editor.

基于当前实施例介绍可以确定的是,基于本实施例中的富文本编辑器的框架,可以简单有效的通过数据结构的更新,实现表格相应的处理操作,以扩展富文本编辑器的功能。Based on the introduction of the current embodiment, it can be determined that based on the framework of the rich text editor in this embodiment, the corresponding processing operations of the table can be implemented simply and effectively by updating the data structure to expand the functions of the rich text editor.

在上述介绍内容的基础上,下面可以对本申请实施例中提供的富文本编辑器以及其中的插件单元进行进一步的介绍。Based on the above introduction, the rich text editor provided in the embodiment of the present application and the plug-in unit therein can be further introduced below.

在富文本编辑器中包括插件单元,在插件单元中可以包括表格编辑插件,以及在插件单元中还可以包括其他功能的插件。The rich text editor includes a plug-in unit, the plug-in unit may include a table editing plug-in, and the plug-in unit may further include plug-ins with other functions.

也就是说,本实施例中的插件单元中,可以针对不同的功能设置不同的插件,以通过多个插件分别实现相应的功能的实现方式,可以保证各个功能之间的处理是相互独立的,在需要针对某些功能进行更新迭代的时候,只需要对相应的插件进行处理就可以实现,从而可以有效的提升调整和控制富文本编辑器的灵活性。That is to say, in the plug-in unit in this embodiment, different plug-ins can be set for different functions, so that the corresponding functions can be implemented through multiple plug-ins respectively, which can ensure that the processing between each function is independent of each other. When it is necessary to update and iterate certain functions, it can be achieved by processing the corresponding plug-in, thereby effectively improving the flexibility of adjusting and controlling the rich text editor.

在一种可能的实现方式中,针对数据结构中的每个子数据,都存在其对应的类型参数,那么基于子数据中的类型参数,就可以快速有效的确定使用哪个组件来进行相应的处理。In a possible implementation, for each sub-data in the data structure, there is a corresponding type parameter, then based on the type parameter in the sub-data, it is possible to quickly and effectively determine which component to use for corresponding processing.

以及基于上述介绍还可以确定的是,在富文本编辑器中包括渲染单元,其中渲染单元中比如说可以通过React组件定义渲染逻辑,比如说可以对数据结构进行编译,从而生成html片段,并显示在富文本编辑器中。Based on the above introduction, it can also be determined that the rich text editor includes a rendering unit, wherein the rendering unit can define rendering logic through, for example, a React component, for example, a data structure can be compiled to generate an HTML fragment and display it in the rich text editor.

在事件监听单元监听到用户操作触发的事件之后,可以由插件单元确定相应的处理逻辑,并触发数据处理单元进行相应的数据结构更新,数据结构更新之后可以进一步的触发渲染单元重新渲染,其中数据可以使用JSON格式和渲染解耦,从而可以实现跨项目以及跨架构的使用,以保证富文本编辑器的通用性更好。After the event listening unit listens to the event triggered by the user operation, the plug-in unit can determine the corresponding processing logic and trigger the data processing unit to update the corresponding data structure. After the data structure is updated, the rendering unit can be further triggered to re-render. The data can be decoupled from the rendering in JSON format, so that it can be used across projects and architectures to ensure better versatility of the rich text editor.

在可选的实现方式中,富文本编辑器在接收用户的操作之前,还可以存在一个初始化的过程,下面针对富文本编辑器的初始化过程进行说明。In an optional implementation, the rich text editor may also undergo an initialization process before receiving a user operation. The initialization process of the rich text editor is described below.

在第一应用程序启动时,第二渲染单元可以渲染第一应用程序的图形用户界面,以备忘录为例,比如说可以渲染上述介绍的备忘录的图形用户界面中的文件列表、笔记列表和用户事件响应区。其中,文件列表显示用户的文件分类,笔记列表显示文件夹中存储的富文本列表,用户事件响应区显示用户可以对富文本内容执行的编辑操作。When the first application is started, the second rendering unit can render the graphical user interface of the first application. Taking the memo as an example, for example, the file list, note list and user event response area in the graphical user interface of the memo described above can be rendered. Among them, the file list displays the user's file classification, the note list displays the rich text list stored in the folder, and the user event response area displays the editing operations that the user can perform on the rich text content.

在第一应用程序启动之后,需要针对富文本编辑器中所显示的富文本内容的数据模型进行初始化。After the first application is started, the data model for the rich text content displayed in the rich text editor needs to be initialized.

在一种可能的实现方式中,在第一应用程序的图形用户界面上包括多个富文本内容的列表,比如说用户可以选择打开列表中的某个富文本内容,那么相应的就需要将用户选择打开的富文本内容显示在富文本编辑器中。因此当前的初始化指令就可以是指示对用户所选择打开的富文本内容进行处理,以确定其对应的数据模型,也就是说富文本编辑器中显示什么内容,就对应初始化生成该显示内容的数据模型。本实施例中的数据模型可以理解为上述介绍的JSON格式的富文本数据。In a possible implementation, a list of multiple rich text contents is included on the graphical user interface of the first application. For example, a user can choose to open a certain rich text content in the list, and then the rich text content selected by the user to open needs to be displayed in the rich text editor. Therefore, the current initialization instruction can be to instruct to process the rich text content selected by the user to open to determine its corresponding data model, that is, what content is displayed in the rich text editor corresponds to the initialization of the data model of the displayed content. The data model in this embodiment can be understood as the rich text data in the JSON format introduced above.

以及富文本编辑器中的渲染单元根据初始化指令,初始化富文本编辑器中的富文本内容的数据模型。And the rendering unit in the rich text editor initializes the data model of the rich text content in the rich text editor according to the initialization instruction.

在本实施例中,初始化指令用于指示富文本编辑器生成富文本编辑器中所显示的富文本内容的数据模型,因此富文本编辑器在接收到初始化指令之后,可以生成上述的显示操作所对应的富文本内容的数据模型。In this embodiment, the initialization instruction is used to instruct the rich text editor to generate a data model of the rich text content displayed in the rich text editor. Therefore, after receiving the initialization instruction, the rich text editor can generate a data model of the rich text content corresponding to the above display operation.

第一应用程序的UI渲染层向第一应用程序的指令处理单元发送启动指令,启动指令用于指示指令处理单元启动。The UI rendering layer of the first application sends a startup instruction to the instruction processing unit of the first application, where the startup instruction is used to instruct the instruction processing unit to start.

在备忘录启动的同时,UI渲染层可以指示指令处理单元也启动,在一种可能的实现方式中,UI渲染层比如说可以向指令处理单元发送相应的启动指令,从而启动指令处理单元。When the memo is started, the UI rendering layer may instruct the instruction processing unit to also start. In a possible implementation, the UI rendering layer may, for example, send a corresponding start instruction to the instruction processing unit, thereby starting the instruction processing unit.

指令处理单元启动之后可以注册第一应用程序所支持的功能指令,比如说加粗指令、设置斜体指令、插入表格指令、修改表格指令等等,其中指令单元所需要注册的指令可以取决于第一应用程序具体所支持的指令,本实施例对注册指令的具体实现不做限制。After the instruction processing unit is started, it can register the functional instructions supported by the first application, such as bold instructions, italic instructions, table insert instructions, table modification instructions, etc. The instructions that the instruction unit needs to register may depend on the instructions specifically supported by the first application. This embodiment does not limit the specific implementation of the registration instructions.

在完成上述介绍的初始化过程之后,本实施例中的富文本编辑器就可以根据用户的操作进行相应的表格编辑,以有效的扩展富文本编辑器的功能。After completing the initialization process described above, the rich text editor in this embodiment can perform corresponding table editing according to the user's operation, so as to effectively expand the function of the rich text editor.

图15为本申请实施例提供的表格数据处理装置的结构示意图。如图15所示,该装置150包括:确定模块1501、获取模块1502以及处理模块1503。FIG15 is a schematic diagram of the structure of a table data processing device provided in an embodiment of the present application. As shown in FIG15 , the device 150 includes: a determination module 1501 , an acquisition module 1502 , and a processing module 1503 .

确定模块1501,用于响应作用于第一应用程序的图形用户界面中的表格编辑操作,确定表格编辑事件;A determination module 1501, configured to determine a table editing event in response to a table editing operation in a graphical user interface of a first application;

获取模块1502,用于获取所述富文本编辑器中的第一富文本内容所对应的数据结构,并根据所述表格编辑事件更新所述数据结构;An acquisition module 1502 is used to acquire a data structure corresponding to the first rich text content in the rich text editor, and update the data structure according to the table editing event;

处理模块1503,用于根据更新后的数据结构,在所述富文本编辑器中显示所述更新后的数据结构所对应的第二富文本内容,所述第一富文本内容和/或所述第二富文本内容中包括表格;The processing module 1503 is configured to display, in the rich text editor, second rich text content corresponding to the updated data structure according to the updated data structure, wherein the first rich text content and/or the second rich text content includes a table;

所述富文本编辑器为基于网页视图开发的。The rich text editor is developed based on the web page view.

在一些实现方式中,所述第一应用程序的图形用户界面中包括表格插入控件;In some implementations, the graphical user interface of the first application includes a table insertion control;

所述确定模块1501具体用于:The determining module 1501 is specifically used for:

响应作用于所述表格插入控件的点击操作,在所述图形用户界面中显示调整控件,所述调整控件中包括多个预选单元格和/或文本输入框;In response to a click operation on the table insert control, an adjustment control is displayed in the graphical user interface, wherein the adjustment control includes a plurality of pre-selected cells and/or text input boxes;

响应作用于所述多个预选单元格的选择操作,或者,响应针对于所述文本输入框中的输入内容的确认操作,确定所述表格编辑事件为插入事件,所述选择操作以及所述确认操作用于指示表格尺寸,所述插入事件用于指示在所述富文本编辑器中插入所述表格尺寸对应的表格;In response to a selection operation on the plurality of pre-selected cells, or in response to a confirmation operation on input content in the text input box, determining that the table editing event is an insert event, the selection operation and the confirmation operation are used to indicate a table size, and the insert event is used to indicate inserting a table corresponding to the table size in the rich text editor;

其中,所述表格插入操作为所述选择操作或者所述确认操作。The table insert operation is the selection operation or the confirmation operation.

在一些实现方式中,所述处理模块1503具体用于:In some implementations, the processing module 1503 is specifically configured to:

根据所述插入事件,确定待插入表格的表格尺寸;Determine the table size of the table to be inserted according to the insert event;

根据所述表格尺寸,生成所述待插入表格对应的表格数据结构,所述表格数据结构中包括所述待插入表格中的多个单元格各自对应的子数据;Generate a table data structure corresponding to the table to be inserted according to the table size, wherein the table data structure includes sub-data corresponding to each of the plurality of cells in the table to be inserted;

将所述表格数据结构添加至所述数据结构中的目标位置,以得到更新后的数据结构。The table data structure is added to a target position in the data structure to obtain an updated data structure.

在一些实现方式中,所述处理模块1503还用于:In some implementations, the processing module 1503 is further configured to:

针对所述富文本编辑器中所显示的表格,响应作用于所述表格的选区操作,确定所述选区操作所对应的选中单元格;For a table displayed in the rich text editor, in response to a selection operation performed on the table, determining a selected cell corresponding to the selection operation;

根据所述选区操作所对应的选中单元格,确定选中框的位置信息,所述位置信息包括宽度、高度以及坐标位置;Determine the position information of the selected box according to the selected cell corresponding to the selection operation, wherein the position information includes width, height and coordinate position;

根据所述选中框的位置信息,在所述富文本编辑器中渲染并显示所述选中框。The check box is rendered and displayed in the rich text editor according to the position information of the check box.

在一些实现方式中,所述富文本编辑器中显示有行选中控件和列选中控件;In some implementations, a row selection control and a column selection control are displayed in the rich text editor;

所述选区操作为针对所述行选择控件的点击操作,则所述选区操作所对应的选中单元格为所述行选择控件对应的选中行中的多个单元格;或者,The selection operation is a click operation on the row selection control, and the selected cells corresponding to the selection operation are multiple cells in the selected row corresponding to the row selection control; or,

所述选区操作为针对所述列选中控件的点击操作,则所述选区操作所对应的选中单元格为所述列选择控件对应的选中列中的多个单元格。The selection operation is a click operation on the column selection control, and the selected cells corresponding to the selection operation are multiple cells in the selected column corresponding to the column selection control.

在一些实现方式中,所述选区操作为作用于所述表格的拖拽操作;In some implementations, the selection operation is a drag operation on the table;

所述选区操作所对应的选中单元格为所述拖拽操作所形成的拖拽范围内所包括的单元格。The selected cells corresponding to the area selection operation are cells included in the drag range formed by the drag operation.

在一些实现方式中,所述确定模块1501具体用于:In some implementations, the determining module 1501 is specifically configured to:

响应作用于所述选中单元格的触发操作,显示至少一个选择控件,所述选择控件包括如下中的至少一种:删除控件、第一添加控件以及第二添加控件;In response to a trigger operation acting on the selected cell, displaying at least one selection control, the selection control comprising at least one of the following: a delete control, a first add control, and a second add control;

响应作用于所述至少一个选择控件中的目标选择控件的点击操作,确定所述表格编辑事件为修改事件。In response to a click operation on a target selection control among the at least one selection control, the table editing event is determined to be a modification event.

在一些实现方式中,所述选中单元格在所述表格中位于同一行,则所述第一添加控件用于指示在所述选中单元格所在行的上方添加一行单元格,所述第二添加控件用于指示在所述选中单元格所在行的下方添加一行单元格,所述删除控件用于指示删除所述选中单元格所在行的单元格。In some implementations, the selected cells are located in the same row in the table, and the first add control is used to indicate adding a row of cells above the row where the selected cells are located, the second add control is used to indicate adding a row of cells below the row where the selected cells are located, and the delete control is used to indicate deleting the cells in the row where the selected cells are located.

在一些实现方式中,若所述目标选择控件为所述删除控件,则所述修改事件为删除行事件;In some implementations, if the target selection control is the delete control, the modification event is a delete row event;

所述处理模块1503具体用于:The processing module 1503 is specifically used for:

在所述数据结构中,删除所述选中单元格所在行的各个单元格所对应的子数据,以得到更新后的数据结构;In the data structure, deleting the sub-data corresponding to each cell in the row where the selected cell is located, to obtain an updated data structure;

若所述目标选择控件为所述第一添加控件,则所述修改事件为第一添加行事件;If the target selection control is the first add control, the modification event is a first add row event;

所述处理模块1503具体用于:The processing module 1503 is specifically used for:

在所述数据结构中的第一位置添加一行单元格所对应的子数据,以得到更新后的数据结构,所述第一位置用于使得添加行的单元格位于所述选中单元格所在行的单元格的上方;Adding sub-data corresponding to a row of cells at a first position in the data structure to obtain an updated data structure, wherein the first position is used to make the cells of the added row be located above the cells of the row where the selected cell is located;

若所述目标选择控件为所述第二添加控件,则所述修改事件为第二添加行事件;If the target selection control is the second adding control, the modification event is a second adding row event;

所述处理模块1503具体用于:The processing module 1503 is specifically used for:

在所述数据结构中的第二位置添加一行单元格所对应的子数据,以得到更新后的数据结构,所述第二位置用于使得添加行的单元格位于所述选中单元格所在行的单元格的下方。Sub-data corresponding to a row of cells are added at a second position in the data structure to obtain an updated data structure, wherein the second position is used to make the cells of the added row located below the cells of the row where the selected cell is located.

在一些实现方式中,所述选中单元格在所述表格中位于同一列,则所述第一添加控件用于指示在所述选中单元格所在列的左侧添加一列单元格,所述第二添加控件用于指示在所述选中单元格所在列的右侧添加一列单元格,所述删除控件用于指示删除所述选中单元格所在列的单元格。In some implementations, the selected cells are located in the same column in the table, and the first add control is used to indicate adding a column of cells to the left of the column where the selected cells are located, the second add control is used to indicate adding a column of cells to the right of the column where the selected cells are located, and the delete control is used to indicate deleting the cells in the column where the selected cells are located.

在一些实现方式中,若所述目标选择控件为所述删除控件,则所述修改事件为删除列事件;In some implementations, if the target selection control is the delete control, the modification event is a delete column event;

所述处理模块1503具体用于:The processing module 1503 is specifically used for:

在所述数据结构中,删除所述选中单元格所在列的各个单元格所对应的子数据,以得到更新后的数据结构;In the data structure, deleting the sub-data corresponding to each cell in the column where the selected cell is located, to obtain an updated data structure;

若所述目标选择控件为所述第一添加控件,则所述修改事件为第一添加列事件;If the target selection control is the first adding control, the modification event is a first adding column event;

所述处理模块1503具体用于:The processing module 1503 is specifically used for:

在所述数据结构中的第三位置添加一列单元格所对应的子数据,以得到更新后的数据结构,所述第三位置用于使得添加列的单元格位于所述选中单元格所在列的单元格的左侧;Adding sub-data corresponding to a column of cells at a third position in the data structure to obtain an updated data structure, wherein the third position is used to make the cells of the added column be located to the left of the cells in the column where the selected cell is located;

若所述目标选择控件为所述第二添加控件,则所述修改事件为第二添加列事件;If the target selection control is the second adding control, the modification event is a second adding column event;

所述处理模块1503具体用于:The processing module 1503 is specifically used for:

在所述数据结构中的第四位置添加一列单元格所对应的子数据,以得到更新后的数据结构,所述第四位置用于使得添加列的单元格位于所述选中单元格所在列的单元格的右侧。Add sub-data corresponding to a column of cells at a fourth position in the data structure to obtain an updated data structure, wherein the fourth position is used to make the cells of the added column to the right of the cells in the column where the selected cell is located.

在一些实现方式中,所述富文本编辑器中包括表格编辑插件和数据处理单元;In some implementations, the rich text editor includes a table editing plug-in and a data processing unit;

所述处理模块1503具体用于:The processing module 1503 is specifically used for:

通过所述表格编辑插件,确定所述表格编辑事件对应的更新指令;Determining, by means of the table editing plug-in, an update instruction corresponding to the table editing event;

所述表格编辑插件向所述数据处理单元发送所述更新指令,以使得所述数据处理单元根据所述更新指令更新所述数据结构。The table editing plug-in sends the update instruction to the data processing unit, so that the data processing unit updates the data structure according to the update instruction.

本实施例提供的装置,可用于执行上述方法实施例的技术方案,其实现原理和技术效果类似,本实施例此处不再赘述。The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

本申请实施例提供的表格处理方法,可以应用在具备通信功能的电子设备中。电子设备包括终端设备,终端设备的具体设备形态等可以参照上述相关说明,此处不再赘述。The table processing method provided in the embodiment of the present application can be applied to electronic devices with communication functions. The electronic devices include terminal devices, and the specific device form of the terminal devices can refer to the above related descriptions, which will not be repeated here.

本申请实施例提供一种终端设备,可以参照图16进行理解,图16为本申请实施例提供的终端设备的硬件结构示意图。An embodiment of the present application provides a terminal device, which can be understood by referring to Figure 16. Figure 16 is a schematic diagram of the hardware structure of the terminal device provided by the embodiment of the present application.

如图16所示,该终端设备160包括:包括:处理器1601和存储器1602;存储器1602存储计算机执行指令;处理器1601执行存储器1602存储的计算机执行指令,使得终端设备160执行上述方法。As shown in FIG. 16 , the terminal device 160 includes: a processor 1601 and a memory 1602 ; the memory 1602 stores computer-executable instructions; the processor 1601 executes the computer-executable instructions stored in the memory 1602 , so that the terminal device 160 executes the above method.

当存储器1602独立设置时,该终端设备还包括总线1203,用于连接所述存储器1202和处理器1601。When the memory 1602 is independently provided, the terminal device further includes a bus 1203 for connecting the memory 1202 and the processor 1601 .

本申请实施例提供一种芯片。芯片包括处理器,处理器用于调用存储器中的计算机程序,以执行上述实施例中的技术方案。其实现原理和技术效果与上述相关实施例类似,此处不再赘述。The embodiment of the present application provides a chip. The chip includes a processor, and the processor is used to call a computer program in a memory to execute the technical solution in the above embodiment. Its implementation principle and technical effect are similar to those of the above related embodiments, and will not be repeated here.

本申请实施例还提供了一种计算机可读存储介质。计算机可读存储介质存储有计算机程序。计算机程序被处理器执行时实现上述方法。上述实施例中描述的方法可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。如果在软件中实现,则功能可以作为一个或多个指令或代码存储在计算机可读介质上或者在计算机可读介质上传输。计算机可读介质可以包括计算机存储介质和通信介质,还可以包括任何可以将计算机程序从一个地方传送到另一个地方的介质。存储介质可以是可由计算机访问的任何目标介质。The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. The above method is implemented when the computer program is executed by the processor. The method described in the above embodiment can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the function can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium that can be accessed by a computer.

一种可能的实现方式中,计算机可读介质可以包括RAM,ROM,只读光盘(compactdisc read-only memory,CD-ROM)或其它光盘存储器,磁盘存储器或其它磁存储设备,或目标于承载的任何其它介质或以指令或数据结构的形式存储所需的程序代码,并且可由计算机访问。而且,任何连接被适当地称为计算机可读介质。例如,如果使用同轴电缆,光纤电缆,双绞线,数字用户线(Digital Subscriber Line,DSL)或无线技术(如红外,无线电和微波)从网站,服务器或其它远程源传输软件,则同轴电缆,光纤电缆,双绞线,DSL或诸如红外,无线电和微波之类的无线技术包括在介质的定义中。如本文所使用的磁盘和光盘包括光盘,激光盘,光盘,数字通用光盘(Digital Versatile Disc,DVD),软盘和蓝光盘,其中磁盘通常以磁性方式再现数据,而光盘利用激光光学地再现数据。上述的组合也应包括在计算机可读介质的范围内。In one possible implementation, a computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disk storage, disk storage or other magnetic storage devices, or any other medium that is intended to carry or store the required program code in the form of instructions or data structures and can be accessed by a computer. Moreover, any connection is appropriately referred to as a computer-readable medium. For example, if a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technology (such as infrared, radio and microwave) is used to transmit software from a website, server or other remote source, the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disks and optical disks as used herein include optical disks, laser disks, optical disks, digital versatile disks (DVD), floppy disks and Blu-ray disks, where disks usually reproduce data magnetically, while optical disks reproduce data optically using lasers. Combinations of the above should also be included in the scope of computer-readable media.

本申请实施例提供一种计算机程序产品,计算机程序产品包括计算机程序,当计算机程序被运行时,使得计算机执行上述方法。An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the above method.

本申请实施例是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程设备的处理单元以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理单元执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application embodiment is described with reference to the flowchart and/or block diagram of the method, device (system) and computer program product according to the present application embodiment. It should be understood that each process and/or box in the flowchart and/or block diagram and the combination of the process and/or box in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processing unit of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable device to produce a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device produce a device for realizing the function specified in one process or multiple processes in the flowchart and/or one box or multiple boxes in the block diagram.

以上的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本发明的保护范围之内。The above specific implementation methods further illustrate the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present invention should be included in the protection scope of the present invention.

Claims (16)

1. A method of table data processing, for application to a first application, the first application including a rich text editor therein, the method comprising:
Determining a form editing event in response to a form editing operation in a graphical user interface acting on the first application program;
Acquiring a data structure corresponding to first rich text content in the rich text editor, and updating the data structure according to the table editing event;
Displaying second rich text content corresponding to the updated data structure in the rich text editor according to the updated data structure, wherein the first rich text content and/or the second rich text content comprise tables;
The rich text editor is developed based on a web page view.
2. The method of claim 1, wherein the first application includes a form insertion control in a graphical user interface;
The determining a form edit event in response to a form edit operation in a graphical user interface acting on the first application program comprises:
responsive to a click operation on the form insertion control, displaying an adjustment control in the graphical user interface, the adjustment control including a plurality of pre-selected cells and/or text input boxes therein;
Determining the form editing event as an insertion event in response to a selection operation acting on the plurality of preselected cells or in response to a confirmation operation for input content in the text input box, the selection operation and the confirmation operation being used for indicating a form size, the insertion event being used for indicating insertion of a form corresponding to the form size in the rich text editor;
Wherein the table insertion operation is the selection operation or the confirmation operation.
3. The method of claim 2, wherein the updating the data structure according to the form edit event comprises:
determining the form size of a form to be inserted according to the insertion event;
generating a table data structure corresponding to the table to be inserted according to the table size, wherein the table data structure comprises sub data corresponding to each of a plurality of cells in the table to be inserted;
And adding the table data structure to a target position in the data structure to obtain an updated data structure.
4. A method according to any one of claims 1-3, wherein the method further comprises:
Responding to a selection operation acting on a table displayed in the rich text editor, and determining a selected cell corresponding to the selection operation;
determining position information of a selected frame according to the selected cell corresponding to the selected region operation, wherein the position information comprises width, height and coordinate positions;
And rendering and displaying the selected frame in the rich text editor according to the position information of the selected frame.
5. The method of claim 4, wherein a row selection control and a column selection control are displayed in the rich text editor;
the selecting operation is clicking operation aiming at the row selection control, and the selected cells corresponding to the selecting operation are a plurality of cells in the selected row corresponding to the row selection control; or alternatively
And the selection operation is a clicking operation aiming at the column selection control, and the selected cells corresponding to the selection operation are a plurality of cells in the selected column corresponding to the column selection control.
6. The method of claim 4, wherein the selection operation is a drag operation on the form;
And the selected cells corresponding to the region selection operation are cells included in a drag range formed by the drag operation.
7. The method of any of claims 4-6, wherein determining a form edit event in response to a form edit operation in a graphical user interface acting on the first application program comprises:
in response to a triggering operation acting on the selected cell, displaying at least one selection control, the selection control comprising at least one of: deleting a control, a first adding control and a second adding control;
and determining that the table editing event is a modification event in response to a clicking operation on a target selection control in the at least one selection control.
8. The method of claim 7, wherein the selected cells are in the same row in the table, the first add control is for indicating that a row of cells is added above the row of selected cells, the second add control is for indicating that a row of cells is added below the row of selected cells, and the delete control is for indicating that the row of selected cells is deleted.
9. The method of claim 8, wherein if the target selection control is the delete control, the modification event is a delete line event;
the updating the data structure according to the table editing event comprises:
deleting sub-data corresponding to each cell of the row of the selected cell in the data structure to obtain an updated data structure;
if the target selection control is the first adding control, the modification event is a first adding line event;
the updating the data structure according to the table editing event comprises:
adding sub-data corresponding to a row of cells in the data structure to obtain an updated data structure, wherein the first position is used for enabling the cells of the added row to be located above the cells of the selected cell row;
If the target selection control is the second adding control, the modification event is a second adding line event;
the updating the data structure according to the table editing event comprises:
And adding sub-data corresponding to a row of cells at a second position in the data structure to obtain an updated data structure, wherein the second position is used for enabling the cells of the added row to be positioned below the cells of the selected cell row.
10. The method of claim 7, wherein the selected cells are in the same column in the table, the first adding control is configured to instruct adding a column of cells to a left side of the column in which the selected cells are located, the second adding control is configured to instruct adding a column of cells to a right side of the column in which the selected cells are located, and the delete control is configured to instruct deleting the cells in the column in which the selected cells are located.
11. The method of claim 10, wherein if the target selection control is the delete control, the modification event is a delete column event;
the updating the data structure according to the table editing event comprises:
deleting sub-data corresponding to each cell of the column of the selected cell in the data structure to obtain an updated data structure;
If the target selection control is the first adding control, the modification event is a first adding column event;
the updating the data structure according to the table editing event comprises:
Adding sub-data corresponding to a column of cells in a third position in the data structure to obtain an updated data structure, wherein the third position is used for enabling the cells added with the column to be positioned at the left side of the cells in the column where the selected cells are positioned;
if the target selection control is the second adding control, the modification event is a second adding column event;
the updating the data structure according to the table editing event comprises:
and adding sub-data corresponding to a column of cells in a fourth position in the data structure to obtain an updated data structure, wherein the fourth position is used for enabling the cell added with the column to be positioned on the right side of the cell in the column where the selected cell is positioned.
12. The method of any one of claims 1-11, wherein the rich text editor includes a form editing plug-in and a data processing unit therein;
the updating the data structure according to the table editing event comprises:
Determining an update instruction corresponding to the table editing event through the table editing plug-in;
the table editing plug-in sends the updating instruction to the data processing unit so that the data processing unit updates the data structure according to the updating instruction.
13. A tabular data processing apparatus, said apparatus comprising:
a determining module for determining a form editing event in response to a form editing operation in a graphical user interface acting on the first application;
The acquisition module is used for acquiring a data structure corresponding to the first rich text content in the rich text editor and updating the data structure according to the table editing event;
The processing module is used for displaying second rich text content corresponding to the updated data structure in the rich text editor according to the updated data structure, wherein the first rich text content and/or the second rich text content comprise tables;
The rich text editor is developed based on a web page view.
14. A terminal device, comprising: a processor and a memory;
The memory stores computer-executable instructions;
The processor executing computer-executable instructions stored in the memory to cause the terminal device to perform the method of any one of claims 1-12.
15. A computer readable storage medium storing a computer program, which when executed by a processor performs the method according to any one of claims 1-12.
16. A computer program product comprising a computer program which, when run, causes a computer to perform the method of any of claims 1-12.
CN202211522148.2A 2022-11-30 2022-11-30 Table data processing method and device Pending CN118153533A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211522148.2A CN118153533A (en) 2022-11-30 2022-11-30 Table data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211522148.2A CN118153533A (en) 2022-11-30 2022-11-30 Table data processing method and device

Publications (1)

Publication Number Publication Date
CN118153533A true CN118153533A (en) 2024-06-07

Family

ID=91292260

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211522148.2A Pending CN118153533A (en) 2022-11-30 2022-11-30 Table data processing method and device

Country Status (1)

Country Link
CN (1) CN118153533A (en)

Similar Documents

Publication Publication Date Title
CN111552473B (en) Application processing method, device and equipment
CN109614424B (en) Page layout generation method, device, computing equipment and medium
US9946518B2 (en) System and method for extending a visualization platform
CN103092612B (en) Realize method and the electronic installation of Android operation system 3D desktop pinup picture
CN110489116A (en) A kind of rendering method of the page, device and computer storage medium
US20130117657A1 (en) Designing interactive web templates
CN103339625A (en) Method for displaying a data set
US20080240683A1 (en) Method and system to reproduce contents, and recording medium including program to reproduce contents
CN104298721B (en) A kind of arbitrarily a object split screen layout edit methods of the online courseware development based on Web
CN112052416A (en) Method and device for displaying image elements
CN106162302A (en) Method of combination, device and the intelligent television at the main interface of a kind of Launcher
CN112068826B (en) Text input control method, system, electronic device and storage medium
CN113792208B (en) Picture interaction method, device, equipment, medium and program product based on webpage
CN112711731A (en) Data point burying method, device, equipment and storage medium
CN112307377A (en) Information display method and device and electronic equipment
KR101649822B1 (en) Apparatus and method for building web-page
CN118153533A (en) Table data processing method and device
CN116820453A (en) Universal form component design method based on elementUI
CN114386369A (en) Text processing method and device, electronic equipment and medium
US8677255B1 (en) Expanded container view for graphical editing environment
CN116595284B (en) Webpage system operation method, device, equipment, storage medium and program
CN111782309A (en) Method and device for displaying information and computer readable storage medium
KR20060042095A (en) Systems and methods for toolkits in markup language documents
CN118095199A (en) Rich text processing method and device
CN118069255A (en) Rich text processing method and device

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Applicant after: Honor Terminal Co.,Ltd.

Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong

Applicant before: Honor Device Co.,Ltd.

Country or region before: China