focus caret at line
parent
1a577d53bd
commit
a2a7322226
|
@ -682,6 +682,7 @@ function Ace2Inner() {
|
||||||
editorInfo.ace_doReturnKey = doReturnKey;
|
editorInfo.ace_doReturnKey = doReturnKey;
|
||||||
editorInfo.ace_isBlockElement = isBlockElement;
|
editorInfo.ace_isBlockElement = isBlockElement;
|
||||||
editorInfo.ace_getLineListType = getLineListType;
|
editorInfo.ace_getLineListType = getLineListType;
|
||||||
|
editorInfo.ace_setSelection = setSelection;
|
||||||
|
|
||||||
editorInfo.ace_callWithAce = function (fn, callStack, normalize) {
|
editorInfo.ace_callWithAce = function (fn, callStack, normalize) {
|
||||||
let wrapper = function () {
|
let wrapper = function () {
|
||||||
|
|
|
@ -60,6 +60,24 @@ const padeditor = (function () {
|
||||||
.find('#outerdocbody').parent();
|
.find('#outerdocbody').parent();
|
||||||
$outerdoc.css({top: `${offsetTop}px`}); // Chrome
|
$outerdoc.css({top: `${offsetTop}px`}); // Chrome
|
||||||
$outerdocHTML.animate({scrollTop: offsetTop}); // needed for FF
|
$outerdocHTML.animate({scrollTop: offsetTop}); // needed for FF
|
||||||
|
const node = line[0];
|
||||||
|
self.ace.callWithAce((ace) => {
|
||||||
|
const selection = {
|
||||||
|
startPoint: {
|
||||||
|
index: 0,
|
||||||
|
focusAtStart: true,
|
||||||
|
maxIndex: 1,
|
||||||
|
node,
|
||||||
|
},
|
||||||
|
endPoint: {
|
||||||
|
index: 0,
|
||||||
|
focusAtStart: true,
|
||||||
|
maxIndex: 1,
|
||||||
|
node,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
ace.ace_setSelection(selection);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue