dn-react-text-editor 0.3.1 → 0.3.3

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/README.md CHANGED
@@ -7,8 +7,6 @@ A rich text editor component for React built on ProseMirror.
7
7
  ```tsx
8
8
  import { TextEditor } from "dn-react-text-editor";
9
9
 
10
- const TextEditor = useTextEditor();
11
-
12
10
  function App() {
13
11
  return (
14
12
  <TextEditor
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- export { TextEditorProps, createTextEditor } from './create_text_editor.mjs';
1
+ export { TextEditor, TextEditorProps } from './text_editor.mjs';
2
2
  export { createSchema } from './schema.mjs';
3
3
  export { AttachFile, AttachFileOptions, GenerateMetadata, UploadFile, createAttachFile } from './attach_file.mjs';
4
4
  export { createInnerHTML, createTextEditorView } from './html.mjs';
5
- export { TextEditorController, TextEditorControllerProps } from './text_editor_controller.mjs';
5
+ export { ConfigTextEditorOptions, TextEditorController, TextEditorControllerProps, configTextEditorController } from './text_editor_controller.mjs';
6
6
  import 'react';
7
7
  import 'orderedmap';
8
8
  import 'prosemirror-model';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export { TextEditorProps, createTextEditor } from './create_text_editor.js';
1
+ export { TextEditor, TextEditorProps } from './text_editor.js';
2
2
  export { createSchema } from './schema.js';
3
3
  export { AttachFile, AttachFileOptions, GenerateMetadata, UploadFile, createAttachFile } from './attach_file.js';
4
4
  export { createInnerHTML, createTextEditorView } from './html.js';
5
- export { TextEditorController, TextEditorControllerProps } from './text_editor_controller.js';
5
+ export { ConfigTextEditorOptions, TextEditorController, TextEditorControllerProps, configTextEditorController } from './text_editor_controller.js';
6
6
  import 'react';
7
7
  import 'orderedmap';
8
8
  import 'prosemirror-model';
package/dist/index.js CHANGED
@@ -30,16 +30,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ TextEditor: () => TextEditor,
33
34
  TextEditorController: () => TextEditorController,
35
+ configTextEditorController: () => configTextEditorController,
34
36
  createAttachFile: () => createAttachFile,
35
37
  createInnerHTML: () => createInnerHTML,
36
38
  createSchema: () => createSchema,
37
- createTextEditor: () => createTextEditor,
38
39
  createTextEditorView: () => createTextEditorView
39
40
  });
40
41
  module.exports = __toCommonJS(index_exports);
41
42
 
42
- // src/create_text_editor.tsx
43
+ // src/text_editor.tsx
43
44
  var import_react2 = __toESM(require("react"));
44
45
  var import_react3 = require("react");
45
46
 
@@ -1010,7 +1011,7 @@ var TextEditorController = class {
1010
1011
  })();
1011
1012
  return {
1012
1013
  ...propsAttributes,
1013
- class: cn(this.props?.className, propsAttributes?.class),
1014
+ class: cn(this.props.className, propsAttributes?.class),
1014
1015
  spellcheck: propsAttributes?.spellcheck || "false",
1015
1016
  style: this.props.style || "width: 100%; height: inherit; outline: none;"
1016
1017
  };
@@ -1073,60 +1074,66 @@ var TextEditorController = class {
1073
1074
  this.view?.destroy();
1074
1075
  }
1075
1076
  };
1077
+ var configTextEditorController = (options = {}) => {
1078
+ return (props) => new TextEditorController({
1079
+ ...props,
1080
+ className: props.className || options.className,
1081
+ style: props.style || options.style,
1082
+ attachFile: props.attachFile || options.attachFile
1083
+ });
1084
+ };
1076
1085
 
1077
- // src/create_text_editor.tsx
1078
- function createTextEditor(options = {}) {
1079
- function Component({
1080
- controller: externalController,
1081
- name,
1082
- className,
1083
- autoFocus,
1084
- onChange,
1085
- mode,
1086
- state,
1087
- editor,
1088
- defaultValue,
1089
- updateDelay,
1090
- placeholder,
1091
- ...props
1092
- } = {}) {
1093
- const containerRef = (0, import_react3.useRef)(null);
1094
- const innerController = (0, import_react2.useMemo)(
1095
- () => new TextEditorController({
1096
- mode,
1097
- state,
1098
- editor,
1099
- autoFocus,
1100
- placeholder,
1101
- updateDelay,
1102
- defaultValue,
1103
- className: options.className,
1104
- style: options.style,
1105
- attachFile: options.attachFile
1106
- }),
1107
- []
1108
- );
1109
- const controller = externalController || innerController;
1110
- (0, import_react3.useEffect)(() => {
1111
- const container = containerRef.current;
1112
- if (!container) {
1113
- return;
1114
- }
1115
- controller.bind(container);
1116
- return () => {
1117
- controller.dispose();
1118
- };
1119
- }, [controller]);
1120
- return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { ...props, ref: containerRef, className }), /* @__PURE__ */ import_react2.default.createElement(
1121
- TextEditorInput,
1122
- {
1123
- name,
1124
- controller,
1125
- onChange
1126
- }
1127
- ));
1128
- }
1129
- return Component;
1086
+ // src/text_editor.tsx
1087
+ function TextEditor({
1088
+ controller: externalController,
1089
+ name,
1090
+ className,
1091
+ autoFocus,
1092
+ onChange,
1093
+ mode,
1094
+ state,
1095
+ editor,
1096
+ defaultValue,
1097
+ updateDelay,
1098
+ placeholder,
1099
+ attachFile,
1100
+ style,
1101
+ ...props
1102
+ } = {}) {
1103
+ const containerRef = (0, import_react3.useRef)(null);
1104
+ const innerController = (0, import_react2.useMemo)(
1105
+ () => new TextEditorController({
1106
+ mode,
1107
+ state,
1108
+ editor,
1109
+ autoFocus,
1110
+ placeholder,
1111
+ updateDelay,
1112
+ defaultValue,
1113
+ attachFile,
1114
+ style
1115
+ }),
1116
+ []
1117
+ );
1118
+ const controller = externalController || innerController;
1119
+ (0, import_react3.useEffect)(() => {
1120
+ const container = containerRef.current;
1121
+ if (!container) {
1122
+ return;
1123
+ }
1124
+ controller.bind(container);
1125
+ return () => {
1126
+ controller.dispose();
1127
+ };
1128
+ }, [controller]);
1129
+ return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { ...props, ref: containerRef, className }), /* @__PURE__ */ import_react2.default.createElement(
1130
+ TextEditorInput,
1131
+ {
1132
+ name,
1133
+ controller,
1134
+ onChange
1135
+ }
1136
+ ));
1130
1137
  }
1131
1138
 
1132
1139
  // src/html.tsx
@@ -1175,10 +1182,11 @@ function createTextEditorView(options = {}) {
1175
1182
  }
1176
1183
  // Annotate the CommonJS export names for ESM import in node:
1177
1184
  0 && (module.exports = {
1185
+ TextEditor,
1178
1186
  TextEditorController,
1187
+ configTextEditorController,
1179
1188
  createAttachFile,
1180
1189
  createInnerHTML,
1181
1190
  createSchema,
1182
- createTextEditor,
1183
1191
  createTextEditorView
1184
1192
  });
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // src/create_text_editor.tsx
1
+ // src/text_editor.tsx
2
2
  import React2, {
3
3
  useMemo
4
4
  } from "react";
@@ -975,7 +975,7 @@ var TextEditorController = class {
975
975
  })();
976
976
  return {
977
977
  ...propsAttributes,
978
- class: cn(this.props?.className, propsAttributes?.class),
978
+ class: cn(this.props.className, propsAttributes?.class),
979
979
  spellcheck: propsAttributes?.spellcheck || "false",
980
980
  style: this.props.style || "width: 100%; height: inherit; outline: none;"
981
981
  };
@@ -1038,60 +1038,66 @@ var TextEditorController = class {
1038
1038
  this.view?.destroy();
1039
1039
  }
1040
1040
  };
1041
+ var configTextEditorController = (options = {}) => {
1042
+ return (props) => new TextEditorController({
1043
+ ...props,
1044
+ className: props.className || options.className,
1045
+ style: props.style || options.style,
1046
+ attachFile: props.attachFile || options.attachFile
1047
+ });
1048
+ };
1041
1049
 
1042
- // src/create_text_editor.tsx
1043
- function createTextEditor(options = {}) {
1044
- function Component({
1045
- controller: externalController,
1046
- name,
1047
- className,
1048
- autoFocus,
1049
- onChange,
1050
- mode,
1051
- state,
1052
- editor,
1053
- defaultValue,
1054
- updateDelay,
1055
- placeholder,
1056
- ...props
1057
- } = {}) {
1058
- const containerRef = useRef(null);
1059
- const innerController = useMemo(
1060
- () => new TextEditorController({
1061
- mode,
1062
- state,
1063
- editor,
1064
- autoFocus,
1065
- placeholder,
1066
- updateDelay,
1067
- defaultValue,
1068
- className: options.className,
1069
- style: options.style,
1070
- attachFile: options.attachFile
1071
- }),
1072
- []
1073
- );
1074
- const controller = externalController || innerController;
1075
- useEffect2(() => {
1076
- const container = containerRef.current;
1077
- if (!container) {
1078
- return;
1079
- }
1080
- controller.bind(container);
1081
- return () => {
1082
- controller.dispose();
1083
- };
1084
- }, [controller]);
1085
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", { ...props, ref: containerRef, className }), /* @__PURE__ */ React2.createElement(
1086
- TextEditorInput,
1087
- {
1088
- name,
1089
- controller,
1090
- onChange
1091
- }
1092
- ));
1093
- }
1094
- return Component;
1050
+ // src/text_editor.tsx
1051
+ function TextEditor({
1052
+ controller: externalController,
1053
+ name,
1054
+ className,
1055
+ autoFocus,
1056
+ onChange,
1057
+ mode,
1058
+ state,
1059
+ editor,
1060
+ defaultValue,
1061
+ updateDelay,
1062
+ placeholder,
1063
+ attachFile,
1064
+ style,
1065
+ ...props
1066
+ } = {}) {
1067
+ const containerRef = useRef(null);
1068
+ const innerController = useMemo(
1069
+ () => new TextEditorController({
1070
+ mode,
1071
+ state,
1072
+ editor,
1073
+ autoFocus,
1074
+ placeholder,
1075
+ updateDelay,
1076
+ defaultValue,
1077
+ attachFile,
1078
+ style
1079
+ }),
1080
+ []
1081
+ );
1082
+ const controller = externalController || innerController;
1083
+ useEffect2(() => {
1084
+ const container = containerRef.current;
1085
+ if (!container) {
1086
+ return;
1087
+ }
1088
+ controller.bind(container);
1089
+ return () => {
1090
+ controller.dispose();
1091
+ };
1092
+ }, [controller]);
1093
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", { ...props, ref: containerRef, className }), /* @__PURE__ */ React2.createElement(
1094
+ TextEditorInput,
1095
+ {
1096
+ name,
1097
+ controller,
1098
+ onChange
1099
+ }
1100
+ ));
1095
1101
  }
1096
1102
 
1097
1103
  // src/html.tsx
@@ -1139,10 +1145,11 @@ function createTextEditorView(options = {}) {
1139
1145
  };
1140
1146
  }
1141
1147
  export {
1148
+ TextEditor,
1142
1149
  TextEditorController,
1150
+ configTextEditorController,
1143
1151
  createAttachFile,
1144
1152
  createInnerHTML,
1145
1153
  createSchema,
1146
- createTextEditor,
1147
1154
  createTextEditorView
1148
1155
  };
@@ -1,4 +1,4 @@
1
- import { DetailedHTMLProps, InputHTMLAttributes, FC } from 'react';
1
+ import React, { DetailedHTMLProps, InputHTMLAttributes } from 'react';
2
2
  import { TextEditorController, TextEditorControllerProps } from './text_editor_controller.mjs';
3
3
  import 'prosemirror-model';
4
4
  import 'prosemirror-state';
@@ -13,7 +13,6 @@ type TextEditorProps = Omit<HTMLElementProps, "ref"> & {
13
13
  controller?: TextEditorController;
14
14
  name?: string;
15
15
  } & TextEditorControllerProps;
16
- type CreateTextEditorOptions = Pick<TextEditorControllerProps, "className" | "style" | "attachFile">;
17
- declare function createTextEditor(options?: CreateTextEditorOptions): FC<TextEditorProps>;
16
+ declare function TextEditor({ controller: externalController, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps): React.JSX.Element;
18
17
 
19
- export { type TextEditorProps, createTextEditor };
18
+ export { TextEditor, type TextEditorProps };
@@ -1,4 +1,4 @@
1
- import { DetailedHTMLProps, InputHTMLAttributes, FC } from 'react';
1
+ import React, { DetailedHTMLProps, InputHTMLAttributes } from 'react';
2
2
  import { TextEditorController, TextEditorControllerProps } from './text_editor_controller.js';
3
3
  import 'prosemirror-model';
4
4
  import 'prosemirror-state';
@@ -13,7 +13,6 @@ type TextEditorProps = Omit<HTMLElementProps, "ref"> & {
13
13
  controller?: TextEditorController;
14
14
  name?: string;
15
15
  } & TextEditorControllerProps;
16
- type CreateTextEditorOptions = Pick<TextEditorControllerProps, "className" | "style" | "attachFile">;
17
- declare function createTextEditor(options?: CreateTextEditorOptions): FC<TextEditorProps>;
16
+ declare function TextEditor({ controller: externalController, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps): React.JSX.Element;
18
17
 
19
- export { type TextEditorProps, createTextEditor };
18
+ export { TextEditor, type TextEditorProps };
@@ -27,12 +27,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // src/create_text_editor.tsx
31
- var create_text_editor_exports = {};
32
- __export(create_text_editor_exports, {
33
- createTextEditor: () => createTextEditor
30
+ // src/text_editor.tsx
31
+ var text_editor_exports = {};
32
+ __export(text_editor_exports, {
33
+ TextEditor: () => TextEditor
34
34
  });
35
- module.exports = __toCommonJS(create_text_editor_exports);
35
+ module.exports = __toCommonJS(text_editor_exports);
36
36
  var import_react2 = __toESM(require("react"));
37
37
  var import_react3 = require("react");
38
38
 
@@ -1003,7 +1003,7 @@ var TextEditorController = class {
1003
1003
  })();
1004
1004
  return {
1005
1005
  ...propsAttributes,
1006
- class: cn(this.props?.className, propsAttributes?.class),
1006
+ class: cn(this.props.className, propsAttributes?.class),
1007
1007
  spellcheck: propsAttributes?.spellcheck || "false",
1008
1008
  style: this.props.style || "width: 100%; height: inherit; outline: none;"
1009
1009
  };
@@ -1067,61 +1067,59 @@ var TextEditorController = class {
1067
1067
  }
1068
1068
  };
1069
1069
 
1070
- // src/create_text_editor.tsx
1071
- function createTextEditor(options = {}) {
1072
- function Component({
1073
- controller: externalController,
1074
- name,
1075
- className,
1076
- autoFocus,
1077
- onChange,
1078
- mode,
1079
- state,
1080
- editor,
1081
- defaultValue,
1082
- updateDelay,
1083
- placeholder,
1084
- ...props
1085
- } = {}) {
1086
- const containerRef = (0, import_react3.useRef)(null);
1087
- const innerController = (0, import_react2.useMemo)(
1088
- () => new TextEditorController({
1089
- mode,
1090
- state,
1091
- editor,
1092
- autoFocus,
1093
- placeholder,
1094
- updateDelay,
1095
- defaultValue,
1096
- className: options.className,
1097
- style: options.style,
1098
- attachFile: options.attachFile
1099
- }),
1100
- []
1101
- );
1102
- const controller = externalController || innerController;
1103
- (0, import_react3.useEffect)(() => {
1104
- const container = containerRef.current;
1105
- if (!container) {
1106
- return;
1107
- }
1108
- controller.bind(container);
1109
- return () => {
1110
- controller.dispose();
1111
- };
1112
- }, [controller]);
1113
- return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { ...props, ref: containerRef, className }), /* @__PURE__ */ import_react2.default.createElement(
1114
- TextEditorInput,
1115
- {
1116
- name,
1117
- controller,
1118
- onChange
1119
- }
1120
- ));
1121
- }
1122
- return Component;
1070
+ // src/text_editor.tsx
1071
+ function TextEditor({
1072
+ controller: externalController,
1073
+ name,
1074
+ className,
1075
+ autoFocus,
1076
+ onChange,
1077
+ mode,
1078
+ state,
1079
+ editor,
1080
+ defaultValue,
1081
+ updateDelay,
1082
+ placeholder,
1083
+ attachFile,
1084
+ style,
1085
+ ...props
1086
+ } = {}) {
1087
+ const containerRef = (0, import_react3.useRef)(null);
1088
+ const innerController = (0, import_react2.useMemo)(
1089
+ () => new TextEditorController({
1090
+ mode,
1091
+ state,
1092
+ editor,
1093
+ autoFocus,
1094
+ placeholder,
1095
+ updateDelay,
1096
+ defaultValue,
1097
+ attachFile,
1098
+ style
1099
+ }),
1100
+ []
1101
+ );
1102
+ const controller = externalController || innerController;
1103
+ (0, import_react3.useEffect)(() => {
1104
+ const container = containerRef.current;
1105
+ if (!container) {
1106
+ return;
1107
+ }
1108
+ controller.bind(container);
1109
+ return () => {
1110
+ controller.dispose();
1111
+ };
1112
+ }, [controller]);
1113
+ return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { ...props, ref: containerRef, className }), /* @__PURE__ */ import_react2.default.createElement(
1114
+ TextEditorInput,
1115
+ {
1116
+ name,
1117
+ controller,
1118
+ onChange
1119
+ }
1120
+ ));
1123
1121
  }
1124
1122
  // Annotate the CommonJS export names for ESM import in node:
1125
1123
  0 && (module.exports = {
1126
- createTextEditor
1124
+ TextEditor
1127
1125
  });
@@ -1,4 +1,4 @@
1
- // src/create_text_editor.tsx
1
+ // src/text_editor.tsx
2
2
  import React2, {
3
3
  useMemo
4
4
  } from "react";
@@ -975,7 +975,7 @@ var TextEditorController = class {
975
975
  })();
976
976
  return {
977
977
  ...propsAttributes,
978
- class: cn(this.props?.className, propsAttributes?.class),
978
+ class: cn(this.props.className, propsAttributes?.class),
979
979
  spellcheck: propsAttributes?.spellcheck || "false",
980
980
  style: this.props.style || "width: 100%; height: inherit; outline: none;"
981
981
  };
@@ -1039,60 +1039,58 @@ var TextEditorController = class {
1039
1039
  }
1040
1040
  };
1041
1041
 
1042
- // src/create_text_editor.tsx
1043
- function createTextEditor(options = {}) {
1044
- function Component({
1045
- controller: externalController,
1046
- name,
1047
- className,
1048
- autoFocus,
1049
- onChange,
1050
- mode,
1051
- state,
1052
- editor,
1053
- defaultValue,
1054
- updateDelay,
1055
- placeholder,
1056
- ...props
1057
- } = {}) {
1058
- const containerRef = useRef(null);
1059
- const innerController = useMemo(
1060
- () => new TextEditorController({
1061
- mode,
1062
- state,
1063
- editor,
1064
- autoFocus,
1065
- placeholder,
1066
- updateDelay,
1067
- defaultValue,
1068
- className: options.className,
1069
- style: options.style,
1070
- attachFile: options.attachFile
1071
- }),
1072
- []
1073
- );
1074
- const controller = externalController || innerController;
1075
- useEffect2(() => {
1076
- const container = containerRef.current;
1077
- if (!container) {
1078
- return;
1079
- }
1080
- controller.bind(container);
1081
- return () => {
1082
- controller.dispose();
1083
- };
1084
- }, [controller]);
1085
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", { ...props, ref: containerRef, className }), /* @__PURE__ */ React2.createElement(
1086
- TextEditorInput,
1087
- {
1088
- name,
1089
- controller,
1090
- onChange
1091
- }
1092
- ));
1093
- }
1094
- return Component;
1042
+ // src/text_editor.tsx
1043
+ function TextEditor({
1044
+ controller: externalController,
1045
+ name,
1046
+ className,
1047
+ autoFocus,
1048
+ onChange,
1049
+ mode,
1050
+ state,
1051
+ editor,
1052
+ defaultValue,
1053
+ updateDelay,
1054
+ placeholder,
1055
+ attachFile,
1056
+ style,
1057
+ ...props
1058
+ } = {}) {
1059
+ const containerRef = useRef(null);
1060
+ const innerController = useMemo(
1061
+ () => new TextEditorController({
1062
+ mode,
1063
+ state,
1064
+ editor,
1065
+ autoFocus,
1066
+ placeholder,
1067
+ updateDelay,
1068
+ defaultValue,
1069
+ attachFile,
1070
+ style
1071
+ }),
1072
+ []
1073
+ );
1074
+ const controller = externalController || innerController;
1075
+ useEffect2(() => {
1076
+ const container = containerRef.current;
1077
+ if (!container) {
1078
+ return;
1079
+ }
1080
+ controller.bind(container);
1081
+ return () => {
1082
+ controller.dispose();
1083
+ };
1084
+ }, [controller]);
1085
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", { ...props, ref: containerRef, className }), /* @__PURE__ */ React2.createElement(
1086
+ TextEditorInput,
1087
+ {
1088
+ name,
1089
+ controller,
1090
+ onChange
1091
+ }
1092
+ ));
1095
1093
  }
1096
1094
  export {
1097
- createTextEditor
1095
+ TextEditor
1098
1096
  };
@@ -52,5 +52,7 @@ declare class TextEditorController {
52
52
  };
53
53
  dispose(): void;
54
54
  }
55
+ type ConfigTextEditorOptions = Pick<TextEditorControllerProps, "className" | "style" | "attachFile">;
56
+ declare const configTextEditorController: (options?: ConfigTextEditorOptions) => (props: TextEditorControllerProps) => TextEditorController;
55
57
 
56
- export { TextEditorController, type TextEditorControllerProps };
58
+ export { type ConfigTextEditorOptions, TextEditorController, type TextEditorControllerProps, configTextEditorController };
@@ -52,5 +52,7 @@ declare class TextEditorController {
52
52
  };
53
53
  dispose(): void;
54
54
  }
55
+ type ConfigTextEditorOptions = Pick<TextEditorControllerProps, "className" | "style" | "attachFile">;
56
+ declare const configTextEditorController: (options?: ConfigTextEditorOptions) => (props: TextEditorControllerProps) => TextEditorController;
55
57
 
56
- export { TextEditorController, type TextEditorControllerProps };
58
+ export { type ConfigTextEditorOptions, TextEditorController, type TextEditorControllerProps, configTextEditorController };
@@ -30,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/text_editor_controller.tsx
31
31
  var text_editor_controller_exports = {};
32
32
  __export(text_editor_controller_exports, {
33
- TextEditorController: () => TextEditorController
33
+ TextEditorController: () => TextEditorController,
34
+ configTextEditorController: () => configTextEditorController
34
35
  });
35
36
  module.exports = __toCommonJS(text_editor_controller_exports);
36
37
  var import_prosemirror_state5 = require("prosemirror-state");
@@ -967,7 +968,7 @@ var TextEditorController = class {
967
968
  })();
968
969
  return {
969
970
  ...propsAttributes,
970
- class: cn(this.props?.className, propsAttributes?.class),
971
+ class: cn(this.props.className, propsAttributes?.class),
971
972
  spellcheck: propsAttributes?.spellcheck || "false",
972
973
  style: this.props.style || "width: 100%; height: inherit; outline: none;"
973
974
  };
@@ -1030,7 +1031,16 @@ var TextEditorController = class {
1030
1031
  this.view?.destroy();
1031
1032
  }
1032
1033
  };
1034
+ var configTextEditorController = (options = {}) => {
1035
+ return (props) => new TextEditorController({
1036
+ ...props,
1037
+ className: props.className || options.className,
1038
+ style: props.style || options.style,
1039
+ attachFile: props.attachFile || options.attachFile
1040
+ });
1041
+ };
1033
1042
  // Annotate the CommonJS export names for ESM import in node:
1034
1043
  0 && (module.exports = {
1035
- TextEditorController
1044
+ TextEditorController,
1045
+ configTextEditorController
1036
1046
  });
@@ -935,7 +935,7 @@ var TextEditorController = class {
935
935
  })();
936
936
  return {
937
937
  ...propsAttributes,
938
- class: cn(this.props?.className, propsAttributes?.class),
938
+ class: cn(this.props.className, propsAttributes?.class),
939
939
  spellcheck: propsAttributes?.spellcheck || "false",
940
940
  style: this.props.style || "width: 100%; height: inherit; outline: none;"
941
941
  };
@@ -998,6 +998,15 @@ var TextEditorController = class {
998
998
  this.view?.destroy();
999
999
  }
1000
1000
  };
1001
+ var configTextEditorController = (options = {}) => {
1002
+ return (props) => new TextEditorController({
1003
+ ...props,
1004
+ className: props.className || options.className,
1005
+ style: props.style || options.style,
1006
+ attachFile: props.attachFile || options.attachFile
1007
+ });
1008
+ };
1001
1009
  export {
1002
- TextEditorController
1010
+ TextEditorController,
1011
+ configTextEditorController
1003
1012
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dn-react-text-editor",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.js",