slate-react 0.72.0 → 0.72.1-202111818248

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.
@@ -8,7 +8,7 @@ export interface ReactEditor extends BaseEditor {
8
8
  insertData: (data: DataTransfer) => void;
9
9
  insertFragmentData: (data: DataTransfer) => boolean;
10
10
  insertTextData: (data: DataTransfer) => boolean;
11
- setFragmentData: (data: DataTransfer) => void;
11
+ setFragmentData: (data: DataTransfer, originEvent?: 'drag' | 'copy' | 'cut') => void;
12
12
  hasRange: (editor: ReactEditor, range: Range) => boolean;
13
13
  }
14
14
  export declare const ReactEditor: {
@@ -69,7 +69,7 @@ export declare const ReactEditor: {
69
69
  /**
70
70
  * Sets data from the currently selected fragment on a `DataTransfer`.
71
71
  */
72
- setFragmentData(editor: ReactEditor, data: DataTransfer): void;
72
+ setFragmentData(editor: ReactEditor, data: DataTransfer, originEvent?: "drag" | "copy" | "cut" | undefined): void;
73
73
  /**
74
74
  * Find the native DOM element from a Slate node.
75
75
  */
@@ -1 +1 @@
1
- {"version":3,"file":"react-editor.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/plugin/react-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAc,UAAU,EAAE,MAAM,OAAO,CAAA;AAEhF,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAYlC,OAAO,EAEL,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,cAAc,EAKf,MAAM,cAAc,CAAA;AAGrB;;GAEG;AAEH,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,UAAU,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAA;IACxC,kBAAkB,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAA;IACnD,cAAc,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAA;IAC/C,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G,IAAI;IAenC;;OAEG;uBAGO,WAAW,UACX,OAAO,YACN;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAC9B,OAAO;IAoCV;;OAEG;uBAEgB,WAAW,QAAQ,YAAY,GAAG,IAAI;IAIzD;;OAEG;+BAEwB,WAAW,QAAQ,YAAY,GAAG,OAAO;IAIpE;;OAEG;2BAEoB,WAAW,QAAQ,YAAY,GAAG,OAAO;IAIhE;;OAEG;4BAGO,WAAW,QACb,YAAY,sDAEjB,IAAI;IAIP;;OAEG;sBAEe,WAAW,QAAQ,IAAI,GAAG,WAAW;IAevD;;OAEG;uBAEgB,WAAW,SAAS,KAAK;IAgD5C;;;;;;;OAOG;uBAEgB,WAAW,SAAS,KAAK,GAAG,QAAQ;IA8BvD;;OAEG;wBAEiB,WAAW,WAAW,OAAO,GAAG,IAAI;IAgBxD;;OAEG;2BAEoB,WAAW,SAAS,GAAG,GAAG,KAAK;IAiEtD;;OAEG;4CAGO,WAAW;;;;IAuGrB;;OAEG;8CAGO,WAAW,YACT,QAAQ,GAAG,cAAc,GAAG,YAAY;;;;;;qBAyFnC,WAAW,SAAS,KAAK,GAAG,OAAO;CAMrD,CAAA"}
@@ -2766,13 +2766,13 @@
2766
2766
  onCopy: React.useCallback(function (event) {
2767
2767
  if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCopy)) {
2768
2768
  event.preventDefault();
2769
- ReactEditor.setFragmentData(editor, event.clipboardData);
2769
+ ReactEditor.setFragmentData(editor, event.clipboardData, 'copy');
2770
2770
  }
2771
2771
  }, [attributes.onCopy]),
2772
2772
  onCut: React.useCallback(function (event) {
2773
2773
  if (!readOnly && hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCut)) {
2774
2774
  event.preventDefault();
2775
- ReactEditor.setFragmentData(editor, event.clipboardData);
2775
+ ReactEditor.setFragmentData(editor, event.clipboardData, 'cut');
2776
2776
  var selection = editor.selection;
2777
2777
 
2778
2778
  if (selection) {
@@ -2816,7 +2816,7 @@
2816
2816
  }
2817
2817
 
2818
2818
  state.isDraggingInternally = true;
2819
- ReactEditor.setFragmentData(editor, event.dataTransfer);
2819
+ ReactEditor.setFragmentData(editor, event.dataTransfer, 'drag');
2820
2820
  }
2821
2821
  }, [readOnly, attributes.onDragStart]),
2822
2822
  onDrop: React.useCallback(function (event) {
@@ -3517,8 +3517,8 @@
3517
3517
  /**
3518
3518
  * Sets data from the currently selected fragment on a `DataTransfer`.
3519
3519
  */
3520
- setFragmentData: function setFragmentData(editor, data) {
3521
- editor.setFragmentData(data);
3520
+ setFragmentData: function setFragmentData(editor, data, originEvent) {
3521
+ editor.setFragmentData(data, originEvent);
3522
3522
  },
3523
3523
 
3524
3524
  /**
@@ -4845,13 +4845,13 @@
4845
4845
  onCopy: React.useCallback(function (event) {
4846
4846
  if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCopy)) {
4847
4847
  event.preventDefault();
4848
- ReactEditor.setFragmentData(editor, event.clipboardData);
4848
+ ReactEditor.setFragmentData(editor, event.clipboardData, 'copy');
4849
4849
  }
4850
4850
  }, [attributes.onCopy]),
4851
4851
  onCut: React.useCallback(function (event) {
4852
4852
  if (!readOnly && hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCut)) {
4853
4853
  event.preventDefault();
4854
- ReactEditor.setFragmentData(editor, event.clipboardData);
4854
+ ReactEditor.setFragmentData(editor, event.clipboardData, 'cut');
4855
4855
  var selection = editor.selection;
4856
4856
 
4857
4857
  if (selection) {