Text editing method, device and equipment and computer readable storage medium

By inserting target characters in adjacent positions before and after the target element and establishing a relationship, the problem of the cursor disappearing was solved, and the normal display and movement of the cursor were realized, thus improving the user experience.

CN116227451BActive Publication Date: 2026-03-31BEIJING HONGHE LEXUE EDUCATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

When adding certain types of target elements in a text editor, the cursor disappears, making it impossible to effectively assist in positioning.

Method used

Insert the target character before and after the target element, establish the association between the target element and the target character, and control the cursor to skip over the target element to prevent it from disappearing.

Benefits of technology

It enables normal cursor display and movement, improves user experience, and ensures the effectiveness of cursor-assisted positioning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116227451B_ABST
    Figure CN116227451B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a text editing method, device and equipment and a computer readable storage medium, the text editing method comprises the following steps: in response to a first instruction for adding a target element, adding the target element in an editing area, and inserting a target character in front and back adjacent positions of the target element, so that the cursor can be displayed on the side of the target character away from the target element, avoiding the disappearance of the cursor, and then better realizing the auxiliary positioning of the cursor and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of Internet technology, and in particular relates to a text editing method, apparatus, device and computer-readable storage medium. Background Technology

[0002] In Hyper Text Markup Language (HTML) mode, the `contenteditable` attribute allows for visual text editing. During editing, a cursor is used to help locate the editing position.

[0003] However, the inventors of this application have discovered that when certain types of target elements are added in text editing, the cursor disappears, making it impossible to achieve cursor-assisted positioning effectively. Summary of the Invention

[0004] This application provides a text editing method, apparatus, device, and computer-readable storage medium that can solve the problem of cursor disappearing during text editing and achieve better cursor-assisted positioning.

[0005] In a first aspect, embodiments of this application provide a text editing method, which includes: in response to a first instruction to add a target element, adding the target element in an editing area, and inserting target characters at adjacent positions before and after the target element.

[0006] According to an embodiment of the first aspect of this application, after adding a target element in an editing area in response to a first instruction to add a target element, and inserting target characters at adjacent positions before and after the target element, the text editing method further includes: establishing an association relationship between the target element and the target characters located on both sides of the target element.

[0007] According to an embodiment of the first aspect of this application, the text editing method further includes: responding to a second instruction to move the cursor, determining the direction of cursor movement and whether the element at the next position in the direction of movement is a target element; when the element at the next position in the direction of movement is a target element, controlling the cursor to jump from the side of the target character located on the first side of the target element away from the target element to the side of the target character located on the second side of the target element away from the target element.

[0008] According to any of the foregoing embodiments of the first aspect of this application, controlling the cursor to jump from the side of the target character located on the first side of the target element away from the target element to the side of the target character located on the second side of the target element away from the target element includes: when the cursor is located on the left side of the target element and the movement direction is to the right, controlling the cursor to move three positions to the right; when the cursor is located on the right side of the target element and the movement direction is to the left, controlling the cursor to move three positions to the left.

[0009] According to any of the foregoing embodiments of the first aspect of this application, the text editing method further includes: in response to a third instruction to delete a target element, deleting the target element and deleting target characters located on both sides of the target element.

[0010] According to any of the foregoing embodiments of the first aspect of this application, deleting a target element and deleting target characters located on both sides of the target element specifically includes: when the third instruction is to delete the target element located to the left of the cursor, in response to the third instruction, deleting the target character located to the right of the target element, and based on the association relationship, simultaneously deleting the target element and the target character located to the left of the target element; and / or, when the third instruction is to delete the target element located to the right of the cursor, in response to the third instruction, deleting the target character located to the left of the target element, and based on the association relationship, simultaneously deleting the target element and the target character located to the right of the target element.

[0011] According to any of the foregoing embodiments of the first aspect of this application, the target character includes a space.

[0012] Secondly, embodiments of this application provide a text editing device, which includes: an adding module, configured to add a target element in an editing area in response to a first instruction to add a target element, and to insert target characters at adjacent positions before and after the target element.

[0013] Thirdly, embodiments of this application provide an electronic device, which includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the text editing method provided in the first aspect.

[0014] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the text editing method provided in the first aspect.

[0015] The text editing method, apparatus, device, and computer-readable storage medium of this application embodiment, in response to a first instruction to add a target element, add the target element in the editing area and insert target characters at the positions before and after the target element, thereby enabling the cursor to be displayed on the side of the target character away from the target element, preventing the cursor from disappearing, and thus achieving better cursor-assisted positioning and improving the user experience. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a diagram illustrating text editing without the target element being added.

[0018] Figure 2 This is a diagram illustrating the process of adding a target element during text editing.

[0019] Figure 3 A flowchart illustrating a text editing method provided in an embodiment of this application;

[0020] Figure 4 An operational schematic diagram of the text editing method provided in this application embodiment;

[0021] Figure 5 Another flowchart illustrating the text editing method provided in this application embodiment;

[0022] Figure 6 Another schematic diagram illustrating the text editing method provided in the embodiments of this application;

[0023] Figure 7 Another flowchart illustrating the text editing method provided in this application embodiment;

[0024] Figure 8 A flowchart illustrating step S701 in the text editing method provided in this application embodiment;

[0025] Figure 9 Another schematic diagram illustrating the text editing method provided in the embodiments of this application;

[0026] Figure 10 A schematic diagram of the structure of a text editing device provided in an embodiment of this application;

[0027] Figure 11 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0028] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0029] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0030] It should be understood that the term "and / or" used herein is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, the terms "first," "second," and similar words used in the embodiments of this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components.

[0031] Various modifications and variations can be made to this application without departing from its spirit or scope, which will be apparent to those skilled in the art. Therefore, this application is intended to cover modifications and variations falling within the scope of the corresponding claims (the claimed technical solutions) and their equivalents. It should be noted that the embodiments provided in this application can be combined with each other without contradiction.

[0032] Before describing the technical solutions provided in the embodiments of this application, in order to facilitate understanding of the embodiments of this application, this application first specifically explains the problems existing in the related technologies:

[0033] Figure 1This is a diagram illustrating text editing without the target element being added. For example... Figure 1 As shown, text editing is required in HTML mode. When editing basic text (or plain text), the cursor is displayed normally and can be moved left and right using the keyboard.

[0034] However, in many cases, text editing requires adding certain types of target elements, such as using SVG to generate formulas, using fixed templates for text input (INPUT), or using dropdown form input (SELECT).

[0035] Figure 2 This is a diagram illustrating the process of adding a target element during text editing. For example... Figure 2 As shown, when adding target elements of certain types (such as SVG, INPUT, SELECT, etc.) in a text editor, if there is no text before or after the target element, the cursor will disappear, making it impossible to use the keyboard for positioning, deletion, and selection. It is as if the cursor has lost focus, thus making it impossible to achieve good cursor-assisted positioning.

[0036] In view of the inventors’ above-mentioned research findings, the embodiments of this application provide a text editing method, apparatus, device and computer-readable storage medium, which can solve the technical problem of cursor disappearing during text editing in related technologies.

[0037] The technical concept of this application embodiment is that when adding a target element, target characters are inserted in the positions before and after the target element, so that the cursor can be displayed on the side of the target character away from the target element, avoiding the cursor from disappearing, thereby achieving better cursor-assisted positioning and improving user experience.

[0038] The text editing method provided in the embodiments of this application will be introduced first below.

[0039] Figure 3 This is a flowchart illustrating a text editing method provided in an embodiment of this application. Figure 4 This is a schematic diagram illustrating an operation of the text editing method provided in an embodiment of this application. Figure 3 As shown, the text editing method may include the following steps:

[0040] S101. In response to the first instruction to add a target element, add the target element to the editing area and insert target characters at the positions before and after the target element.

[0041] like Figure 4As shown, in edit mode (such as Contenteditable edit mode), if a first instruction to add a target element is received, the target element 41 can be added to the edit area in response to the first instruction. Simultaneously, target characters can be inserted at positions adjacent to and before the target element 41. For example, target character A can be inserted adjacent to the beginning of target element 41, and target character B can be inserted adjacent to the beginning of target element 41. It should be noted that A and B are merely reference numerals in the illustration and are for illustrative purposes only; they do not represent the actual letters A and B.

[0042] When the cursor is at positions 2 and 3, it disappears. However, by inserting target characters A and B, the cursor can be positioned at positions 1 or 4, allowing it to appear on the side of the target character furthest from the target element. This ensures the cursor displays correctly at positions 1 or 4, effectively providing cursor positioning assistance and improving the user experience.

[0043] According to some embodiments of this application, optionally, the target element includes, but is not limited to, elements with the block attribute or form-related elements. The block attribute can be understood as a block display attribute, which is different from the row display attribute. For example, the target element includes, but is not limited to, elements such as SVG, INPUT, and SELECT, etc., and this application embodiment does not limit this.

[0044] According to some embodiments of this application, optionally, the target character can be any one or more characters, such as numbers, letters or symbols, etc., and this application does not limit this.

[0045] For aesthetic purposes, in some examples, the target character can be a space (or whitespace character). This way, the target character will be displayed as a whitespace, avoiding misleading the user and improving the overall appearance.

[0046] Optionally, according to some embodiments of this application, after S101, the text editing method provided in the embodiments of this application may further include the following steps:

[0047] Establish the association between the target element and the target characters located on both sides of the target element.

[0048] Specifically, it can establish a relationship between the target element and the target characters located on both sides of the target element, or bind the target element to the target characters located on both sides of the target element.

[0049] In this way, by binding the target element with the target characters located on both sides of the target element, it is possible to make it easier to delete the target element and the target characters on the other side together when one of the target characters or the target element is deleted.

[0050] Figure 5 This is another flowchart illustrating the text editing method provided in the embodiments of this application. Figure 6 This is another operational schematic diagram of the text editing method provided in the embodiments of this application. For example... Figure 5 As shown, according to some embodiments of this application, the text editing method may optionally include the following steps S501 and S502.

[0051] S501, in response to the second instruction to move the cursor, determine the direction of cursor movement and whether the element at the next position in the direction of movement is the target element.

[0052] The cursor can be moved left or right using input devices such as a keyboard. When a second command to move the cursor is received, it can be determined whether the cursor should move to the right or left. For example... Figure 6 As shown, when moving the cursor using the left and right arrow keys, if the cursor moves to the position adjacent to the front of the target element 41 (position 2) or the position adjacent to the back of the target element 41 (position 3), the cursor will disappear. Therefore, when the next element in the cursor's direction of movement is the target element, the target element needs to be skipped.

[0053] Specifically, the type of the target element can be pre-configured or defined, such as SVG, INPUT, or SELECT. When the element at the next position in the cursor movement direction is of one of these types, the element at the next position in the cursor movement direction is determined as the target element, and S502 is executed.

[0054] S502. When the next element in the movement direction is the target element, control the cursor to jump from the side of the target character located on the first side of the target element that is far away from the target element to the side of the target character located on the second side of the target element that is far away from the target element.

[0055] In some examples, the first side can be the left side, and the second side can be the right side. For example... Figure 6 As shown, when the cursor moves from left to right, it can be controlled to jump from the side of the target character A located to the left of the target element 41 away from the target element 41 (i.e., position 1) to the side of the target character B located to the right of the target element 41 away from the target element 41 (i.e., position 4).

[0056] In other examples, the first side can be the right side, and the second side can be the left side. For example... Figure 6As shown, when the cursor moves from right to left, it can be controlled to jump from the side of the target character B located to the right of the target element 41 away from the target element 41 (i.e., position 4) to the side of the target character A located to the left of the target element 41 away from the target element 41 (i.e., position 1).

[0057] In this way, during cursor movement, by controlling the cursor to jump from the side of the target character located on the first side of the target element away from the target element to the side of the target character located on the second side of the target element away from the target element, it is possible to avoid the cursor falling between the target element and the target character (i.e., positions 2 and 3), thus preventing the cursor from disappearing and ensuring that it can be displayed normally when the cursor is moving.

[0058] In some embodiments, optionally, in step S502, when the element is a target element, controlling the cursor to jump from the side of the target character located on the first side of the target element away from the target element to the side of the target character located on the second side of the target element away from the target element, may specifically include the following steps:

[0059] The cursor is moved one position in the direction of movement, and then moved two more positions in the same direction.

[0060] It should be noted that when executing the second instruction to move the cursor, the cursor should ideally be moved one position along the movement direction. However, in this embodiment, when executing the second instruction to move the cursor, the cursor is moved one position along the movement direction, and then two more positions along the movement direction, for a total movement of three positions. For example, the cursor is moved from position 1 to position 4. Alternatively, skipping two positions, such as positions 2 and 3, can prevent the cursor from disappearing.

[0061] As mentioned earlier, the direction of movement can include moving to the right or to the left. For example, as Figure 6 As shown, when the cursor is to the left of the target element 41 and the movement direction is to the right, the cursor can be moved three positions to the right. That is, the cursor can be moved from position 1 to position 4, skipping positions 2 and 3. When the cursor is to the right of the target element 41 and the movement direction is to the left, the cursor can be moved three positions to the left. That is, the cursor can be moved from position 4 to position 1, skipping positions 3 and 2.

[0062] In this way, during cursor movement, when the next element in the cursor's movement direction is the target element, by controlling the cursor to move one position in the movement direction and then continue to move two positions in the movement direction, we can avoid the cursor falling between the target element and the target character (i.e., positions 2 and 3), thus preventing the cursor from disappearing and ensuring that the cursor can be displayed normally even when it is moving.

[0063] Figure 7 This is another flowchart illustrating the text editing method provided in an embodiment of this application. For example... Figure 7 As shown, according to some embodiments of this application, optionally, the text editing method may further include the following step S701:

[0064] In response to the third instruction to delete the target element, delete the target element and the target characters located on both sides of the target element.

[0065] Specifically, when a third instruction to delete a target element is received, the target characters located on both sides of the target element can be deleted along with the target element. This ensures that no target characters are left in the editing area, making the display more aesthetically pleasing, and will not affect the insertion of the next target element and new target characters. On the other hand, it ensures that the cursor skips the target characters and target elements and displays normally.

[0066] Figure 8 This is a flowchart illustrating step S701 of the text editing method provided in the embodiments of this application. Figure 9 This is another schematic diagram of the text editing method provided in the embodiments of this application. According to some embodiments of this application, optionally, after establishing the association between the target element and the target characters located on both sides of the target element in S801, the step of deleting the target element and deleting the target characters located on both sides of the target element in S701 may specifically include the following steps S802 and S803.

[0067] S802. When the third instruction is to delete the target element located to the left of the cursor, in response to the third instruction, delete the target character located to the right of the target element, and based on the association relationship, delete both the target element and the target character located to the left of the target element.

[0068] like Figure 9 As shown, the cursor position can be determined when deleting a target element. When the target element 41 is to the left of the cursor, it can be to the left of the cursor but not adjacent to it. The cursor is also to the right of the target character B to the right of the target element 41. Therefore, it can respond to the third instruction and delete the target character B to the right of the target element 41. Simultaneously, based on the association between the target element and the target characters to its left and right, both the target element 41 and the target character A to its left are deleted.

[0069] S803. When the third instruction is to delete the target element located to the right of the cursor, in response to the third instruction, delete the target character located to the left of the target element, and based on the association relationship, delete both the target element and the target character located to the right of the target element.

[0070] Conversely to S802, when the target element 41 is to the right of the cursor, it can be to the right of the cursor but not adjacent to it. The cursor is also to the left of the target character A to the left of the target element 41. Responding to the third instruction, the target character A to the left of the target element 41 can be deleted. Simultaneously, based on the association between the target element and the target characters to its left and right, both the target element 41 and the target character B to its right are deleted.

[0071] Thus, in text editing mode, the cursor can be moved freely when inserting the target element, and the cursor will not disappear when the target element is deleted.

[0072] Based on the text editing method provided in the above embodiments, this application also provides a text editing device. Please refer to the following embodiments.

[0073] Figure 10 This is a schematic diagram of a text editing device provided in an embodiment of this application. Figure 10 As shown, the text editing device 100 provided in this application embodiment may include:

[0074] The addition module 101 is used to add the target element in the editing area in response to the first instruction to add the target element, and to insert the target character at the positions before and after the target element.

[0075] The text editing device of this application embodiment includes an adding module, which is used to add a target element in the editing area in response to a first instruction to add a target element, and to insert target characters at the positions before and after the target element, so that the cursor can be displayed on the side of the target character away from the target element, avoiding the cursor from disappearing, thereby achieving better cursor-assisted positioning and improving the user experience.

[0076] In some embodiments, the text editing device 100 provided in this application may further include a creation module for creating an association between a target element and target characters located on both sides of the target element.

[0077] In some embodiments, the text editing device 100 provided in this application may further include a movement module 102, which is used to determine the movement direction of the cursor and whether the element at the next position in the movement direction is a target element in response to a second instruction to move the cursor; when the element at the next position in the movement direction is a target element, the cursor is controlled to jump from the side of the target character located on the first side of the target element away from the target element to the side of the target character located on the second side of the target element away from the target element.

[0078] In some embodiments, the moving module 102 is specifically used to control the cursor to move two positions along the moving direction after moving one position along the moving direction.

[0079] In some embodiments, the moving module 102 is specifically used to control the cursor to move three positions to the right when the cursor is to the left of the target element and the moving direction is to the right; and to control the cursor to move three positions to the left when the cursor is to the right of the target element and the moving direction is to the left.

[0080] In some embodiments, the text editing device 100 provided in this application may further include a deletion module 103, which is used to delete the target element and delete the target characters located on both sides of the target element in response to a third instruction to delete the target element.

[0081] In some embodiments, the deletion module 103 is specifically configured to, when the third instruction is to delete the target element located to the left of the cursor, delete the target character located to the right of the target element in response to the third instruction, and delete the target element and the target character located to the left of the target element based on the association relationship; and / or, when the third instruction is to delete the target element located to the right of the cursor, delete the target character located to the left of the target element in response to the third instruction, and delete the target element and the target character located to the right of the target element based on the association relationship.

[0082] In some embodiments, the target character may include a space.

[0083] Figure 10 Each module / unit in the device shown has the function of implementing each step of the text editing method provided in the above method embodiment, and can achieve its corresponding technical effect. For the sake of brevity, it will not be described in detail here.

[0084] Based on the text editing method provided in the above embodiments, this application also provides specific implementation methods for electronic devices. Please refer to the following embodiments.

[0085] Figure 11 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown.

[0086] The electronic device may include a processor 1101 and a memory 1102 storing computer program instructions.

[0087] Specifically, the processor 1101 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0088] Memory 1102 may include mass storage for data or instructions. For example, and not limitingly, memory 1102 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. In one example, memory 1102 may include removable or non-removable (or fixed) media, or memory 1102 may be non-volatile solid-state memory. Memory 1102 may be internal or external to an electronic device.

[0089] In one example, memory 1102 may be read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.

[0090] Memory 1102 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Therefore, generally, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this application.

[0091] The processor 1101 reads and executes the computer program instructions stored in the memory 1102 to implement the methods / steps in the above method embodiments and achieve the corresponding technical effects achieved by the method embodiments in executing their methods / steps. For the sake of brevity, these will not be elaborated here.

[0092] In one example, the electronic device may also include a communication interface 1103 and a bus 1110. For example, Figure 11 As shown, the processor 1101, memory 1102, and communication interface 1103 are connected through bus 1110 and complete communication with each other.

[0093] The communication interface 1103 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0094] Bus 1110 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 1110 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.

[0095] Furthermore, in conjunction with the text editing methods in the above embodiments, this application embodiment can provide a computer-readable storage medium for implementation. This computer-readable storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the text editing methods in the above embodiments. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as electronic circuits, semiconductor memory devices, ROM, random access memory, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, and hard disks.

[0096] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0097] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0098] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0099] The aspects of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0100] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A text editing method characterized by, The method comprises the following steps: In the contenteditable editing mode of HTML, in response to a first instruction of adding a target element, the target element is added in an editing area, and target characters are inserted in positions adjacent to the target element, the target characters including spaces; In response to a second instruction of moving a cursor, it is determined whether an element at a next position in a moving direction of the cursor is the target element; When the element at the next position in the moving direction is the target element, the cursor is controlled to jump from the target character at a first side of the target element to the target character at a second side of the target element, the second side being away from the target element; The control of the cursor to jump from the target character at the first side of the target element to the target character at the second side of the target element includes: When the cursor is at the left side of the target element and the moving direction is rightward, the cursor is controlled to move three positions to the right; When the cursor is at the right side of the target element and the moving direction is leftward, the cursor is controlled to move three positions to the left.

2. The method of claim 1, wherein, After the target element is added in the editing area and the target characters are inserted in the positions adjacent to the target element, the method further comprises the following steps: An association relationship is established between the target element and the target characters at two sides of the target element.

3. The method of claim 2, wherein, The method further comprises the following steps: In response to a third instruction of deleting the target element, the target element and the target characters at the two sides of the target element are deleted.

4. The method of claim 3, wherein, The deletion of the target element and the target characters at the two sides of the target element includes: When the third instruction is to delete the target element at the left side of the cursor, in response to the third instruction, the target character at the right side of the target element is deleted, and the target element and the target character at the left side of the target element are simultaneously deleted based on the association relationship; and / or When the third instruction is to delete the target element at the right side of the cursor, in response to the third instruction, the target character at the left side of the target element is deleted, and the target element and the target character at the right side of the target element are simultaneously deleted based on the association relationship.

5. A text editing apparatus characterized by comprising: The method comprises the following steps: An adding module is configured to, in the contenteditable editing mode of HTML, add a target element in an editing area in response to a first instruction of adding the target element, and insert target characters in positions adjacent to the target element, the target characters including spaces; A moving module is configured to, in response to a second instruction of moving a cursor, determine whether an element at a next position in a moving direction of the cursor is the target element; and A jumping module is configured to, when the element at the next position in the moving direction is the target element, control the cursor to jump from the target character at a first side of the target element to the target character at a second side of the target element, the second side being away from the target element. When an element at a next position in the moving direction is the target element, controlling the cursor to jump from the target character on a first side of the target element to a side of the target character away from the target element, and to a side of the target element away from the target character. The moving module is specifically configured to: when the cursor is on a left side of the target element and the moving direction is rightward movement, control the cursor to move three positions to the right; and when the cursor is on a right side of the target element and the moving direction is leftward movement, control the cursor to move three positions to the left.

6. An electronic device, comprising: The electronic device comprises a processor, a memory, and a computer program stored on the memory and executable on the processor, and the computer program, when executed by the processor, implements the steps of the text editing method according to any one of claims 1 to 4.

7. A computer readable storage medium characterized in that, The computer program is stored on the computer readable storage medium, and when executed by the processor, implements the steps of the text editing method according to any one of claims 1 to 4.