prosemirror-view
Advanced tools
Comparing version
@@ -0,1 +1,13 @@ | ||
## 1.15.0 (2020-06-24) | ||
### Bug fixes | ||
Fix an issue where Enter on iOS might be handled twice on slow devices. Pass plain text flag to transformPastedText and clipboardTextParser props | ||
Fix a bug where typing in front of a mark could in some circumstances cause the editor to discard the new content. | ||
### New features | ||
The `transformPastedText` and `clipboardTextParser` props now receive an extra argument, `plain`, indicating whether the paste was forced as plain text. | ||
## 1.14.13 (2020-06-05) | ||
@@ -2,0 +14,0 @@ |
{ | ||
"name": "prosemirror-view", | ||
"version": "1.14.13", | ||
"version": "1.15.0", | ||
"description": "ProseMirror's view component", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -43,5 +43,5 @@ import {Slice, Fragment, DOMParser, DOMSerializer} from "prosemirror-model" | ||
if (asText) { | ||
view.someProp("transformPastedText", f => { text = f(text) }) | ||
view.someProp("transformPastedText", f => { text = f(text, inCode || plainText) }) | ||
if (inCode) return new Slice(Fragment.from(view.state.schema.text(text)), 0, 0) | ||
let parsed = view.someProp("clipboardTextParser", f => f(text, $context)) | ||
let parsed = view.someProp("clipboardTextParser", f => f(text, $context, plainText)) | ||
if (parsed) { | ||
@@ -48,0 +48,0 @@ slice = parsed |
@@ -154,3 +154,3 @@ import {Fragment, DOMParser} from "prosemirror-model" | ||
// as being an iOS enter press), just dispatch an Enter key instead. | ||
if (((browser.ios && view.lastIOSEnter > Date.now() - 100 && | ||
if (((browser.ios && view.lastIOSEnter > Date.now() - 225 && | ||
(!inlineChange || addedNodes.some(n => n.nodeName == "DIV" || n.nodeName == "P"))) || | ||
@@ -157,0 +157,0 @@ (!inlineChange && $from.pos < parse.doc.content.size && |
@@ -519,6 +519,7 @@ import {NodeSelection} from "prosemirror-state" | ||
// | ||
// transformPastedText:: ?(text: string) → string | ||
// Transform pasted plain text. | ||
// transformPastedText:: ?(text: string, plain: bool) → string | ||
// Transform pasted plain text. The `plain` flag will be true when | ||
// the text is pasted as plain text. | ||
// | ||
// clipboardTextParser:: ?(text: string, $context: ResolvedPos) → Slice | ||
// clipboardTextParser:: ?(text: string, $context: ResolvedPos, plain: bool) → Slice | ||
// A function to parse text from the clipboard into a document | ||
@@ -530,2 +531,3 @@ // slice. Called after | ||
// [`clipboardParser`](#view.EditorProps.clipboardParser) on it. | ||
// The `plain` flag will be true when the text is pasted as plain text. | ||
// | ||
@@ -532,0 +534,0 @@ // transformPasted:: ?(Slice) → Slice |
@@ -27,2 +27,3 @@ import {Selection, NodeSelection, TextSelection} from "prosemirror-state" | ||
view.lastIOSEnter = 0 | ||
view.lastIOSEnterFallbackTimeout = null | ||
@@ -66,2 +67,3 @@ view.composing = false | ||
clearTimeout(view.composingTimeout) | ||
clearTimeout(view.lastIOSEnterFallbackTimeout) | ||
} | ||
@@ -112,3 +114,3 @@ | ||
view.lastIOSEnter = now | ||
setTimeout(() => { | ||
view.lastIOSEnterFallbackTimeout = setTimeout(() => { | ||
if (view.lastIOSEnter == now) { | ||
@@ -118,3 +120,3 @@ view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter"))) | ||
} | ||
}, 50) | ||
}, 200) | ||
} else if (view.someProp("handleKeyDown", f => f(view, event)) || captureKeyDown(view, event)) { | ||
@@ -121,0 +123,0 @@ event.preventDefault() |
@@ -304,3 +304,3 @@ import {DOMSerializer, Fragment, Mark} from "prosemirror-model" | ||
} | ||
if (fromOffset > -1 && to <= end) { | ||
if (fromOffset > -1 && (end > to || i == this.children.length - 1)) { | ||
to = end | ||
@@ -307,0 +307,0 @@ for (let j = i + 1; j < this.children.length; j++) { |
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
1423295
0.19%13772
0.09%