dn-react-text-editor 0.3.3 → 0.3.4

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.
@@ -17,6 +17,8 @@ declare const createCommands: (schema: Schema, view: EditorView, options?: {
17
17
  }) => void;
18
18
  wrapInList: (listType: string, attrs?: Attrs | null) => void;
19
19
  clear: () => void;
20
+ undo: () => void;
21
+ redo: () => void;
20
22
  attachFile: (files: File[]) => void;
21
23
  };
22
24
 
@@ -17,6 +17,8 @@ declare const createCommands: (schema: Schema, view: EditorView, options?: {
17
17
  }) => void;
18
18
  wrapInList: (listType: string, attrs?: Attrs | null) => void;
19
19
  clear: () => void;
20
+ undo: () => void;
21
+ redo: () => void;
20
22
  attachFile: (files: File[]) => void;
21
23
  };
22
24
 
package/dist/commands.js CHANGED
@@ -35,6 +35,7 @@ __export(commands_exports, {
35
35
  module.exports = __toCommonJS(commands_exports);
36
36
  var commands = __toESM(require("prosemirror-commands"));
37
37
  var schemaList = __toESM(require("prosemirror-schema-list"));
38
+ var history = __toESM(require("prosemirror-history"));
38
39
  var createCommands = (schema, view, options = {}) => {
39
40
  {
40
41
  const isBlockTypeActive = (node, attrs, excludes = []) => {
@@ -91,6 +92,14 @@ var createCommands = (schema, view, options = {}) => {
91
92
  );
92
93
  view.dispatch(tr);
93
94
  };
95
+ const undo2 = () => {
96
+ view.focus();
97
+ history.undo(view.state, view.dispatch);
98
+ };
99
+ const redo2 = () => {
100
+ view.focus();
101
+ history.redo(view.state, view.dispatch);
102
+ };
94
103
  return {
95
104
  isBlockTypeActive,
96
105
  setBlockType: setBlockType2,
@@ -98,6 +107,8 @@ var createCommands = (schema, view, options = {}) => {
98
107
  toggleMark: toggleMark2,
99
108
  wrapInList: wrapInList2,
100
109
  clear,
110
+ undo: undo2,
111
+ redo: redo2,
101
112
  attachFile: (files) => {
102
113
  options.attachFile?.(view, files);
103
114
  }
package/dist/commands.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  // src/commands.tsx
2
2
  import * as commands from "prosemirror-commands";
3
3
  import * as schemaList from "prosemirror-schema-list";
4
+ import * as history from "prosemirror-history";
4
5
  var createCommands = (schema, view, options = {}) => {
5
6
  {
6
7
  const isBlockTypeActive = (node, attrs, excludes = []) => {
@@ -57,6 +58,14 @@ var createCommands = (schema, view, options = {}) => {
57
58
  );
58
59
  view.dispatch(tr);
59
60
  };
61
+ const undo2 = () => {
62
+ view.focus();
63
+ history.undo(view.state, view.dispatch);
64
+ };
65
+ const redo2 = () => {
66
+ view.focus();
67
+ history.redo(view.state, view.dispatch);
68
+ };
60
69
  return {
61
70
  isBlockTypeActive,
62
71
  setBlockType: setBlockType2,
@@ -64,6 +73,8 @@ var createCommands = (schema, view, options = {}) => {
64
73
  toggleMark: toggleMark2,
65
74
  wrapInList: wrapInList2,
66
75
  clear,
76
+ undo: undo2,
77
+ redo: redo2,
67
78
  attachFile: (files) => {
68
79
  options.attachFile?.(view, files);
69
80
  }
package/dist/index.js CHANGED
@@ -877,6 +877,7 @@ function createAttachFile({
877
877
  // src/commands.tsx
878
878
  var commands = __toESM(require("prosemirror-commands"));
879
879
  var schemaList = __toESM(require("prosemirror-schema-list"));
880
+ var history = __toESM(require("prosemirror-history"));
880
881
  var createCommands = (schema, view, options = {}) => {
881
882
  {
882
883
  const isBlockTypeActive = (node, attrs, excludes = []) => {
@@ -933,6 +934,14 @@ var createCommands = (schema, view, options = {}) => {
933
934
  );
934
935
  view.dispatch(tr);
935
936
  };
937
+ const undo3 = () => {
938
+ view.focus();
939
+ history.undo(view.state, view.dispatch);
940
+ };
941
+ const redo3 = () => {
942
+ view.focus();
943
+ history.redo(view.state, view.dispatch);
944
+ };
936
945
  return {
937
946
  isBlockTypeActive,
938
947
  setBlockType: setBlockType2,
@@ -940,6 +949,8 @@ var createCommands = (schema, view, options = {}) => {
940
949
  toggleMark: toggleMark2,
941
950
  wrapInList: wrapInList2,
942
951
  clear,
952
+ undo: undo3,
953
+ redo: redo3,
943
954
  attachFile: (files) => {
944
955
  options.attachFile?.(view, files);
945
956
  }
@@ -1074,7 +1085,7 @@ var TextEditorController = class {
1074
1085
  this.view?.destroy();
1075
1086
  }
1076
1087
  };
1077
- var configTextEditorController = (options = {}) => {
1088
+ var configTextEditorController = (options = {} = {}) => {
1078
1089
  return (props) => new TextEditorController({
1079
1090
  ...props,
1080
1091
  className: props.className || options.className,
package/dist/index.mjs CHANGED
@@ -173,7 +173,7 @@ function placeholderPlugin(text) {
173
173
  }
174
174
 
175
175
  // src/text_editor_controller.tsx
176
- import { history } from "prosemirror-history";
176
+ import { history as history2 } from "prosemirror-history";
177
177
 
178
178
  // src/plugins/keymap.tsx
179
179
  import { TextSelection } from "prosemirror-state";
@@ -841,6 +841,7 @@ function createAttachFile({
841
841
  // src/commands.tsx
842
842
  import * as commands from "prosemirror-commands";
843
843
  import * as schemaList from "prosemirror-schema-list";
844
+ import * as history from "prosemirror-history";
844
845
  var createCommands = (schema, view, options = {}) => {
845
846
  {
846
847
  const isBlockTypeActive = (node, attrs, excludes = []) => {
@@ -897,6 +898,14 @@ var createCommands = (schema, view, options = {}) => {
897
898
  );
898
899
  view.dispatch(tr);
899
900
  };
901
+ const undo3 = () => {
902
+ view.focus();
903
+ history.undo(view.state, view.dispatch);
904
+ };
905
+ const redo3 = () => {
906
+ view.focus();
907
+ history.redo(view.state, view.dispatch);
908
+ };
900
909
  return {
901
910
  isBlockTypeActive,
902
911
  setBlockType: setBlockType2,
@@ -904,6 +913,8 @@ var createCommands = (schema, view, options = {}) => {
904
913
  toggleMark: toggleMark2,
905
914
  wrapInList: wrapInList2,
906
915
  clear,
916
+ undo: undo3,
917
+ redo: redo3,
907
918
  attachFile: (files) => {
908
919
  options.attachFile?.(view, files);
909
920
  }
@@ -986,7 +997,7 @@ var TextEditorController = class {
986
997
  doc: this.props.state?.doc || this.prosemirrorParser.parse(wrapper),
987
998
  plugins: [
988
999
  ...this.props.state?.plugins || [],
989
- history({
1000
+ history2({
990
1001
  newGroupDelay: this.props.updateDelay
991
1002
  }),
992
1003
  keymap(buildKeymap(this.schema)),
@@ -1038,7 +1049,7 @@ var TextEditorController = class {
1038
1049
  this.view?.destroy();
1039
1050
  }
1040
1051
  };
1041
- var configTextEditorController = (options = {}) => {
1052
+ var configTextEditorController = (options = {} = {}) => {
1042
1053
  return (props) => new TextEditorController({
1043
1054
  ...props,
1044
1055
  className: props.className || options.className,
@@ -869,6 +869,7 @@ function createAttachFile({
869
869
  // src/commands.tsx
870
870
  var commands = __toESM(require("prosemirror-commands"));
871
871
  var schemaList = __toESM(require("prosemirror-schema-list"));
872
+ var history = __toESM(require("prosemirror-history"));
872
873
  var createCommands = (schema, view, options = {}) => {
873
874
  {
874
875
  const isBlockTypeActive = (node, attrs, excludes = []) => {
@@ -925,6 +926,14 @@ var createCommands = (schema, view, options = {}) => {
925
926
  );
926
927
  view.dispatch(tr);
927
928
  };
929
+ const undo3 = () => {
930
+ view.focus();
931
+ history.undo(view.state, view.dispatch);
932
+ };
933
+ const redo3 = () => {
934
+ view.focus();
935
+ history.redo(view.state, view.dispatch);
936
+ };
928
937
  return {
929
938
  isBlockTypeActive,
930
939
  setBlockType: setBlockType2,
@@ -932,6 +941,8 @@ var createCommands = (schema, view, options = {}) => {
932
941
  toggleMark: toggleMark2,
933
942
  wrapInList: wrapInList2,
934
943
  clear,
944
+ undo: undo3,
945
+ redo: redo3,
935
946
  attachFile: (files) => {
936
947
  options.attachFile?.(view, files);
937
948
  }
@@ -173,7 +173,7 @@ function placeholderPlugin(text) {
173
173
  }
174
174
 
175
175
  // src/text_editor_controller.tsx
176
- import { history } from "prosemirror-history";
176
+ import { history as history2 } from "prosemirror-history";
177
177
 
178
178
  // src/plugins/keymap.tsx
179
179
  import { TextSelection } from "prosemirror-state";
@@ -841,6 +841,7 @@ function createAttachFile({
841
841
  // src/commands.tsx
842
842
  import * as commands from "prosemirror-commands";
843
843
  import * as schemaList from "prosemirror-schema-list";
844
+ import * as history from "prosemirror-history";
844
845
  var createCommands = (schema, view, options = {}) => {
845
846
  {
846
847
  const isBlockTypeActive = (node, attrs, excludes = []) => {
@@ -897,6 +898,14 @@ var createCommands = (schema, view, options = {}) => {
897
898
  );
898
899
  view.dispatch(tr);
899
900
  };
901
+ const undo3 = () => {
902
+ view.focus();
903
+ history.undo(view.state, view.dispatch);
904
+ };
905
+ const redo3 = () => {
906
+ view.focus();
907
+ history.redo(view.state, view.dispatch);
908
+ };
900
909
  return {
901
910
  isBlockTypeActive,
902
911
  setBlockType: setBlockType2,
@@ -904,6 +913,8 @@ var createCommands = (schema, view, options = {}) => {
904
913
  toggleMark: toggleMark2,
905
914
  wrapInList: wrapInList2,
906
915
  clear,
916
+ undo: undo3,
917
+ redo: redo3,
907
918
  attachFile: (files) => {
908
919
  options.attachFile?.(view, files);
909
920
  }
@@ -986,7 +997,7 @@ var TextEditorController = class {
986
997
  doc: this.props.state?.doc || this.prosemirrorParser.parse(wrapper),
987
998
  plugins: [
988
999
  ...this.props.state?.plugins || [],
989
- history({
1000
+ history2({
990
1001
  newGroupDelay: this.props.updateDelay
991
1002
  }),
992
1003
  keymap(buildKeymap(this.schema)),
@@ -48,6 +48,8 @@ declare class TextEditorController {
48
48
  }) => void;
49
49
  wrapInList: (listType: string, attrs?: prosemirror_model.Attrs | null) => void;
50
50
  clear: () => void;
51
+ undo: () => void;
52
+ redo: () => void;
51
53
  attachFile: (files: File[]) => void;
52
54
  };
53
55
  dispose(): void;
@@ -48,6 +48,8 @@ declare class TextEditorController {
48
48
  }) => void;
49
49
  wrapInList: (listType: string, attrs?: prosemirror_model.Attrs | null) => void;
50
50
  clear: () => void;
51
+ undo: () => void;
52
+ redo: () => void;
51
53
  attachFile: (files: File[]) => void;
52
54
  };
53
55
  dispose(): void;
@@ -834,6 +834,7 @@ function createAttachFile({
834
834
  // src/commands.tsx
835
835
  var commands = __toESM(require("prosemirror-commands"));
836
836
  var schemaList = __toESM(require("prosemirror-schema-list"));
837
+ var history = __toESM(require("prosemirror-history"));
837
838
  var createCommands = (schema, view, options = {}) => {
838
839
  {
839
840
  const isBlockTypeActive = (node, attrs, excludes = []) => {
@@ -890,6 +891,14 @@ var createCommands = (schema, view, options = {}) => {
890
891
  );
891
892
  view.dispatch(tr);
892
893
  };
894
+ const undo3 = () => {
895
+ view.focus();
896
+ history.undo(view.state, view.dispatch);
897
+ };
898
+ const redo3 = () => {
899
+ view.focus();
900
+ history.redo(view.state, view.dispatch);
901
+ };
893
902
  return {
894
903
  isBlockTypeActive,
895
904
  setBlockType: setBlockType2,
@@ -897,6 +906,8 @@ var createCommands = (schema, view, options = {}) => {
897
906
  toggleMark: toggleMark2,
898
907
  wrapInList: wrapInList2,
899
908
  clear,
909
+ undo: undo3,
910
+ redo: redo3,
900
911
  attachFile: (files) => {
901
912
  options.attachFile?.(view, files);
902
913
  }
@@ -1031,7 +1042,7 @@ var TextEditorController = class {
1031
1042
  this.view?.destroy();
1032
1043
  }
1033
1044
  };
1034
- var configTextEditorController = (options = {}) => {
1045
+ var configTextEditorController = (options = {} = {}) => {
1035
1046
  return (props) => new TextEditorController({
1036
1047
  ...props,
1037
1048
  className: props.className || options.className,
@@ -133,7 +133,7 @@ function placeholderPlugin(text) {
133
133
  }
134
134
 
135
135
  // src/text_editor_controller.tsx
136
- import { history } from "prosemirror-history";
136
+ import { history as history2 } from "prosemirror-history";
137
137
 
138
138
  // src/plugins/keymap.tsx
139
139
  import { TextSelection } from "prosemirror-state";
@@ -801,6 +801,7 @@ function createAttachFile({
801
801
  // src/commands.tsx
802
802
  import * as commands from "prosemirror-commands";
803
803
  import * as schemaList from "prosemirror-schema-list";
804
+ import * as history from "prosemirror-history";
804
805
  var createCommands = (schema, view, options = {}) => {
805
806
  {
806
807
  const isBlockTypeActive = (node, attrs, excludes = []) => {
@@ -857,6 +858,14 @@ var createCommands = (schema, view, options = {}) => {
857
858
  );
858
859
  view.dispatch(tr);
859
860
  };
861
+ const undo3 = () => {
862
+ view.focus();
863
+ history.undo(view.state, view.dispatch);
864
+ };
865
+ const redo3 = () => {
866
+ view.focus();
867
+ history.redo(view.state, view.dispatch);
868
+ };
860
869
  return {
861
870
  isBlockTypeActive,
862
871
  setBlockType: setBlockType2,
@@ -864,6 +873,8 @@ var createCommands = (schema, view, options = {}) => {
864
873
  toggleMark: toggleMark2,
865
874
  wrapInList: wrapInList2,
866
875
  clear,
876
+ undo: undo3,
877
+ redo: redo3,
867
878
  attachFile: (files) => {
868
879
  options.attachFile?.(view, files);
869
880
  }
@@ -946,7 +957,7 @@ var TextEditorController = class {
946
957
  doc: this.props.state?.doc || this.prosemirrorParser.parse(wrapper),
947
958
  plugins: [
948
959
  ...this.props.state?.plugins || [],
949
- history({
960
+ history2({
950
961
  newGroupDelay: this.props.updateDelay
951
962
  }),
952
963
  keymap(buildKeymap(this.schema)),
@@ -998,7 +1009,7 @@ var TextEditorController = class {
998
1009
  this.view?.destroy();
999
1010
  }
1000
1011
  };
1001
- var configTextEditorController = (options = {}) => {
1012
+ var configTextEditorController = (options = {} = {}) => {
1002
1013
  return (props) => new TextEditorController({
1003
1014
  ...props,
1004
1015
  className: props.className || options.className,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dn-react-text-editor",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.js",