prosemirror-view 1.23.3 → 1.23.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/index.es.js +22 -6
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +22 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/input.js +13 -1
- package/src/selection.js +7 -3
- package/src/viewdesc.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 1.23.4 (2021-12-22)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Improve the way the editor handles the mess of events produced when pressing Enter before a word that was just typed on Chrome + GBoard.
|
|
6
|
+
|
|
7
|
+
Fix an issue where compositions right before another instance of the composed text could cause the editor to crash.
|
|
8
|
+
|
|
9
|
+
Fix an issue where, if decorations changed during a pointer drag selection, the selection anchor might move around inappropriately.
|
|
10
|
+
|
|
1
11
|
## 1.23.3 (2021-11-26)
|
|
2
12
|
|
|
3
13
|
### Bug fixes
|
package/dist/index.es.js
CHANGED
|
@@ -2077,8 +2077,8 @@ function findTextInFragment(frag, text, from, to) {
|
|
|
2077
2077
|
if (!next.isText) { break }
|
|
2078
2078
|
str += next.text;
|
|
2079
2079
|
}
|
|
2080
|
-
if (pos >= from) {
|
|
2081
|
-
var found = str.lastIndexOf(text, to - childStart);
|
|
2080
|
+
if (pos >= from && childStart < to) {
|
|
2081
|
+
var found = str.lastIndexOf(text, to - childStart - 1);
|
|
2082
2082
|
if (found >= 0 && found + text.length + childStart >= from)
|
|
2083
2083
|
{ return childStart + found }
|
|
2084
2084
|
}
|
|
@@ -2149,9 +2149,13 @@ function selectionToDOM(view, force) {
|
|
|
2149
2149
|
if (!editorOwnsSelection(view)) { return }
|
|
2150
2150
|
|
|
2151
2151
|
if (!force && view.mouseDown && view.mouseDown.allowDefault) {
|
|
2152
|
-
view.
|
|
2153
|
-
|
|
2154
|
-
|
|
2152
|
+
var domSel = view.root.getSelection(), curSel = view.domObserver.currentSelection;
|
|
2153
|
+
if (domSel.anchorNode && isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset,
|
|
2154
|
+
curSel.anchorNode, curSel.anchorOffset)) {
|
|
2155
|
+
view.mouseDown.delayedSelectionSync = true;
|
|
2156
|
+
view.domObserver.setCurSelection();
|
|
2157
|
+
return
|
|
2158
|
+
}
|
|
2155
2159
|
}
|
|
2156
2160
|
|
|
2157
2161
|
view.domObserver.disconnectSelection();
|
|
@@ -3503,9 +3507,14 @@ function dispatchEvent(view, event) {
|
|
|
3503
3507
|
editHandlers.keydown = function (view, event) {
|
|
3504
3508
|
view.shiftKey = event.keyCode == 16 || event.shiftKey;
|
|
3505
3509
|
if (inOrNearComposition(view, event)) { return }
|
|
3506
|
-
if (event.keyCode != 229) { view.domObserver.forceFlush(); }
|
|
3507
3510
|
view.lastKeyCode = event.keyCode;
|
|
3508
3511
|
view.lastKeyCodeTime = Date.now();
|
|
3512
|
+
// Suppress enter key events on Chrome Android, because those tend
|
|
3513
|
+
// to be part of a confused sequence of composition events fired,
|
|
3514
|
+
// and handling them eagerly tends to corrupt the input.
|
|
3515
|
+
if (result.android && result.chrome && event.keyCode == 13) { return }
|
|
3516
|
+
if (event.keyCode != 229) { view.domObserver.forceFlush(); }
|
|
3517
|
+
|
|
3509
3518
|
// On iOS, if we preventDefault enter key presses, the virtual
|
|
3510
3519
|
// keyboard gets confused. So the hack here is to set a flag that
|
|
3511
3520
|
// makes the DOM change code recognize that what just happens should
|
|
@@ -3890,6 +3899,7 @@ function timestampFromCustomEvent() {
|
|
|
3890
3899
|
}
|
|
3891
3900
|
|
|
3892
3901
|
function endComposition(view, forceUpdate) {
|
|
3902
|
+
if (result.android && view.domObserver.flushingSoon >= 0) { return }
|
|
3893
3903
|
view.domObserver.forceFlush();
|
|
3894
3904
|
clearComposition(view);
|
|
3895
3905
|
if (forceUpdate || view.docView.dirty) {
|
|
@@ -3980,6 +3990,11 @@ function doPaste(view, text, html, e) {
|
|
|
3980
3990
|
}
|
|
3981
3991
|
|
|
3982
3992
|
editHandlers.paste = function (view, e) {
|
|
3993
|
+
// Handling paste from JavaScript during composition is very poorly
|
|
3994
|
+
// handled by browsers, so as a dodgy but preferable kludge, we just
|
|
3995
|
+
// let the browser do its native thing there, except on Android,
|
|
3996
|
+
// where the editor is almost always composing.
|
|
3997
|
+
if (view.composing && !result.android) { return }
|
|
3983
3998
|
var data = brokenClipboardAPI ? null : e.clipboardData;
|
|
3984
3999
|
if (data && doPaste(view, data.getData("text/plain"), data.getData("text/html"), e)) { e.preventDefault(); }
|
|
3985
4000
|
else { capturePaste(view, e); }
|
|
@@ -4111,6 +4126,7 @@ handlers.beforeinput = function (view, event) {
|
|
|
4111
4126
|
// Very specific hack to deal with backspace sometimes failing on
|
|
4112
4127
|
// Chrome Android when after an uneditable node.
|
|
4113
4128
|
if (result.chrome && result.android && event.inputType == "deleteContentBackward") {
|
|
4129
|
+
view.domObserver.flushSoon();
|
|
4114
4130
|
var domChangeCount = view.domChangeCount;
|
|
4115
4131
|
setTimeout(function () {
|
|
4116
4132
|
if (view.domChangeCount != domChangeCount) { return } // Event already had some effect
|