mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-24 18:56:32 -05:00
Fixed isInCode and code block textcomplete might not correct
This commit is contained in:
parent
1fb42bd276
commit
ce8f9b695c
1 changed files with 5 additions and 5 deletions
|
@ -2191,7 +2191,7 @@ function checkCursorMenu() {
|
|||
var isInCode = false;
|
||||
|
||||
function checkInCode() {
|
||||
isInCode = checkAbove() && checkBelow();
|
||||
isInCode = checkAbove();
|
||||
}
|
||||
|
||||
function checkAbove() {
|
||||
|
@ -2208,9 +2208,9 @@ function checkBelow() {
|
|||
var cursor = editor.getCursor();
|
||||
var count = editor.lineCount();
|
||||
var text = [];
|
||||
for (var i = cursor.line + 1; i < count; i++) //not contain current line
|
||||
for (var i = cursor.line + 1; i < count; i++) //contain current line
|
||||
text.push(editor.getLine(i));
|
||||
text = text.join('\n') + '\n' + editor.getLine(cursor.line).slice(0, cursor.ch);
|
||||
text = editor.getLine(cursor.line).slice(cursor.ch) + '\n' + text.join('\n');
|
||||
//console.log(text);
|
||||
return matchInCode(text);
|
||||
}
|
||||
|
@ -2279,7 +2279,7 @@ $(editor.getInputField())
|
|||
},
|
||||
replace: function (lang) {
|
||||
var ending = '';
|
||||
if (isInCode) {
|
||||
if (!checkBelow()) {
|
||||
ending = '\n\n```';
|
||||
}
|
||||
if (this.langs.indexOf(lang) !== -1)
|
||||
|
@ -2299,7 +2299,7 @@ $(editor.getInputField())
|
|||
},
|
||||
context: function (text) {
|
||||
checkCursorMenu();
|
||||
return true;
|
||||
return isInCode;
|
||||
}
|
||||
},
|
||||
{ //header
|
||||
|
|
Loading…
Reference in a new issue