prosemirror-view 1.22.0 → 1.23.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prosemirror-view",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "description": "ProseMirror's view component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
package/src/clipboard.js CHANGED
@@ -69,7 +69,13 @@ export function parseFromClipboard(view, text, html, plainText, $context) {
69
69
  let sliceData = contextNode && /^(\d+) (\d+) (.*)/.exec(contextNode.getAttribute("data-pm-slice"))
70
70
  if (!slice) {
71
71
  let parser = view.someProp("clipboardParser") || view.someProp("domParser") || DOMParser.fromSchema(view.state.schema)
72
- slice = parser.parseSlice(dom, {preserveWhitespace: !!(asText || sliceData), context: $context})
72
+ slice = parser.parseSlice(dom, {
73
+ preserveWhitespace: !!(asText || sliceData),
74
+ context: $context,
75
+ ruleFromNode(dom) {
76
+ if (dom.nodeName == "BR" && !dom.nextSibling) return {ignore: true}
77
+ }
78
+ })
73
79
  }
74
80
  if (sliceData) {
75
81
  slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[3])
package/src/decoration.js CHANGED
@@ -156,7 +156,7 @@ export class Decoration {
156
156
  // key are interchangeable—if widgets differ in, for example,
157
157
  // the behavior of some event handler, they should get
158
158
  // different keys.
159
- //
159
+ //
160
160
  // destroy:: ?(node: dom.Node)
161
161
  // Called when the widget decoration is removed as a result of
162
162
  // mapping
package/src/index.js CHANGED
@@ -373,6 +373,14 @@ export class EditorView {
373
373
  this.docView = null
374
374
  }
375
375
 
376
+ // :: boolean
377
+ // This is true when the view has been
378
+ // [destroyed](#view.EditorView.destroy) (and thus should not be
379
+ // used anymore).
380
+ get isDestroyed() {
381
+ return this.docView == null
382
+ }
383
+
376
384
  // Used for testing.
377
385
  dispatchEvent(event) {
378
386
  return dispatchEvent(this, event)