Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Antoine Thevenet
clif-webui
Commits
278cea8f
Commit
278cea8f
authored
Jun 30, 2021
by
Antoine Thevenet
Browse files
Changed the process to format the nchoice inserted in the editor ace
parent
b4d55e0b
Pipeline
#14384
failed with stages
in 29 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/resources/static/js/assistant.js
View file @
278cea8f
...
...
@@ -325,10 +325,10 @@ function insertStatement(statementType, pluginName, testName, pluginId) {
}
xmlToInsert
+=
endXml
;
xmlToInsert
=
formatXml
(
xmlToInsert
);
//delete the \n added by format xml
xmlToInsert
=
xmlToInsert
.
substring
(
0
,
xmlToInsert
.
length
-
1
);
//format the insertion
var
cursorPositionToInsert
=
[
cursorPosition
[
"
row
"
],
cursorPosition
[
"
column
"
]]
xmlToInsert
=
formatInsertion
(
xmlToInsert
,
cursorPositionToInsert
);
...
...
@@ -365,17 +365,21 @@ retrieveTest = function retrieveTest(pluginName, testName, cache) {
function
insertChoice
()
{
var
editor
=
ace
.
edit
(
getActiveEditor
());
var
completeText
=
editor
.
getValue
();
var
xml
=
"
<nchoice>
\n\t
<choice proba=
\"
1
\"
>
\n\t
</choice><choice proba=
\"
1
\"
>
\n\t
</choice>
\n
</nchoice>
"
;
xml
=
formatXml
(
xml
);
var
answerPositionToInsertPrimitive
=
positionToInsert
();
var
cursorPositionToInsert
=
answerPositionToInsertPrimitive
[
0
];
// xml = addTabXml(xml, cursorPositionToInsert, completeText);
xml
=
formatInsertion
(
xml
,
cursorPositionToInsert
);
var
cursorPosition
=
editor
.
getCursorPosition
();
var
xmlToInsert
=
"
<nchoice>
\n\t
<choice proba=
\"
1
\"
>
\n\t
</choice><choice proba=
\"
1
\"
>
\n\t
</choice>
\n
</nchoice>
"
;
xmlToInsert
=
formatXml
(
xmlToInsert
);
//delete the \n added by format xml
xmlToInsert
=
xmlToInsert
.
substring
(
0
,
xmlToInsert
.
length
-
1
);
//format the insertion
var
cursorPositionToInsert
=
[
cursorPosition
[
"
row
"
],
cursorPosition
[
"
column
"
]]
xmlToInsert
=
formatInsertion
(
xmlToInsert
,
cursorPositionToInsert
);
//insert the formatted xml
var
Range
=
ace
.
require
(
'
ace/range
'
).
Range
;
editor
.
session
.
replace
(
new
Range
(
cursorPositionToInsert
[
1
],
cursorPositionToInsert
[
0
],
cursorPositionToInsert
[
1
],
cursorPositionToInsert
[
0
]),
xml
);
editor
.
session
.
replace
(
new
Range
(
cursorPosition
[
"
row
"
],
cursorPosition
[
"
column
"
],
cursorPosition
[
"
row
"
],
cursorPosition
[
"
column
"
]),
xmlToInsert
);
}
/*------------------------------------------------------------------
-----------------------------Behavior-------------------------------
-------------------------------------------------------------------*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment