CN112925515B - Editing control method, device, equipment and storage medium - Google Patents

Editing control method, device, equipment and storage medium Download PDF

Info

Publication number
CN112925515B
CN112925515B CN202110265945.6A CN202110265945A CN112925515B CN 112925515 B CN112925515 B CN 112925515B CN 202110265945 A CN202110265945 A CN 202110265945A CN 112925515 B CN112925515 B CN 112925515B
Authority
CN
China
Prior art keywords
code
control
edited
tag
instruction
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.)
Active
Application number
CN202110265945.6A
Other languages
Chinese (zh)
Other versions
CN112925515A (en
Inventor
李朕
刘子波
朱丽娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Yidu Huida Education Technology Co ltd
Original Assignee
Beijing Yidu Huida Education Technology Co ltd
Filing date
Publication date
Application filed by Beijing Yidu Huida Education Technology Co ltd filed Critical Beijing Yidu Huida Education Technology Co ltd
Priority to CN202110265945.6A priority Critical patent/CN112925515B/en
Publication of CN112925515A publication Critical patent/CN112925515A/en
Application granted granted Critical
Publication of CN112925515B publication Critical patent/CN112925515B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The application provides an editing control method, an editing control device, electronic equipment and a storage medium. The specific implementation scheme is as follows: scanning the code to be edited to obtain a control tag in the code to be edited; determining a control range of a mark content area in the code to be edited according to the control label; and executing a control function corresponding to the control label aiming at the code to be edited in the control range. The embodiment of the application can control the functions of displaying or editing the code to be edited within a specified range, so that a user can arrange the control tag in the code to be edited according to actual needs, and the editing mode of the code to be edited can be conveniently limited through the control tag, thereby achieving the preset control purpose.

Description

Editing control method, device, equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence technologies, and in particular, to an editing control method, apparatus, device, and storage medium.
Background
With the development of computer technology, programming is increasingly recognized as a requisite basic skill. Part of provinces and cities in China already take programming courses as necessary courses for primary and secondary schools. The existing online programming teaching system can solve the requirement of online compiling of running codes. However, the existing code editor cannot flexibly and conveniently control code editing.
For example, during a professor programming process, some professor code provides for a fixed method or logic. Teachers require students to write code according to the provided methods or logic structures. The teacher needs to control the key codes when arranging programming operation. For example, it is necessary to control that key codes are not deleted or modified and to allow students to edit part of the codes. However, the existing editing control method of the code editor only allows all read-only or all modification. The editing control mode enables teachers to arrange programming operation according to actual demands of teaching, and great inconvenience is brought to programming teaching.
Disclosure of Invention
The embodiment of the application provides an editing control method, an editing control device, electronic equipment and a storage medium, which are used for solving the problems of the related technology, and the technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an editing control method, including:
scanning the code to be edited to obtain a control tag in the code to be edited;
Determining a control range of a mark content area in the code to be edited according to the control label;
and executing a control function corresponding to the control label aiming at the code to be edited in the control range.
In one embodiment, the control tags include edit tags; executing a control function corresponding to the control tag for the code to be edited within the control range, including:
Under the condition that the control label is an editing label, acquiring the position coordinates of the current cursor and a coordinate area of a control range;
Under the condition that the position coordinates of the current cursor are within the coordinate area of the control range, disabling the editing function of the code to be edited;
And enabling the editing function of the code to be edited under the condition that the position coordinates of the current cursor are out of the coordinate area of the control range.
In one embodiment, the control tag comprises a hidden tag; executing a control function corresponding to the control tag for the code to be edited within the control range, including:
And under the condition that the control label is a hidden label, hiding the code to be edited in the control range in the current editing interface.
In one embodiment, scanning a code to be edited to obtain a control tag in the code to be edited includes:
and matching the code to be edited by using the regular expression to obtain a control tag in the code to be edited.
In one embodiment, determining a control range of a mark content area in a code to be edited according to a control tag includes:
acquiring position information of mark content of a control tag in a code to be edited;
and obtaining the control range of the code to be edited according to the position information.
In one embodiment, the method further comprises:
before scanning the code to be edited, acquiring function configuration parameters;
and executing the step of scanning the code to be edited under the condition that the function configuration parameters meet the preset conditions.
In one embodiment, the method further comprises:
And responding to the code calling instruction, and processing the code to be edited to obtain a return code corresponding to the code calling instruction.
In one embodiment, the code fetch instructions include store code instructions; the method comprises the following steps:
And under the condition that the code calling instruction is a stored code instruction, splicing the code to be edited in the control range and the code to be edited outside the control range to obtain a return code corresponding to the stored code instruction.
In one embodiment, the code fetch instructions include executing code instructions; the method further comprises the following steps:
and under the condition that the code calling instruction is an executing code instruction, replacing the control tag in the spliced code by using the regular expression to obtain a return code corresponding to the executing code instruction.
In one embodiment, the code fetch instructions include a expose code instruction; the method comprises the following steps:
and under the condition that the code calling instruction is a display code instruction, obtaining a return code corresponding to the display code instruction according to the function configuration parameters.
In a second aspect, an embodiment of the present application provides an editing control apparatus, including:
The scanning unit is used for scanning the code to be edited to obtain a control label in the code to be edited;
A determining unit for determining a control range of the mark content area in the code to be edited according to the control tag;
And the execution unit is used for executing the control function corresponding to the control label aiming at the code to be edited in the control range.
In one embodiment, the control tags include edit tags; the execution unit is used for:
Under the condition that the control label is an editing label, acquiring the position coordinates of the current cursor and a coordinate area of a control range;
Under the condition that the position coordinates of the current cursor are within the coordinate area of the control range, disabling the editing function of the code to be edited;
And enabling the editing function of the code to be edited under the condition that the position coordinates of the current cursor are out of the coordinate area of the control range.
In one embodiment, the control tag comprises a hidden tag; the execution unit is used for:
And under the condition that the control label is a hidden label, hiding the code to be edited in the control range in the current editing interface.
In one embodiment, the scanning unit is configured to:
and matching the code to be edited by using the regular expression to obtain a control tag in the code to be edited.
In one embodiment, the determining unit is configured to:
acquiring position information of mark content of a control tag in a code to be edited;
and obtaining the control range of the code to be edited according to the position information.
In one embodiment, the apparatus further comprises a control unit, wherein the control unit is configured to:
before scanning the code to be edited, acquiring function configuration parameters;
and executing the step of scanning the code to be edited under the condition that the function configuration parameters meet the preset conditions.
In one embodiment, the apparatus further includes a processing unit, where the processing unit is configured to:
And responding to the code calling instruction, and processing the code to be edited to obtain a return code corresponding to the code calling instruction.
In one embodiment, the code fetch instructions include store code instructions; the processing unit is used for:
And under the condition that the code calling instruction is a stored code instruction, splicing the code to be edited in the control range and the code to be edited outside the control range to obtain a return code corresponding to the stored code instruction.
In one embodiment, the code fetch instructions include executing code instructions; the processing unit is further configured to:
and under the condition that the code calling instruction is an executing code instruction, replacing the control tag in the spliced code by using the regular expression to obtain a return code corresponding to the executing code instruction.
In one embodiment, the code fetch instructions include a expose code instruction; the processing unit is used for:
and under the condition that the code calling instruction is a display code instruction, obtaining a return code corresponding to the display code instruction according to the function configuration parameters.
In a third aspect, an embodiment of the present application provides an electronic device, including: memory and a processor. Wherein the memory and the processor are in communication with each other via an internal connection, the memory is configured to store instructions, the processor is configured to execute the instructions stored by the memory, and when the processor executes the instructions stored by the memory, the processor is configured to perform the method of any one of the embodiments of the above aspects.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program, the method of any one of the above embodiments being performed when the computer program is run on a computer.
The advantages or beneficial effects in the technical scheme at least comprise: the method can control the functions of displaying or editing the code to be edited within a specified range, so that a user can arrange a control tag in the code to be edited according to actual needs, and the editing mode of the code to be edited can be conveniently limited through the control tag, thereby achieving the preset control purpose.
The foregoing summary is for the purpose of the specification only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments, and features described above, further aspects, embodiments, and features of the present application will become apparent by reference to the drawings and the following detailed description.
Drawings
In the drawings, the same reference numerals refer to the same or similar parts or elements throughout the several views unless otherwise specified. The figures are not necessarily drawn to scale. It is appreciated that these drawings depict only some embodiments according to the disclosure and are not therefore to be considered limiting of its scope.
FIG. 1 is a flow chart of an edit control method according to an embodiment of the present application;
FIG. 2 is a flow chart of a partial read-only control of an edit control method according to another embodiment of the present application;
FIG. 3 is a flow chart of determining a control range of an edit control method according to another embodiment of the present application;
FIG. 4 is a flow chart of a function switch of an edit control method according to another embodiment of the present application;
FIG. 5 is a schematic diagram of an editing control device according to an embodiment of the present application;
FIG. 6 is a schematic diagram of an editing control apparatus according to another embodiment of the present application;
Fig. 7 is a block diagram of an electronic device used to implement an embodiment of the application.
Detailed Description
Hereinafter, only certain exemplary embodiments are briefly described. As will be recognized by those of skill in the pertinent art, the described embodiments may be modified in various different ways without departing from the spirit or scope of the present application. Accordingly, the drawings and description are to be regarded as illustrative in nature and not as restrictive.
Fig. 1 is a flowchart of an edit control method according to an embodiment of the present application. As shown in fig. 1, the editing control method may include:
Step S110, scanning the code to be edited to obtain a control label in the code to be edited;
step S120, determining a control range of a mark content area in the code to be edited according to the control label;
Step S130, aiming at the code to be edited in the control range, executing the control function corresponding to the control label.
In an application scenario for editing codes, a user needs to flexibly and conveniently control the code editing by using a code editor. For example, during programming instruction, some program code may need to lock a particular method or structure. The teacher needs to control the code so that students cannot edit or delete the code. Read-only control may be required at multiple locations in the code to be edited that the teacher sends to the students. And, the read-only position in the code to be edited needs to be configurable, so as to facilitate the teacher to perform the configuration of partial code read-only. The student is required to view the code running results after developing the finished code. And in the programming teaching process, the relevance of some teaching plan codes and the teaching contents of the lessons is not great, and a teacher needs to carry out hiding control on the part of codes, so that the part of codes are invisible to students, and the students concentrate on learning the part of codes related to the teaching contents of the lessons.
Taking read-only control as an example, when a teacher makes teaching plan codes before programming teaching, all codes can be allowed to be edited, and start and stop positions of a read-only control range can be configured on a code part needing read-only. The start-stop position of the read-only control range can be any position in the customized code to be edited. In the teaching process, students cannot modify and delete codes within the read-only control range, and only codes outside the read-only control range can be modified and deleted. And, allowing students to run codes and checking the code running results. After the teaching process is finished, the teacher checks and modifies the homework of the students, the codes need to show the complete codes completed in the teaching process of the students, and non-read-only places can be modified.
In one example, a user may mark a read-only portion of code to be edited with a control tag of a particular extended markup language. The read-only portion of the code to be edited may be marked, for example, with the tag < xiaohou-lock > </xiaohou-lock >. < xiaohou-lock > is used to mark the start position of the read-only control range; and < xiaohou-lock > is used to mark the end position of the read-only control range. The code to be edited in the middle of < xiaohou-lock > and </xiaohou-lock > is read-only code which does not allow editing. The above-described tag < xiaohou-lock > </xiaohou-lock > is referred to as a first edit tag.
In yet another example, a user may mark an editable portion of code to be edited using a control tab of a particular extended markup language. The editable portion of the code to be edited may be marked, for example, with the label < xiaohou-blank > </xiaohou-blank >. < xiaohou-blank > for marking the start position of the editable portion; and < xiaohou-blank > is used to mark the termination position of the editable portion. The code to be edited in the middle of < xiaohou-blank > and </xiaohou-blank > is a code which allows editing. The other code in the code to be edited, except for the editable portion, is a read-only code. The above-described label < xiaohou-blank > </xiaohou-blank > is referred to as a second edit label.
Taking the hidden control as an example, the user can mark the hidden portion of the code to be edited with a control tag of a specific extended markup language. The hidden portion of the code to be edited may be marked, for example, with the tag < xiaohou-hide > </xiaohou-hide >. < xiaohou-hide > for marking the start position of the hidden control range; the < xiaohou-hide > is used to mark the end position of the hidden control range. The code to be edited in the middle of < xiaohou-hide > and </xiaohou-hide > is a hidden code. In the case where the control tag is active, the hidden code is not displayed in the editing interface of the editor. The above tag < xiaohou-hide > </xiaohou-hide > is referred to as a hidden tag.
In order to solve the problem of controlling part of codes in a code editor in the programming teaching process, the embodiment of the application expands the functions of the editor and encapsulates the editor. Scanning and primary compiling functions are added to the packaging layer, so that the packaged editor supports a specific extensible markup language.
Taking the application scenario of programming teaching as an example, a teacher can control the editing or displaying of the code to be edited by using one of the first editing tag, the second editing tag and the hidden tag. The students edit the code to be edited, which is arranged by the teacher, on the editor.
In step S110, the editor scans the code to be edited to obtain a control tag in the code to be edited. The control tags may include a first edit tag, a second edit tag, or a hidden tag. The three types of labels may be used in one of the following ways: the first edit tag is used in combination with the hidden tag; the second edit tag is used in combination with the hidden tag; the first editing tag is used alone; the second editing tag is used alone; the hidden tag is used alone.
In one example, in a code to be edited issued by a teacher to a student, for a read-only portion thereof, the teacher may be marked with a first edit tag; while for the hidden portion therein, the teacher may make use of the hidden tag for marking. The first editing tag and the hidden tag are combined for use, and the control tag can be flexibly and conveniently arranged in the code to be edited according to actual needs, so that the preset control purpose is achieved.
In step S120, a control range of the mark content area in the code to be edited may be determined according to the scanned control tag. For example, the code to be edited in the middle of < xiaohou-lock > and </xiaohou-lock > is a read-only code that does not allow editing.
In step S130, the code to be edited within the control range is controlled, and the control function corresponding to the control tag is executed.
For example, if the control tag scanned in step S110 is a first editing tag, the editing function is masked for the code to be edited intermediate between < xiaohou-lock > and </xiaohou-lock >.
For another example, if the control tag scanned in step S110 is a second editing tag, the editing function is turned on for the code to be edited intermediate between < xiaohou-blank > and </xiaohou-blank >, and the editing function is masked for other codes in the code to be edited. In other words, the editing function is masked for a piece of code with a start position of xiaohou-blank and an end position of < xiaohou-blank, i.e., a code to be edited intermediate between xiaohou-blank and < xiaohou-blank.
For another example, if the control tag scanned in step S110 is a hidden tag, the code to be edited in the middle of < xiaohou-hide > and </xiaohou-hide > is not displayed in the editing interface of the editor.
The embodiment of the application can control the functions of displaying or editing the code to be edited within a specified range, so that a user can arrange the control tag in the code to be edited according to actual needs, and the editing mode of the code to be edited can be conveniently limited through the control tag, thereby achieving the preset control purpose.
Fig. 2 is a flow chart of a partial read-only control of an edit control method according to another embodiment of the present application. As shown in fig. 2, in one embodiment, the control tags include edit tags; in step S130 in fig. 1, for the code to be edited within the control range, the control function corresponding to the control tag is executed, which may specifically include:
step S210, under the condition that the control label is an editing label, acquiring the position coordinates of the current cursor and the coordinate area of the control range;
step S220, disabling the editing function of the code to be edited under the condition that the position coordinates of the current cursor are within the coordinate area of the control range;
step S230, enabling the editing function of the code to be edited in the case that the position coordinates of the current cursor are outside the coordinate area of the control range.
In the embodiment of the application, in order to realize the control of the editing function of the code to be edited within the specified range under the condition that the control label is an editing label, an editor monitoring cursor event can be added to acquire the position coordinates of the current cursor. According to the control range determined in step S120, it is checked whether the position coordinates of the current cursor are within the coordinate area of the control range. If it is determined to be within the coordinate region of the control range, the global editing is disabled. If it is determined that the coordinate area is outside the control range, global editing is enabled.
For example, if the control tag scanned in step S110 is the first editing tag, the control range is the code to be edited in the middle of < xiaohou-lock > and </xiaohou-lock >. If the current cursor position is intermediate < xiaohou-lock > and </xiaohou-lock >, then the global editing is disabled. That is, for a section of code to be edited having < xiaohou-lock > as a start position and </xiaohou-lock > as an end position, the editing function is disabled, and for other code in the code to be edited, the editing function is allowed to be used.
For another example, if the control tag scanned in the step S110 is the second editing tag, the control range is a code to be edited intermediate between </xiaohou-blank > and < xiaohou-blank >. If the current cursor position is intermediate to the positions of xiaohou-blank and xiaohou-blank, then the global editing is disabled. That is, for a section of code in the code to be edited that uses xiaohou-blank as a starting position or < xiaohou-blank as a ending position, the editing function is disabled, and for other code in the code to be edited, the editing function is allowed to be used.
The embodiment of the application can control the code to be edited to edit in a partial read-only mode. The editing control mode enables teachers to arrange programming operation according to actual demands of teaching, and great convenience is brought to programming teaching.
In addition, after the teaching process is finished, the teacher checks and alters the homework of the students, the codes need to show the complete codes completed in the teaching process of the students, and non-read-only places can be altered. In this case, the teacher may also be restricted to making corrections only at non-read-only places by controlling the tab.
In one embodiment, the control tag comprises a hidden tag; executing a control function corresponding to the control tag for the code to be edited within the control range, including:
And under the condition that the control label is the hidden label, hiding the code to be edited in the control range in the current editing interface.
If the control tag scanned in step S110 is a hidden tag, the control range is a code to be edited in the middle of < xiaohou-hide > and </xiaohou-hide >. The code to be edited in the middle of < xiaohou-hide > and </xiaohou-hide > is not displayed in the current editing interface of the editor.
The embodiment of the application can control the code to be edited to be displayed in the current editing interface of the editor in a partial display mode. The display control mode enables teachers to enable the code to be edited to be visible according to actual demands of teaching, is beneficial to highlighting teaching key points, and brings great convenience to programming teaching.
In one embodiment, step S110 in fig. 1, scanning the code to be edited to obtain a control tag in the code to be edited may specifically include:
and matching the code to be edited by using the regular expression to obtain a control tag in the code to be edited.
A regular expression is a logical formula that operates on a string. When using regular expressions, a "regular string" may be formed from a predefined number of specific characters, as well as combinations of these specific characters. This "regular string" is used to express a filtering logic for the string. Regular expressions are typically used to retrieve, replace text that meets a certain pattern or rule.
The regular expression may act as a text pattern that describes one or more strings to be matched when scanning text. Given a regular expression and another string, the following operations may be performed:
1. it is determined whether a given string conforms to the filtering logic of the regular expression. The above-determined procedure may be referred to as "matching".
2. The desired specific portion may be obtained from the character string by a regular expression.
In one example, a regular expression describes a pattern of string matches that can be used to check if a string contains some seed string. Specific examples are as follows:
Matching example 1: runoob, runooob, runoooooob, etc. can be matched using the regular expression "runoo +b". Where the character "+" represents that the preceding character must appear at least once. As another example, the regular expression "ab+" describes a feature that is "a" and any number of "b", and ab, abb, and abbbbbbbbbb all conform to this feature.
Matching example 2: using the regular expression "runoo x b", runob, runoooooob, etc. can be matched. Where the character "×" represents that the preceding character may not appear, or may appear one or more times. For example, the preceding character may appear 0 times, 1 time, or more times.
Matching example 3: color or color may be matched using the regular expression "color". Wherein the character "? "represents that the preceding character can appear only once at most. That is, the preceding character may appear 0 times or 1 time.
Referring to the above example, a regular expression is a text pattern that may be composed of common characters as well as special characters. Special characters are also called "meta-characters". For example, the characters "+", "×" and "? "all belong to" meta-characters ". Common characters may include all printable and unprintable characters, such as characters a through z, that are not explicitly specified as meta-characters. Common characters may include all capital and lowercase letters, all numbers, all punctuation marks, or some other symbol. Common characters in regular expressions, when matching a string, can be used to represent matching the same one. In the regular expression, the mode description is carried out through the combination of special characters and common characters, so that the aim of text matching is fulfilled. In addition, in the matching process, the matching position can be obtained by using a regular expression under the condition of successful matching. Examples are as follows:
matching example 4: the regular expression is "c", and when the character string "abcde" is matched, the matching result is: success; the matched content is: "c"; the matched positions are: beginning at 2 and ending at 3. Where the subscript used to indicate the matching location starts from 0 or 1, may vary from one current programming language to another. In the above example, the subscript for indicating the matching position is started from 0, and the character "c" is the 2 nd character in the character string "abcde".
Matching example 5: the regular expression "bcd", when matching the string "abcde", the matching result is: success; the matched content is: "bcd"; the matched positions are: beginning at1 and ending at 4. In the above example, the subscript for indicating the matching position also starts from 0. The 0 th character in the character string "abcde" is "a". The character "bcd" starts from the 1 st character in the character string "abcde".
In another example, there are some representations in regular expressions that can match any of a variety of characters. For example, the expression "\d" may match any number. Although any of a plurality of characters can be matched, only one character can be matched, and a plurality of characters cannot be matched.
Matching example 6: the regular expression "\d\d", when matching the string "abc123", the result of the matching is: success; the matched content is: "12"; the matched positions are: beginning at 3 and ending at 5.
Matching example 7: the regular expression "a\d", when matching the string "aaa100", the result of the matching is: success; the matched content is: "a1"; the matched positions are: beginning at 2 and ending at 4.
In yet another example, brackets [ ] may be used in regular expressions to contain a series of characters, any of which can be matched. A [ ] can be used to contain a series of characters, then any one of the characters other than the one can be matched. Similarly, although any one of the characters can be matched, only one character can be matched, and a plurality of characters cannot be matched. For example, the regular expression "[ ab5@ ]" may be used to match "a", "b", "5" or "@"; the regular expression "[ ] abc ]" can be used to match any one character other than "a", "b" and "c"; the regular expression "[ f-k ]" can be used for matching any one character between "f" and "k"; the regular expression "[ ] A-F0-3]" can be used to match any character outside "A" through "F" and "0" through "3".
Matching example 8: the regular expression "[ bcd ] [ bcd ]", when matching the string "abc123", the result of the matching is: success; the matched content is: "bc"; the matched positions are: beginning at 1 and ending at 3.
In yet another example, some symbols in a regular expression may affect relationships between sub-expressions within the expression. For example, the role of the character "|" in a regular expression is to represent the or relationship between the expressions on its left and right sides. That is to say an expression to the left of the matching character "|" or an expression to the right of the matching character "|".
Matching example 9: when the regular expression "tom|jack" matches the character string "I'm Tom, he is Jack", the matching result is: success; when matching the expression to the left of the character "|", the matched content is: "Tom"; the matched positions are: beginning at 4 and ending at 7. When matching the expression to the right of the character "|", the matching result is: success; the matched content is: "Jack"; matching to the position: beginning at 15 and ending at 19. In the matching character string "I'm Tom, he is Jack" of the above example, comma "," followed by a space "so that the position to which the matching content" Jack "is correspondingly matched starts at 15.
In the embodiment of the present application, if the control tag scanned in step S110 is the first editing tag, the editor scans whether the code to be edited includes a tag < xiaohou-lock > </xiaohou-lock > of a specific extended markup language, and can match the code to be edited using the following regular expression:
/<xiaohou-lock>([^]*?)<\/xiaohou-lock>/igm
where "i" in "igm" represents case-less, "g" in "igm" represents globally intra-range matching, and "m" in "igm" represents cross-row matching.
And obtaining the control label in the code to be edited and the code content contained in the middle of the control label through matching. In one example, the matched code content may be stored in a preset read-only content value array preserveds by a preset read-only content value array preserveds.
Fig. 3 is a flowchart of determining a control range of an edit control method according to another embodiment of the present application. As shown in fig. 3, in an embodiment, step S120 in fig. 1, determining, according to the control tag, a control range of the mark content area in the code to be edited may specifically include:
step S310, obtaining the position information of the mark content of the control tag in the code to be edited;
step S320, obtaining the control range of the code to be edited according to the position information.
In step S310, according to the control tag scanned in step S110, position information of the mark content of the control tag in the code to be edited may be determined. The range of rows and columns of mark content in the editor may be looked up, for example, from the read-only content value array preserveds. In step S320, a control range including an anchor point may be generated according to the location information of the tag content. Wherein the start-stop positions of the control range in the editor may be marked with anchor points. In editing a code using an editor, for example, adding characters or deleting characters, the absolute position of an anchor point may change as the content of the edit changes, but the relative position of the anchor point always corresponds to the starting position of the control tag. In one example, the pre-set read-only start-stop range array preservedAnchors may store the generated control range including the anchor point into the pre-set read-only start-stop range array preservedAnchors.
Fig. 4 is a flowchart of function switching of an edit control method according to another embodiment of the present application. As shown in fig. 4, in one embodiment, the method further includes:
step S410, before scanning the code to be edited, obtaining function configuration parameters;
Step S420, executing the step of scanning the code to be edited under the condition that the function configuration parameters meet the preset conditions.
In such an embodiment, the initial value of the function configuration parameter markup may be preconfigured to control whether identification of a particular extensible markup language is enabled. For example, if a teacher needs to make partial read-only control in a code to be edited issued to a student, setting an initial value of a function configuration parameter mark to true; if the teacher does not need to do partial read-only control, the initial value of the function configuration parameter mark is set to false. When the packaged editor is called to be mounted in a page, an initial value of mark is first checked in an initialization method of the editor to detect whether a function of identifying a specific extended markup language is enabled. If mark is the value false, the specific extension mark language is not started to be identified, the control label is not active, and the code editing mode in the editor is not limited. If the value of mark up is true, then the specific extension markup language is started to be identified, and the editing mode of the code to be edited can be limited through the control label. For example, in step S420, if the value of mark up is true, the function configuration parameter satisfies a preset condition. In this case, the step of scanning the code to be edited is performed, the identification of the specific extensible markup language is enabled, and the editing mode of the code to be edited is limited by the control tag.
In the related art, the conventional processing may be to set a read-only area in a document in advance and store position information of the read-only area in the document. And searching the stored position information for read-only control when editing control is performed. In contrast, on the one hand, the control tag for marking the read-only part of the code in the embodiment of the application is directly written in the code, and the position information of the read-only area is not required to be additionally stored, so that the storage organization mode of the code file is simple and feasible. On the other hand, in the embodiment of the application, the initial value of the parameter mark is pre-configured, and whether the specific extension mark language is started or not is controlled, so that the function switching mode is simple and easy to implement. Compared with the related art, if the partial read-only limitation is not made, the set read-only area must be removed again, and the mode of function switching is relatively complicated.
In one embodiment, the method further comprises:
And responding to the code calling instruction, and processing the code to be edited to obtain a return code corresponding to the code calling instruction.
The embodiment of the application encapsulates a layer of calling method based on the editor, and enables the encapsulated editor to support a specific extensible markup language. The packaged editor may return three types of editor values: 1) Code presented in the current editor; 2) Full code containing a specific extensible markup language; 3) Executable code that does not contain a specific extensible markup language.
The editor may respond to different external calls to the corresponding code call request. And responding to the code calling instruction, and processing the code to be edited to obtain a return code corresponding to the code calling instruction. In one example, when code needs to be stored, an external call needs to obtain the full amount of code that contains a particular extended markup language. In which case the editor receives the store code instruction from the external call. In another example, when code needs to be executed, an external call needs to obtain executable code that does not contain a particular extensible markup language. In which case the editor receives an instruction to execute code from an external call. In yet another example, when the front-end presentation related information needs to be obtained, an external call needs to obtain the code currently presented in the editor. In which case the editor receives the show code instruction from the external call.
In one embodiment, the code fetch instructions include store code instructions; the method comprises the following steps:
And under the condition that the code calling instruction is a stored code instruction, splicing the code to be edited in the control range and the code to be edited outside the control range to obtain a return code corresponding to the stored code instruction.
When code needs to be stored, external calls need to obtain the full quantity of code that contains the particular extensible markup language. Besides the need of acquiring the total code containing the specific extension markup language by external calling when the code is stored, after the teaching process is finished, a teacher checks and corrects the homework of the student, and the complete code finished by the student in the teaching process can be displayed. In this case also, it is necessary to acquire the full amount of code containing a specific extensible markup language.
When the external call needs to acquire the full-quantity code containing the specific extension markup language, the code content in the control range and the code content outside the control range can be acquired respectively according to the read-only start-stop range array preservedAnchors, and then the part which is subjected to read-only control in the code to be edited and the part which is not subjected to read-only control are inserted and spliced, so that the full-quantity code corresponding to the code to be edited can be obtained.
Taking programming teaching as an example, when an external call needs to acquire the full-quantity code containing a specific extensible markup language, whether a student edits the code to be edited in an editor can be detected. If the student does not perform editing operation, the steps of inserting and assembling are not needed to be executed, and the full-quantity codes which correspond to the codes to be edited and contain the specific extensible markup language are directly used as return codes. If the student performs editing operation on the code to be edited, executing the steps of inserting and splicing, and taking the full-quantity code corresponding to the code to be edited obtained by inserting and splicing as the return code of the code calling instruction.
In one embodiment, the code fetch instructions include executing code instructions; the method further comprises the following steps:
and under the condition that the code calling instruction is an executing code instruction, replacing the control tag in the spliced state by using the regular expression to obtain a return code corresponding to the executing code instruction.
In the example of programming instruction, student development of completed code requires review of code running results. The external call then requires the retrieval of executable code that does not contain a particular extensible markup language. The editor receives the execution code instructions from the external call. In response to the code executing instruction, the step of interleaving and splicing can be firstly executed to obtain the full-quantity code corresponding to the code to be edited. And then utilize the regular expression//? xiaohou-/w/ig replaces the successfully matched part with null, that is, replaces the control tag, that is, obtains the executable code which does not contain the specific extensible markup language, that is, the executable code corresponding to the code to be edited. The executable code may be referred to as return code corresponding to the execution code instructions.
In one embodiment, the code fetch instructions include a expose code instruction; the method comprises the following steps:
and under the condition that the code calling instruction is a display code instruction, obtaining a return code corresponding to the display code instruction according to the function configuration parameters.
When an external call needs to acquire code currently exposed in the editor, the editor receives an instruction to expose the code from the external call. In response to the display code instruction, the editor can acquire the display code of the current editing interface according to the value of the function configuration parameter mark. First the value of the function configuration parameter markup is checked. If the value of mark is false, the presentation code of the current editing interface that does not contain the control tag is returned. If the value of mark up is true, the present editing interface presentation code containing the control tag is returned. The above-described presentation code may be used as a return code corresponding to the presentation code instruction.
In the embodiment of the application, codes comprising different information can be acquired according to different external requirements, for example, under various different scenes such as storage, editing and debugging of code files. For example, the full amount of code is obtained at storage time and the executable code is obtained at debugging time. The mode enables the storage, editing and debugging of the code file to be more flexible and convenient, and can meet the code retrieval requirements in different scenes.
In the application scenario of programming teaching, an ace editor is generally adopted to edit a code to be edited. ace is an open-source, independent, browser-based code editor that can be embedded in any web page or JavaScript application. An exemplary partial read-only control of the code to be edited using the first edit tag < xiaohou-lock > </xiaohou-lock > is as follows:
First, encapsulating an ace instantiation method into a layer of calling method. In the calling method, the initial value of the function configuration parameter markup can be configured. The function configuration parameter markup is used for controlling whether the ace editor enables the identification of a specific extension markup language. In addition, a read-only content value array preserveds and a read-only start-stop range array preservedAnchors may also be defined. The encapsulated editor may return three types of editor values: 1) Code editorValue presented in the current editor; 2) A full code currValue containing a specific extensible markup language; 3) Executable code execValue that does not contain a specific extensible markup language.
Second, when the packaged editor component is mounted to the page, the initialization method first detects whether identification of a particular extensible markup language is enabled. If the value of mark up is false, then the function of identifying a particular extended markup language is not enabled. If the value of mark up is true, then the function of identifying a particular extensible markup language is enabled.
Third, when the value of mark up is true, the editor scans whether the global code of the code to be edited contains a specific extended markup language < xiaohou-lock > </xiaohou-lock >. The code to be edited can be matched by using a regular expression, and the code matched between the < xiaohou-lock > and the </xiaohou-lock > is stored in a preset read-only content value array preserveds.
Fourth, the full-scale code containing the specific extensible markup language is set as the editor value. In this step, the code to be edited is input into the editor.
Fifthly, searching a row range of the first editing tag in the editor according to the content value array preserveds of the read-only part, calling a function editor.
Sixth step, use regular expression/</? xiaohou-lock >/igm replaces the specific extensible markup language within each element within preserveds, i.e., the first edit tag is removed in the content value array preserveds. The student does not display the first edit tab while editing the code with the ace editor, and therefore the first edit tab is removed in this step.
And seventhly, calling new Range (), and creating a read-only Range object which does not contain the specific extensible markup language according to the Range of the Range obtained in the fifth step. Wherein the first edit tag is not included in the read-only column range that does not include the specific extensible markup language. And calling a function editor.getSession (). Doc.createAnchor () according to the read-only range which does not contain the specific extension markup language, and generating a control range with an anchor point. And storing the generated control range with the anchor point into a preset read-only start-stop range array preservedAnchors. And taking the read-only start-stop range as a control range of the code to be edited.
Eighth, the add editor listens for cursor events. Triggering an event when the cursor position changes, and calling a callback function. And encapsulating the callback function by setTimeout, so that the callback function is added into an execution queue as a task. Where setTimeout () can accept two parameters, the first is a callback function and the second is the number of milliseconds to defer execution. setTimeout () means that an event is added at the tail of the task queue, and the callback function is executed after the existing event of the synchronous task and the task queue is processed. For example, the callback function is executed after the enter key operation is detected. The specific function of the callback function is to check whether the current cursor position is within the read-only start-stop range. If the current cursor position is judged to be within the read-only start-stop range, calling an editor.setread only (true), and disabling global editing; if the current cursor position is determined to be outside the read-only start-stop range, an editor.
And ninth, when the external call is made, the full-quantity code containing the specific extension markup language needs to be acquired, and the code content in the read-only start-stop range and the code content outside the read-only start-stop range need to be inserted and spliced. Code content within the read-only start-stop range can be obtained by calling editor.getsession (). Doc.gettextrange (). Code content within a read-only start-stop range can be obtained in a loop body of the loop structure. Determining the execution times of the loop body according to the following conditions: (1) read-only start-stop range array preservedAnchors; (2) Whether the start point of the first range of the read-only start-stop range array is the start point of the whole document; (3) Whether the last dead point of the read-only start-stop range array is the dead point of the entire document. And after the loop execution is completed, obtaining the full code containing the specific extensible markup language.
Tenth, when an external call is made, executable code that does not contain a specific extensible markup language needs to be acquired, full-quantity code that contains a specific extensible markup language needs to be acquired according to the ninth step, and then regular expressions/? xiaohou- \w/ig replaces the successfully matched part with null, i.e. the executable code which does not contain the specific extensible markup language is obtained.
Eleventh, when the external call is performed, the code displayed in the current editing frame needs to be obtained, and the function editor.getvalue () is directly called, so that the code displayed in the current editing frame can be obtained. And determining whether the display code of the current editing interface contains a control label according to the value of the function configuration parameter mark. If mark is the value false, the display code of the current editing interface does not contain a control label. If the value of mark up is true, the display code of the current editing interface contains a control label.
An exemplary partial read-only control of the code to be edited using the second edit tag < xiaohou-blank > </xiaohou-blank > is as follows:
First, encapsulating an ace instantiation method into a layer of calling method. In the calling method, the initial value of the function configuration parameter markup can be configured. The function configuration parameter markup is used for controlling whether the ace editor enables the identification of a specific extension markup language. In addition, a blank place content value array blanks, a blank-to-blank content array blankGaps, and a blank start-stop range array blankAnchors may also be defined. The encapsulated editor may return three types of editor values: 1) Code editorValue presented in the current editor;
2) A full code currValue containing a specific extensible markup language; 3) Executable code execValue that does not contain a specific extensible markup language.
Second, when the packaged editor component hangs in the page, the initialization method first detects whether identification of a particular extensible markup language is enabled. If the value of mark up is false, then the function of identifying a particular extended markup language is not enabled. If the value of mark up is true, then the function of identifying a particular extensible markup language is enabled.
Third, when the value of mark up is true, the editor scans whether the global code of the code to be edited contains a specific extended markup language < xiaohou-blank > </xiaohou-blank >. The code to be edited may be matched using the regular expression/< xiaohou-blank > ([. The code content in the blank content value array blanks is editable.
Fourth, the regular expression/< xiaohou-blank > ([. Cut off into several parts before and after matching successfully position:
1) < xiaohou-blank > and contains < xiaohou-blank >;
2) Codes between < xiaohou-blank > and < xiaohou-blank > and include </xiaohou-blank > and < xiaohou-blank >;
3) Codes following < xiaohou-blank > and comprising </xiaohou-blank >.
And forming an array by the truncated codes, and storing the array in a preset blank and blank content array blankGaps. The code content in the content array blankGaps between the spaces is read-only.
Fifth, the full-scale code containing the specific extensible markup language is set as the editor value.
And sixthly, searching a range of the blank-to-blank content in the code to be edited in the editor according to the blank-to-blank content array blankGaps, and simultaneously obtaining the range of the blank-to-blank content in the code to be edited. The editor.getSession (). ADDMARKER (range, 'blank-high light') is called, and the highlight style is set for the blank.
Seventh step, use regular expression/</? xiaohou-blank >/igm replaces the specific extensible markup language within each element within blanks, i.e., the first edit tag is removed in the content value array preserveds.
And eighth, calling new Range (), and creating a blank row Range object which does not contain the specific extensible markup language according to the row Range of the blank contents obtained in the sixth step. Wherein, the second edit tag is not included in the blank line range which does not include the specific extended markup language. Calling an editor, getsession (). Doc, createanchor () according to the blank row and column range which does not contain the specific extension markup language, and generating a range with an anchor point. And storing the generated range with the anchor point into a blank start-stop range array blankAnchors which is preset. And determining a control range of the code to be edited according to the blank start-stop range.
And ninth, the adding editor monitors the cursor event. Triggering an event when the cursor position changes, and calling a callback function. And encapsulating the callback function by setTimeout, so that the callback function is added into an execution queue as a task. The callback function specifically functions to check whether the current cursor position is within the blank start-stop range. If it is determined to be within the blank start-stop range, an editor. Setread only (false) is called, and global editing is enabled. If it is determined to be outside the blank start-stop range, an editor. Setread only (true) is called, disabling global editing.
And tenth, when the external call is made, the full-quantity code containing the specific extensible markup language needs to be acquired, and the contents between the blanks and the contents at the blank position need to be inserted and spliced. The loop structure call editor. Getsession (). Doc. Gettextrange () can be used to acquire contents within the blank start-stop range. The number of loop executions is determined based on the length of the blank start-stop range array blankAnchors. And after the loop execution is finished, adding the last blank and the content between the blanks to obtain the full code containing the specific extended markup language.
Eleventh, when an external call is made, executable code that does not contain a specific extension markup language needs to be acquired, full-quantity code that contains a specific extension markup language needs to be acquired according to the tenth step, and then regular expressions/? xiaohou- \w/ig replaces the successfully matched part with null, i.e. the executable code which does not contain the specific extensible markup language is obtained.
And twelfth, when external calling is needed, the codes displayed in the current editing frame are required to be obtained, and the codes displayed in the current editing frame can be obtained by directly calling the editor. And determining whether the display code of the current editing interface contains a control label according to the value of the function configuration parameter mark.
Fig. 5 is a schematic structural diagram of an editing control device according to an embodiment of the present application. As shown in fig. 5, the apparatus may include:
A scanning unit 100, configured to scan a code to be edited to obtain a control tag in the code to be edited;
a determining unit 200 for determining a control range of the mark content area in the code to be edited according to the control tag;
The execution unit 300 is configured to execute a control function corresponding to the control tag with respect to the code to be edited within the control range.
In one embodiment, the control tags include edit tags; the execution unit 300 is configured to:
Under the condition that the control label is an editing label, acquiring the position coordinates of the current cursor and a coordinate area of a control range;
Under the condition that the position coordinates of the current cursor are within the coordinate area of the control range, disabling the editing function of the code to be edited;
And enabling the editing function of the code to be edited under the condition that the position coordinates of the current cursor are out of the coordinate area of the control range.
In one embodiment, the control tag comprises a hidden tag; the execution unit 300 is configured to:
And under the condition that the control label is the hidden label, hiding the code to be edited in the control range in the current editing interface.
In one embodiment, the scanning unit 100 is configured to:
and matching the code to be edited by using the regular expression to obtain a control tag in the code to be edited.
In one embodiment, the determining unit 200 is configured to:
acquiring position information of mark content of a control tag in a code to be edited;
and obtaining the control range of the code to be edited according to the position information.
Fig. 6 is a schematic structural diagram of an editing control apparatus according to another embodiment of the present application. As shown in fig. 6, in one embodiment, the apparatus further includes a control unit 105, where the control unit 105 is configured to:
before scanning the code to be edited, acquiring function configuration parameters;
and executing the step of scanning the code to be edited under the condition that the function configuration parameters meet the preset conditions.
In one embodiment, the apparatus further includes a processing unit 400, where the processing unit 400 is configured to:
And responding to the code calling instruction, and processing the code to be edited to obtain a return code corresponding to the code calling instruction.
In one embodiment, the code fetch instructions include store code instructions; the processing unit 400 is configured to:
And under the condition that the code calling instruction is a stored code instruction, splicing the code to be edited in the control range and the code to be edited outside the control range to obtain a return code corresponding to the stored code instruction.
In one embodiment, the code fetch instructions include executing code instructions; the processing unit 400 is further configured to:
and under the condition that the code calling instruction is an executing code instruction, replacing the control tag in the spliced code by using the regular expression to obtain a return code corresponding to the executing code instruction.
In one embodiment, the code fetch instructions include a expose code instruction; the processing unit 400 is configured to:
and under the condition that the code calling instruction is a display code instruction, obtaining a return code corresponding to the display code instruction according to the function configuration parameters.
The functions of each module and each unit in each device in the embodiments of the present application may be referred to the corresponding descriptions in the above methods, and are not repeated herein.
Fig. 7 is a block diagram of an electronic device used to implement an embodiment of the application. As shown in fig. 7, the electronic device includes: memory 910 and processor 920, memory 910 stores a computer program executable on processor 920. The processor 920 implements the editing control and image generation methods in the above-described embodiments when executing the computer program. The number of memories 910 and processors 920 may be one or more.
The electronic device further includes:
and the communication interface 930 is used for communicating with external equipment and carrying out data interaction transmission.
If the memory 910, the processor 920, and the communication interface 930 are implemented independently, the memory 910, the processor 920, and the communication interface 930 may be connected to each other and perform communication with each other through buses. The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in fig. 7, but not only one bus or one type of bus.
Alternatively, in a specific implementation, if the memory 910, the processor 920, and the communication interface 930 are integrated on a chip, the memory 910, the processor 920, and the communication interface 930 may communicate with each other through internal interfaces.
The embodiment of the application provides a computer readable storage medium storing a computer program which, when executed by a processor, implements the method provided in the embodiment of the application.
The embodiment of the application also provides a chip, which comprises a processor and is used for calling the instructions stored in the memory from the memory and running the instructions stored in the memory, so that the communication equipment provided with the chip executes the method provided by the embodiment of the application.
The embodiment of the application also provides a chip, which comprises: the input interface, the output interface, the processor and the memory are connected through an internal connection path, the processor is used for executing codes in the memory, and when the codes are executed, the processor is used for executing the method provided by the application embodiment.
It should be appreciated that the processor may be a central processing unit (Central Processing Unit, CPU), other general purpose processor, digital signal processor (DIGITAL SIGNAL processing, DSP), application Specific Integrated Circuit (ASIC), field programmable gate array (field programmable GATE ARRAY, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. A general purpose processor may be a microprocessor or any conventional processor or the like. It is noted that the processor may be a processor supporting an advanced reduced instruction set machine (ADVANCED RISC MACHINES, ARM) architecture.
Further, optionally, the memory may include a read-only memory and a random access memory, and may further include a nonvolatile random access memory. The memory may be volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The nonvolatile memory may include a read-only memory (ROM), a Programmable ROM (PROM), an erasable programmable ROM (erasable PROM), an electrically erasable programmable EPROM (EEPROM), or a flash memory, among others. Volatile memory can include random access memory (random access memory, RAM), which acts as external cache memory. By way of example, and not limitation, many forms of RAM are available. For example, static random access memory (STATIC RAM, SRAM), dynamic random access memory (dynamic random access memory, DRAM), synchronous Dynamic Random Access Memory (SDRAM), double data rate synchronous dynamic random access memory (double DATA DATE SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (ENHANCED SDRAM, ESDRAM), synchronous link dynamic random access memory (SYNCHLINK DRAM, SLDRAM), and direct memory bus random access memory (direct rambus RAM, DR RAM).
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions in accordance with the present application are fully or partially produced. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. Computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present application, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
Any process or method description in a flowchart or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process. And the scope of the preferred embodiments of the present application includes additional implementations in which functions may be performed in a substantially simultaneous manner or in an opposite order from that shown or discussed, including in accordance with the functions that are involved.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions.
It is to be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the methods of the embodiments described above may be performed by a program that, when executed, comprises one or a combination of the steps of the method embodiments, instructs the associated hardware to perform the method.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules described above, if implemented in the form of software functional modules and sold or used as a stand-alone product, may also be stored in a computer-readable storage medium. The storage medium may be a read-only memory, a magnetic or optical disk, or the like.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that various changes and substitutions are possible within the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (22)

1. An editing control method, comprising:
Scanning a code to be edited to obtain a control tag in the code to be edited;
Determining a control range of a mark content area in the code to be edited according to the control label;
executing a control function corresponding to the control tag aiming at the code to be edited in the control range;
The control tag comprises an editing tag and/or a hidden tag, the control function corresponding to the editing tag comprises editing function control, and the control function corresponding to the hidden tag comprises non-display function.
2. The method according to claim 1, wherein for the code to be edited within the control range, executing the control function corresponding to the control tag includes:
under the condition that the control label is the editing label, acquiring the position coordinates of the current cursor and the coordinate area of the control range;
disabling the editing function of the code to be edited under the condition that the position coordinates of the current cursor are within the coordinate area of the control range;
and enabling the editing function of the code to be edited under the condition that the position coordinates of the current cursor are out of the coordinate area of the control range.
3. The method according to claim 1, wherein for the code to be edited within the control range, executing the control function corresponding to the control tag includes:
And hiding the code to be edited in the control range in the current editing interface under the condition that the control label is the hidden label.
4. A method according to any one of claims 1 to 3, wherein scanning the code to be edited to obtain a control tag in the code to be edited comprises:
And matching the code to be edited by using a regular expression to obtain a control tag in the code to be edited.
5. The method of claim 4, wherein determining a control range of a mark content area in the code to be edited based on the control tag comprises:
acquiring position information of the mark content of the control tag in the code to be edited;
And obtaining the control range of the code to be edited according to the position information.
6. A method according to any one of claims 1 to 3, further comprising:
Before the code to be edited is scanned, acquiring function configuration parameters;
and executing the step of scanning the code to be edited under the condition that the function configuration parameters meet preset conditions.
7. The method of claim 6, wherein the method further comprises:
and responding to the code calling instruction, and processing the code to be edited to obtain a return code corresponding to the code calling instruction.
8. The method of claim 7, wherein the code fetch instruction comprises a store code instruction; the method comprises the following steps:
And under the condition that the code calling instruction is a stored code instruction, splicing the code to be edited in the control range and the code to be edited outside the control range to obtain a return code corresponding to the stored code instruction.
9. The method of claim 8, wherein the code fetch instruction comprises an execute code instruction; the method further comprises the steps of:
And under the condition that the code calling instruction is an executing code instruction, replacing the control tag in the spliced code by using a regular expression to obtain a return code corresponding to the executing code instruction.
10. The method of claim 7, wherein the code fetch instruction comprises a expose code instruction; the method comprises the following steps:
And under the condition that the code calling instruction is a display code instruction, obtaining a return code corresponding to the display code instruction according to the function configuration parameters.
11. An edit control apparatus comprising:
The scanning unit is used for scanning the code to be edited to obtain a control tag in the code to be edited;
a determining unit, configured to determine a control range of a mark content area in the code to be edited according to the control tag;
the execution unit is used for executing the control function corresponding to the control tag aiming at the code to be edited in the control range;
The control tag comprises an editing tag and/or a hidden tag, the control function corresponding to the editing tag comprises editing function control, and the control function corresponding to the hidden tag comprises non-display function.
12. The apparatus of claim 11, wherein the execution unit is to:
under the condition that the control label is the editing label, acquiring the position coordinates of the current cursor and the coordinate area of the control range;
disabling the editing function of the code to be edited under the condition that the position coordinates of the current cursor are within the coordinate area of the control range;
and enabling the editing function of the code to be edited under the condition that the position coordinates of the current cursor are out of the coordinate area of the control range.
13. The apparatus of claim 11, wherein the execution unit is to:
And hiding the code to be edited in the control range in the current editing interface under the condition that the control label is the hidden label.
14. The apparatus according to any one of claims 11 to 13, wherein the scanning unit is configured to:
And matching the code to be edited by using a regular expression to obtain a control tag in the code to be edited.
15. The apparatus according to claim 14, wherein the determining unit is configured to:
acquiring position information of the mark content of the control tag in the code to be edited;
And obtaining the control range of the code to be edited according to the position information.
16. The apparatus according to any one of claims 11 to 13, further comprising a control unit for:
Before the code to be edited is scanned, acquiring function configuration parameters;
and executing the step of scanning the code to be edited under the condition that the function configuration parameters meet preset conditions.
17. The apparatus of claim 16, further comprising a processing unit to:
and responding to the code calling instruction, and processing the code to be edited to obtain a return code corresponding to the code calling instruction.
18. The apparatus of claim 17, wherein the code fetch instruction comprises a store code instruction; the processing unit is used for:
And under the condition that the code calling instruction is a stored code instruction, splicing the code to be edited in the control range and the code to be edited outside the control range to obtain a return code corresponding to the stored code instruction.
19. The apparatus of claim 18, wherein the code fetch instructions comprise executing code instructions; the processing unit is further configured to:
And under the condition that the code calling instruction is an executing code instruction, replacing the control tag in the spliced code by using a regular expression to obtain a return code corresponding to the executing code instruction.
20. The apparatus of claim 17, wherein the code fetch instructions comprise show code instructions; the processing unit is used for:
And under the condition that the code calling instruction is a display code instruction, obtaining a return code corresponding to the display code instruction according to the function configuration parameters.
21. An electronic device comprising a processor and a memory, the memory storing instructions that are loaded and executed by the processor to implement the method of any one of claims 1 to 10.
22. A computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the method of any of claims 1 to 10.
CN202110265945.6A 2021-03-11 Editing control method, device, equipment and storage medium Active CN112925515B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110265945.6A CN112925515B (en) 2021-03-11 Editing control method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110265945.6A CN112925515B (en) 2021-03-11 Editing control method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112925515A CN112925515A (en) 2021-06-08
CN112925515B true CN112925515B (en) 2024-06-21

Family

ID=

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103777935A (en) * 2012-10-24 2014-05-07 阿里巴巴集团控股有限公司 Webpage processing method and device
CN105117205A (en) * 2015-07-24 2015-12-02 北京奇虎科技有限公司 Web page editing method and web page editing device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103777935A (en) * 2012-10-24 2014-05-07 阿里巴巴集团控股有限公司 Webpage processing method and device
CN105117205A (en) * 2015-07-24 2015-12-02 北京奇虎科技有限公司 Web page editing method and web page editing device

Similar Documents

Publication Publication Date Title
CN100486068C (en) Method and system for computer based testing using plugins to expand functionality of a test driver
US7447706B2 (en) Method and system for generating an auto-completion list for a cascading style sheet selector
KR102150779B1 (en) Method and device for positioning pages about incorrectly entered information
US6119136A (en) Manuscript text composition system featuring a parameter table for specifying template parameters and characters
CN111291533B (en) Sentence segment to be displayed display method and device, computer equipment and storage medium
Zakas Maintainable JavaScript: Writing Readable Code
US6175843B1 (en) Method and system for displaying a structured document
CN111124481A (en) Installation package generation method and device of webpage application program, storage medium and equipment
CN113220738A (en) Business rule generation method, device, equipment and storage medium
CN112925515B (en) Editing control method, device, equipment and storage medium
Krause Introducing Bootstrap 4
JP4890051B2 (en) Browser screen display device and program therefor
CN103473431A (en) Lightweight method for debugging hypertext preprocessor (PHP) program on line
US8495600B2 (en) Display method, corresponding computer program and device
CN112925515A (en) Editing control method, device, equipment and storage medium
CN113919287B (en) Entity relationship labeling method and device combining RPA and AI and electronic equipment
George Mastering Django
JP4019449B2 (en) How to save HTML content history
CN110399580B (en) Method and device for displaying target style in browser
CN108647198B (en) Unity-based character editing method and terminal
Radford Learning Web Development with Bootstrap and AngularJS
CN113741900B (en) Development method and device of front-end page application and related equipment
Story The AcroTEX eDucation Bundle
JPH09212630A (en) Graphic production device
CN111694723B (en) Method for editing nodes and components when product runs under H5 and storage medium

Legal Events

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