scroll-to-line-with-scroll.js
John McLear 2020-12-11 19:06:07 +00:00
parent 114656cd84
commit 7fe37cd49c
1 changed files with 11 additions and 11 deletions

View File

@ -109,23 +109,23 @@ const padeditor = (function () {
$('#languagemenu').val(html10n.getLanguage()); $('#languagemenu').val(html10n.getLanguage());
$('#languagemenu').change(() => { $('#languagemenu').change(() => {
Cookies.set('language', $('#languagemenu').val()); Cookies.set('language', $('#languagemenu').val());
window.html10n.localize([$("#languagemenu").val(), 'en']); window.html10n.localize([$('#languagemenu').val(), 'en']);
if ($('select').niceSelect) { if ($('select').niceSelect) {
$('select').niceSelect('update'); $('select').niceSelect('update');
} }
}); });
}, },
setViewOptions(newOptions) { setViewOptions: (newOptions) => {
function getOption(key, defaultValue) { const getOption = (key, defaultValue) => {
const value = String(newOptions[key]); const value = String(newOptions[key]);
if (value == 'true') return true; if (value === 'true') return true;
if (value == 'false') return false; if (value === 'false') return false;
return defaultValue; return defaultValue;
} };
let v; let v;
v = getOption('rtlIsTrue', ('rtl' == html10n.getDirection())); v = getOption('rtlIsTrue', ('rtl' === html10n.getDirection()));
self.ace.setProperty('rtlIsTrue', v); self.ace.setProperty('rtlIsTrue', v);
padutils.setCheckbox($('#options-rtlcheck'), v); padutils.setCheckbox($('#options-rtlcheck'), v);
@ -146,24 +146,24 @@ const padeditor = (function () {
self.ace.setProperty('textface', newOptions.padFontFamily || ''); self.ace.setProperty('textface', newOptions.padFontFamily || '');
}, },
dispose() { dispose: () => {
if (self.ace) { if (self.ace) {
self.ace.destroy(); self.ace.destroy();
self.ace = null; self.ace = null;
} }
}, },
enable() { enable: () => {
if (self.ace) { if (self.ace) {
self.ace.setEditable(true); self.ace.setEditable(true);
} }
}, },
disable() { disable: () => {
if (self.ace) { if (self.ace) {
self.ace.setProperty('grayedOut', true); self.ace.setProperty('grayedOut', true);
self.ace.setEditable(false); self.ace.setEditable(false);
} }
}, },
restoreRevisionText(dataFromServer) { restoreRevisionText: (dataFromServer) => {
pad.addHistoricalAuthors(dataFromServer.historicalAuthorData); pad.addHistoricalAuthors(dataFromServer.historicalAuthorData);
self.ace.importAText(dataFromServer.atext, dataFromServer.apool, true); self.ace.importAText(dataFromServer.atext, dataFromServer.apool, true);
}, },