Fixed editor scoll adjustment
This commit is contained in:
parent
7cc1c4e8b7
commit
050dfc21f4
@ -273,8 +273,16 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
var nextTickAdjustScroll = false;
|
var nextTickAdjustScroll = false;
|
||||||
|
var lastSelectionStart, lastSelectionEnd;
|
||||||
|
var saveLastSelection = _.debounce(function() {
|
||||||
|
lastSelectionStart = self.selectionStart;
|
||||||
|
lastSelectionEnd = self.selectionEnd;
|
||||||
|
}, 50);
|
||||||
var debouncedSave = utils.debounce(function() {
|
var debouncedSave = utils.debounce(function() {
|
||||||
save();
|
save();
|
||||||
|
if(lastSelectionStart == self.selectionStart && lastSelectionEnd == self.selectionEnd) {
|
||||||
|
nextTickAdjustScroll = false;
|
||||||
|
}
|
||||||
self.updateCursorCoordinates(nextTickAdjustScroll);
|
self.updateCursorCoordinates(nextTickAdjustScroll);
|
||||||
nextTickAdjustScroll = false;
|
nextTickAdjustScroll = false;
|
||||||
});
|
});
|
||||||
@ -287,6 +295,7 @@ define([
|
|||||||
else {
|
else {
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
saveLastSelection();
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
this.getSelectedText = function() {
|
this.getSelectedText = function() {
|
||||||
|
@ -4,13 +4,13 @@ define([
|
|||||||
"utils",
|
"utils",
|
||||||
"classes/Extension",
|
"classes/Extension",
|
||||||
"text!html/buttonHtmlCode.html",
|
"text!html/buttonHtmlCode.html",
|
||||||
"text!html/buttonHtmlCodeSettingsBlock.html",
|
"text!html/buttonHtmlCodeSettingsBlock.html"
|
||||||
], function($, _, utils, Extension, buttonHtmlCodeHTML, buttonHtmlCodeSettingsBlockHTML) {
|
], function($, _, utils, Extension, buttonHtmlCodeHTML, buttonHtmlCodeSettingsBlockHTML) {
|
||||||
|
|
||||||
var buttonHtmlCode = new Extension("buttonHtmlCode", 'Button "HTML code"', true, true);
|
var buttonHtmlCode = new Extension("buttonHtmlCode", 'Button "HTML code"', true, true);
|
||||||
buttonHtmlCode.settingsBlock = buttonHtmlCodeSettingsBlockHTML;
|
buttonHtmlCode.settingsBlock = buttonHtmlCodeSettingsBlockHTML;
|
||||||
buttonHtmlCode.defaultConfig = {
|
buttonHtmlCode.defaultConfig = {
|
||||||
template: "<%= documentHTML %>",
|
template: "<%= documentHTML %>"
|
||||||
};
|
};
|
||||||
|
|
||||||
buttonHtmlCode.onLoadSettings = function() {
|
buttonHtmlCode.onLoadSettings = function() {
|
||||||
@ -62,7 +62,7 @@ define([
|
|||||||
documentHTMLWithFrontMatter: (selectedFileDesc.frontMatter ? selectedFileDesc.frontMatter._frontMatter : '') + htmlWithoutComments,
|
documentHTMLWithFrontMatter: (selectedFileDesc.frontMatter ? selectedFileDesc.frontMatter._frontMatter : '') + htmlWithoutComments,
|
||||||
documentHTMLWithComments: htmlWithComments,
|
documentHTMLWithComments: htmlWithComments,
|
||||||
frontMatter: selectedFileDesc.frontMatter,
|
frontMatter: selectedFileDesc.frontMatter,
|
||||||
publishAttributes: undefined,
|
publishAttributes: undefined
|
||||||
});
|
});
|
||||||
textareaElt.value = htmlCode;
|
textareaElt.value = htmlCode;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ define([
|
|||||||
eventMgr.onEditorPopover();
|
eventMgr.onEditorPopover();
|
||||||
shown = true;
|
shown = true;
|
||||||
$findReplaceElt.show();
|
$findReplaceElt.show();
|
||||||
$searchForInputElt.focus();
|
$searchForInputElt.focus()[0].setSelectionRange(0, $searchForInputElt.val().length);
|
||||||
editor.selectionMgr.adjustTop = 50;
|
editor.selectionMgr.adjustTop = 50;
|
||||||
editor.selectionMgr.adjustBottom = 220;
|
editor.selectionMgr.adjustBottom = 220;
|
||||||
highlight(true);
|
highlight(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user