mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-26 08:04:56 +01:00
Fix node text edition error
This commit is contained in:
parent
f95e65f21b
commit
b2310e53fc
@ -92,8 +92,8 @@ class MultilineTextEditor extends Events {
|
|||||||
break;
|
break;
|
||||||
case 'tab':
|
case 'tab':
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var start = $(this).get(0).selectionStart;
|
const start = $(this).get(0).selectionStart;
|
||||||
var end = $(this).get(0).selectionEnd;
|
const end = $(this).get(0).selectionEnd;
|
||||||
|
|
||||||
// set textarea value to: text before caret + tab + text after caret
|
// set textarea value to: text before caret + tab + text after caret
|
||||||
$(this).val(`${$(this).val().substring(0, start)}\t${$(this).val().substring(end)}`);
|
$(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
|
// put caret at right position again
|
||||||
$(this).get(0).selectionStart = $(this).get(0).selectionEnd = start + 1;
|
$(this).get(0).selectionStart = $(this).get(0).selectionEnd = start + 1;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
// No actions...
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
@ -192,8 +195,9 @@ class MultilineTextEditor extends Events {
|
|||||||
font.color = nodeText.getColor();
|
font.color = nodeText.getColor();
|
||||||
this._setStyle(font);
|
this._setStyle(font);
|
||||||
const me = this;
|
const me = this;
|
||||||
|
|
||||||
// Set editor's initial size
|
// Set editor's initial size
|
||||||
const displayFunc = function () {
|
const displayFunc = function displayFunc() {
|
||||||
// Position the editor and set the size...
|
// Position the editor and set the size...
|
||||||
const textShape = topic.getTextShape();
|
const textShape = topic.getTextShape();
|
||||||
|
|
||||||
@ -212,7 +216,7 @@ class MultilineTextEditor extends Events {
|
|||||||
me._positionCursor(inputElem, !$defined(defaultText));
|
me._positionCursor(inputElem, !$defined(defaultText));
|
||||||
};
|
};
|
||||||
|
|
||||||
this._timeoutId = displayFunc.delay(10);
|
this._timeoutId = setTimeout(() => displayFunc(), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
_setStyle(fontStyle) {
|
_setStyle(fontStyle) {
|
||||||
|
Loading…
Reference in New Issue
Block a user