prosemirror-view 1.37.2 → 1.38.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/CHANGELOG.md +6 -0
- package/dist/index.cjs +8 -6
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +12 -6
- package/package.json +1 -1
- package/src/domobserver.ts +0 -1
- package/src/index.ts +10 -2
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2609,7 +2609,7 @@ function captureKeyDown(view, event) {
|
|
|
2609
2609
|
}
|
|
2610
2610
|
return false;
|
|
2611
2611
|
}
|
|
2612
|
-
function
|
|
2612
|
+
function _serializeForClipboard(view, slice) {
|
|
2613
2613
|
view.someProp("transformCopied", function (f) {
|
|
2614
2614
|
slice = f(slice, view);
|
|
2615
2615
|
});
|
|
@@ -3354,7 +3354,7 @@ handlers.copy = editHandlers.cut = function (view, _event) {
|
|
|
3354
3354
|
if (sel.empty) return;
|
|
3355
3355
|
var data = brokenClipboardAPI ? null : event.clipboardData;
|
|
3356
3356
|
var slice = sel.content(),
|
|
3357
|
-
_serializeForClipboar =
|
|
3357
|
+
_serializeForClipboar = _serializeForClipboard(view, slice),
|
|
3358
3358
|
dom = _serializeForClipboar.dom,
|
|
3359
3359
|
text = _serializeForClipboar.text;
|
|
3360
3360
|
if (data) {
|
|
@@ -3430,7 +3430,7 @@ handlers.dragstart = function (view, _event) {
|
|
|
3430
3430
|
if (desc && desc.node.type.spec.draggable && desc != view.docView) node = prosemirrorState.NodeSelection.create(view.state.doc, desc.posBefore);
|
|
3431
3431
|
}
|
|
3432
3432
|
var draggedSlice = (node || view.state.selection).content();
|
|
3433
|
-
var _serializeForClipboar2 =
|
|
3433
|
+
var _serializeForClipboar2 = _serializeForClipboard(view, draggedSlice),
|
|
3434
3434
|
dom = _serializeForClipboar2.dom,
|
|
3435
3435
|
text = _serializeForClipboar2.text,
|
|
3436
3436
|
slice = _serializeForClipboar2.slice;
|
|
@@ -4369,7 +4369,6 @@ var DOMObserver = function () {
|
|
|
4369
4369
|
view.input.lastFocus = 0;
|
|
4370
4370
|
selectionToDOM(view);
|
|
4371
4371
|
this.currentSelection.set(sel);
|
|
4372
|
-
view.scrollToSelection();
|
|
4373
4372
|
} else if (from > -1 || newSel) {
|
|
4374
4373
|
if (from > -1) {
|
|
4375
4374
|
view.docView.markDirty(from, to);
|
|
@@ -4812,7 +4811,6 @@ function isSurrogatePair(str) {
|
|
|
4812
4811
|
b = str.charCodeAt(1);
|
|
4813
4812
|
return a >= 0xDC00 && a <= 0xDFFF && b >= 0xD800 && b <= 0xDBFF;
|
|
4814
4813
|
}
|
|
4815
|
-
var __serializeForClipboard = serializeForClipboard;
|
|
4816
4814
|
var __parseFromClipboard = parseFromClipboard;
|
|
4817
4815
|
var __endComposition = endComposition;
|
|
4818
4816
|
var EditorView = function () {
|
|
@@ -5124,6 +5122,11 @@ var EditorView = function () {
|
|
|
5124
5122
|
value: function pasteText(text, event) {
|
|
5125
5123
|
return doPaste(this, text, null, true, event || new ClipboardEvent("paste"));
|
|
5126
5124
|
}
|
|
5125
|
+
}, {
|
|
5126
|
+
key: "serializeForClipboard",
|
|
5127
|
+
value: function serializeForClipboard(slice) {
|
|
5128
|
+
return _serializeForClipboard(this, slice);
|
|
5129
|
+
}
|
|
5127
5130
|
}, {
|
|
5128
5131
|
key: "destroy",
|
|
5129
5132
|
value: function destroy() {
|
|
@@ -5242,4 +5245,3 @@ exports.DecorationSet = DecorationSet;
|
|
|
5242
5245
|
exports.EditorView = EditorView;
|
|
5243
5246
|
exports.__endComposition = __endComposition;
|
|
5244
5247
|
exports.__parseFromClipboard = __parseFromClipboard;
|
|
5245
|
-
exports.__serializeForClipboard = __serializeForClipboard;
|
package/dist/index.d.cts
CHANGED
|
@@ -650,6 +650,19 @@ declare class EditorView {
|
|
|
650
650
|
*/
|
|
651
651
|
pasteText(text: string, event?: ClipboardEvent): boolean;
|
|
652
652
|
/**
|
|
653
|
+
Serialize the given slice as it would be if it was copied from
|
|
654
|
+
this editor. Returns a DOM element that contains a
|
|
655
|
+
representation of the slice as its children, a textual
|
|
656
|
+
representation, and the transformed slice (which can be
|
|
657
|
+
different from the given input due to hooks like
|
|
658
|
+
[`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).
|
|
659
|
+
*/
|
|
660
|
+
serializeForClipboard(slice: Slice): {
|
|
661
|
+
dom: HTMLElement;
|
|
662
|
+
text: string;
|
|
663
|
+
slice: Slice;
|
|
664
|
+
};
|
|
665
|
+
/**
|
|
653
666
|
Removes the editor from the DOM and destroys all [node
|
|
654
667
|
views](https://prosemirror.net/docs/ref/#view.NodeView).
|
|
655
668
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -650,6 +650,19 @@ declare class EditorView {
|
|
|
650
650
|
*/
|
|
651
651
|
pasteText(text: string, event?: ClipboardEvent): boolean;
|
|
652
652
|
/**
|
|
653
|
+
Serialize the given slice as it would be if it was copied from
|
|
654
|
+
this editor. Returns a DOM element that contains a
|
|
655
|
+
representation of the slice as its children, a textual
|
|
656
|
+
representation, and the transformed slice (which can be
|
|
657
|
+
different from the given input due to hooks like
|
|
658
|
+
[`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).
|
|
659
|
+
*/
|
|
660
|
+
serializeForClipboard(slice: Slice): {
|
|
661
|
+
dom: HTMLElement;
|
|
662
|
+
text: string;
|
|
663
|
+
slice: Slice;
|
|
664
|
+
};
|
|
665
|
+
/**
|
|
653
666
|
Removes the editor from the DOM and destroys all [node
|
|
654
667
|
views](https://prosemirror.net/docs/ref/#view.NodeView).
|
|
655
668
|
*/
|
package/dist/index.js
CHANGED
|
@@ -4705,7 +4705,6 @@ class DOMObserver {
|
|
|
4705
4705
|
view.input.lastFocus = 0;
|
|
4706
4706
|
selectionToDOM(view);
|
|
4707
4707
|
this.currentSelection.set(sel);
|
|
4708
|
-
view.scrollToSelection();
|
|
4709
4708
|
}
|
|
4710
4709
|
else if (from > -1 || newSel) {
|
|
4711
4710
|
if (from > -1) {
|
|
@@ -5207,10 +5206,6 @@ function isSurrogatePair(str) {
|
|
|
5207
5206
|
return a >= 0xDC00 && a <= 0xDFFF && b >= 0xD800 && b <= 0xDBFF;
|
|
5208
5207
|
}
|
|
5209
5208
|
|
|
5210
|
-
/**
|
|
5211
|
-
@internal
|
|
5212
|
-
*/
|
|
5213
|
-
const __serializeForClipboard = serializeForClipboard;
|
|
5214
5209
|
/**
|
|
5215
5210
|
@internal
|
|
5216
5211
|
*/
|
|
@@ -5660,6 +5655,17 @@ class EditorView {
|
|
|
5660
5655
|
return doPaste(this, text, null, true, event || new ClipboardEvent("paste"));
|
|
5661
5656
|
}
|
|
5662
5657
|
/**
|
|
5658
|
+
Serialize the given slice as it would be if it was copied from
|
|
5659
|
+
this editor. Returns a DOM element that contains a
|
|
5660
|
+
representation of the slice as its children, a textual
|
|
5661
|
+
representation, and the transformed slice (which can be
|
|
5662
|
+
different from the given input due to hooks like
|
|
5663
|
+
[`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).
|
|
5664
|
+
*/
|
|
5665
|
+
serializeForClipboard(slice) {
|
|
5666
|
+
return serializeForClipboard(this, slice);
|
|
5667
|
+
}
|
|
5668
|
+
/**
|
|
5663
5669
|
Removes the editor from the DOM and destroys all [node
|
|
5664
5670
|
views](https://prosemirror.net/docs/ref/#view.NodeView).
|
|
5665
5671
|
*/
|
|
@@ -5793,4 +5799,4 @@ function checkStateComponent(plugin) {
|
|
|
5793
5799
|
throw new RangeError("Plugins passed directly to the view must not have a state component");
|
|
5794
5800
|
}
|
|
5795
5801
|
|
|
5796
|
-
export { Decoration, DecorationSet, EditorView, __endComposition, __parseFromClipboard
|
|
5802
|
+
export { Decoration, DecorationSet, EditorView, __endComposition, __parseFromClipboard };
|
package/package.json
CHANGED
package/src/domobserver.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -20,8 +20,6 @@ export {NodeView, MarkView, ViewMutationRecord} from "./viewdesc"
|
|
|
20
20
|
import {serializeForClipboard, parseFromClipboard} from "./clipboard"
|
|
21
21
|
import {endComposition} from "./input"
|
|
22
22
|
/// @internal
|
|
23
|
-
export const __serializeForClipboard = serializeForClipboard
|
|
24
|
-
/// @internal
|
|
25
23
|
export const __parseFromClipboard = parseFromClipboard
|
|
26
24
|
/// @internal
|
|
27
25
|
export const __endComposition = endComposition
|
|
@@ -446,6 +444,16 @@ export class EditorView {
|
|
|
446
444
|
return doPaste(this, text, null, true, event || new ClipboardEvent("paste"))
|
|
447
445
|
}
|
|
448
446
|
|
|
447
|
+
/// Serialize the given slice as it would be if it was copied from
|
|
448
|
+
/// this editor. Returns a DOM element that contains a
|
|
449
|
+
/// representation of the slice as its children, a textual
|
|
450
|
+
/// representation, and the transformed slice (which can be
|
|
451
|
+
/// different from the given input due to hooks like
|
|
452
|
+
/// [`transformCopied`](#view.EditorProps.transformCopied)).
|
|
453
|
+
serializeForClipboard(slice: Slice): {dom: HTMLElement, text: string, slice: Slice} {
|
|
454
|
+
return serializeForClipboard(this, slice)
|
|
455
|
+
}
|
|
456
|
+
|
|
449
457
|
/// Removes the editor from the DOM and destroys all [node
|
|
450
458
|
/// views](#view.NodeView).
|
|
451
459
|
destroy() {
|