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
scripta
eScriptorium
Commits
edbea8f0
Commit
edbea8f0
authored
Aug 04, 2020
by
EL HASSANE GARGEM
Browse files
click enter only
parent
b37d36bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/apps/core/static/js/edit/components/diplo_panel.js
View file @
edbea8f0
...
...
@@ -90,57 +90,55 @@ var DiploPanel = BasePanel.extend({
// click delete button if you are at the beggining of the line
if
(
ev
.
keyCode
==
8
&&
this
.
getCursorPosition
()
==
0
){
ev
.
preventDefault
();
this
.
updateEditLine
(
index
-
1
);
let
idx
=
this
.
part
.
lines
.
indexOf
(
this
.
editLine
);
let
child
=
this
.
$children
[
idx
];
let
nextLine
=
this
.
part
.
lines
[
idx
+
1
];
let
content
=
child
.
line
.
currentTrans
.
content
+
nextLine
.
currentTrans
.
content
;
child
.
setContent
(
content
);
this
.
addToUpdatedLines
(
child
.
line
.
currentTrans
);
for
(
let
i
=
idx
+
1
;
i
<
this
.
part
.
lines
.
length
;
i
++
)
{
let
child
=
this
.
$children
[
i
];
let
nextLine
=
this
.
part
.
lines
[
i
+
1
];
let
currentLine
=
child
.
line
;
if
(
nextLine
){
if
(
currentLine
.
currentTrans
.
pk
){
child
.
setContent
(
nextLine
.
currentTrans
.
content
);
this
.
addToUpdatedLines
(
currentLine
.
currentTrans
);
}
else
{
child
.
setContent
(
nextLine
.
currentTrans
.
content
);
this
.
createdLines
.
push
(
currentLine
.
currentTrans
);
}
}
else
{
child
.
setContent
(
""
);
this
.
addToUpdatedLines
(
child
.
line
.
currentTrans
);
}
this
.
setCursorPosition
(
"
[id='
"
+
this
.
editLine
.
pk
+
"
']
"
);
}
this
.
updateEditLine
(
-
1
);
}
//
if(ev.keyCode==8 && this.getCursorPosition()==0){
//
ev.preventDefault();
//
//
this.updateEditLine(index -1);
//
let idx = this.part.lines.indexOf(this.editLine);
//
let child = this.$children[idx];
//
let nextLine = this.part.lines[idx+1];
//
let content = child.line.currentTrans.content + nextLine.currentTrans.content;
//
child.setContent(content);
//
this.addToUpdatedLines(child.line.currentTrans);
//
//
for(let i=idx +1; i < this.part.lines.length; i++) {
//
//
let child = this.$children[i];
//
let nextLine = this.part.lines[i+1];
//
let currentLine = child.line;
//
if(nextLine){
//
//
if(currentLine.currentTrans.pk){
//
child.setContent(nextLine.currentTrans.content);
//
this.addToUpdatedLines(currentLine.currentTrans);
//
//
}
//
else{
//
child.setContent(nextLine.currentTrans.content);
//
this.createdLines.push(currentLine.currentTrans);
//
}
//
}
//
else {
//
child.setContent("");
//
this.addToUpdatedLines(child.line.currentTrans);
//
}
//
this.setCursorPosition("[id='"+ this.editLine.pk+ "']");
//
//
//
}
//
this.updateEditLine( -1);
//
//
//
}
//click on enter button
if
(
ev
.
keyCode
==
13
){
let
idx
=
this
.
part
.
lines
.
indexOf
(
this
.
editLine
)
;
ev
.
preventDefault
();
let
idx
=
this
.
part
.
lines
.
indexOf
(
this
.
editLine
);
if
(
idx
<
this
.
part
.
lines
.
length
-
1
){
// this.updateEditLine(index +1);
this
.
carriage
(
ev
,
idx
);
this
.
updateEditLine
(
idx
+
1
);
}
}
this
.
toggleSave
();
},
setEditLine
(
l
)
{
...
...
Write
Preview
Supports
Markdown
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