Fix node text edition error

This commit is contained in:
Paulo Gustavo Veiga 2021-12-14 18:04:47 -08:00
parent f95e65f21b
commit b2310e53fc

View File

@ -92,8 +92,8 @@ class MultilineTextEditor extends Events {
break;
case 'tab':
event.preventDefault();
var start = $(this).get(0).selectionStart;
var end = $(this).get(0).selectionEnd;
const start = $(this).get(0).selectionStart;
const end = $(this).get(0).selectionEnd;
// set textarea value to: text before caret + tab + text after caret
$(this).val(`${$(this).val().substring(0, start)}\t${$(this).val().substring(end)}`);
@ -101,6 +101,9 @@ class MultilineTextEditor extends Events {
// put caret at right position again
$(this).get(0).selectionStart = $(this).get(0).selectionEnd = start + 1;
break;
default:
// No actions...
break;
}
event.stopPropagation();
});
@ -192,8 +195,9 @@ class MultilineTextEditor extends Events {
font.color = nodeText.getColor();
this._setStyle(font);
const me = this;
// Set editor's initial size
const displayFunc = function () {
const displayFunc = function displayFunc() {
// Position the editor and set the size...
const textShape = topic.getTextShape();
@ -212,7 +216,7 @@ class MultilineTextEditor extends Events {
me._positionCursor(inputElem, !$defined(defaultText));
};
this._timeoutId = displayFunc.delay(10);
this._timeoutId = setTimeout(() => displayFunc(), 10);
}
_setStyle(fontStyle) {