mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Merge 8048a9acda
into ab89d4c16f
This commit is contained in:
commit
4acf66a7d1
1 changed files with 0 additions and 16 deletions
|
@ -220,22 +220,6 @@ export const textWysiwyg = ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const [viewportX, viewportY] = getViewportCoords(coordX, coordY);
|
const [viewportX, viewportY] = getViewportCoords(coordX, coordY);
|
||||||
const initialSelectionStart = editable.selectionStart;
|
|
||||||
const initialSelectionEnd = editable.selectionEnd;
|
|
||||||
const initialLength = editable.value.length;
|
|
||||||
|
|
||||||
// restore cursor position after value updated so it doesn't
|
|
||||||
// go to the end of text when container auto expanded
|
|
||||||
if (
|
|
||||||
initialSelectionStart === initialSelectionEnd &&
|
|
||||||
initialSelectionEnd !== initialLength
|
|
||||||
) {
|
|
||||||
// get diff between length and selection end and shift
|
|
||||||
// the cursor by "diff" times to position correctly
|
|
||||||
const diff = initialLength - initialSelectionEnd;
|
|
||||||
editable.selectionStart = editable.value.length - diff;
|
|
||||||
editable.selectionEnd = editable.value.length - diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!container) {
|
if (!container) {
|
||||||
maxWidth = (appState.width - 8 - viewportX) / appState.zoom.value;
|
maxWidth = (appState.width - 8 - viewportX) / appState.zoom.value;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue