prosemirror-view
Advanced tools
Comparing version
@@ -0,1 +1,11 @@ | ||
## 1.15.3 (2020-08-11) | ||
### Bug fixes | ||
Work around a Firefox issue where the cursor is sometimes shown in the wrong place when directly after a `<br>` node. | ||
The editor will now reset composition when stored marks are set on the state, so that the marks can be added to the next input. | ||
Inline decorations are no longer applied to inline nodes that aren't leaves, only to the innermost layer. | ||
## 1.15.2 (2020-07-09) | ||
@@ -2,0 +12,0 @@ |
{ | ||
"name": "prosemirror-view", | ||
"version": "1.15.2", | ||
"version": "1.15.3", | ||
"description": "ProseMirror's view component", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -197,2 +197,4 @@ function compareObjs(a, b) { | ||
get spec() { return this.type.spec } | ||
get inline() { return this.type instanceof InlineType } | ||
} | ||
@@ -199,0 +201,0 @@ |
@@ -6,3 +6,3 @@ import {NodeSelection} from "prosemirror-state" | ||
import {docViewDesc} from "./viewdesc" | ||
import {initInput, destroyInput, dispatchEvent, ensureListeners} from "./input" | ||
import {initInput, destroyInput, dispatchEvent, ensureListeners, clearComposition} from "./input" | ||
import {selectionToDOM, anchorInRightPlace, syncNodeSelection} from "./selection" | ||
@@ -119,3 +119,9 @@ import {Decoration, viewDecorations} from "./decoration" | ||
updateStateInner(state, reconfigured) { | ||
let prev = this.state, redraw = false | ||
let prev = this.state, redraw = false, updateSel = false | ||
// When stored marks are added, stop composition, so that they can | ||
// be displayed. | ||
if (state.storedMarks && this.composing) { | ||
clearComposition(this) | ||
updateSel = true | ||
} | ||
this.state = state | ||
@@ -138,3 +144,3 @@ if (reconfigured) { | ||
let updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco) | ||
let updateSel = updateDoc || !state.selection.eq(prev.selection) | ||
if (updateDoc || !state.selection.eq(prev.selection)) updateSel = true | ||
let oldScrollPos = scroll == "preserve" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this) | ||
@@ -141,0 +147,0 @@ |
@@ -451,6 +451,10 @@ import {Selection, NodeSelection, TextSelection} from "prosemirror-state" | ||
export function clearComposition(view) { | ||
view.composing = false | ||
while (view.compositionNodes.length > 0) view.compositionNodes.pop().markParentsDirty() | ||
} | ||
export function endComposition(view, forceUpdate) { | ||
view.domObserver.forceFlush() | ||
view.composing = false | ||
while (view.compositionNodes.length > 0) view.compositionNodes.pop().markParentsDirty() | ||
clearComposition(view) | ||
if (forceUpdate || view.docView.dirty) { | ||
@@ -457,0 +461,0 @@ let sel = selectionFromDOM(view) |
@@ -360,2 +360,9 @@ import {DOMSerializer, Fragment, Mark} from "prosemirror-model" | ||
// On Firefox, using Selection.collapse to put the cursor after a | ||
// BR node for some reason doesn't always work (#1073) | ||
let geckoKludge = false | ||
if (browser.gecko && anchor == head) { | ||
let prev = anchorDOM.node.childNodes[anchorDOM.offset - 1] | ||
if (prev && prev.nodeName == "BR") geckoKludge = true | ||
} | ||
// Selection.extend can be used to create an 'inverted' selection | ||
@@ -365,3 +372,3 @@ // (one where the focus is before the anchor), but not all | ||
let domSelExtended = false | ||
if (domSel.extend || anchor == head) { | ||
if ((domSel.extend || anchor == head) && !geckoKludge) { | ||
domSel.collapse(anchorDOM.node, anchorDOM.offset) | ||
@@ -1224,3 +1231,4 @@ try { | ||
for (let i = 0; i < active.length; i++) if (active[i].to <= offset) active.splice(i--, 1) | ||
while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset) active.push(locals[decoIndex++]) | ||
while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset) | ||
active.push(locals[decoIndex++]) | ||
@@ -1240,3 +1248,6 @@ let end = offset + child.nodeSize | ||
onNode(child, active.length ? active.slice() : nothing, deco.forChild(offset, child), index) | ||
let outerDeco = !active.length ? nothing | ||
: child.isInline && !child.isLeaf ? outerDeco.filter(d => !d.inline) | ||
: active.slice() | ||
onNode(child, outerDeco, deco.forChild(offset, child), index) | ||
offset = end | ||
@@ -1243,0 +1254,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1429031
0.43%13822
0.46%1
Infinity%