dn-react-text-editor 0.3.5 → 0.3.6

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/dist/index.js CHANGED
@@ -1087,8 +1087,8 @@ var TextEditorController = class {
1087
1087
  this.view?.destroy();
1088
1088
  }
1089
1089
  };
1090
- var configTextEditorController = (options = {} = {}) => {
1091
- return (props) => new TextEditorController({
1090
+ var configTextEditorController = (options = {}) => {
1091
+ return (props = {}) => new TextEditorController({
1092
1092
  ...props,
1093
1093
  className: props.className || options.className,
1094
1094
  style: props.style || options.style,
@@ -1098,7 +1098,6 @@ var configTextEditorController = (options = {} = {}) => {
1098
1098
 
1099
1099
  // src/text_editor.tsx
1100
1100
  function TextEditor({
1101
- controller: externalController,
1102
1101
  ref,
1103
1102
  name,
1104
1103
  className,
@@ -1115,7 +1114,7 @@ function TextEditor({
1115
1114
  ...props
1116
1115
  } = {}) {
1117
1116
  const containerRef = (0, import_react3.useRef)(null);
1118
- const innerController = (0, import_react2.useMemo)(
1117
+ const controller = (0, import_react2.useMemo)(
1119
1118
  () => new TextEditorController({
1120
1119
  mode,
1121
1120
  state,
@@ -1129,7 +1128,6 @@ function TextEditor({
1129
1128
  }),
1130
1129
  []
1131
1130
  );
1132
- const controller = externalController || innerController;
1133
1131
  (0, import_react2.useImperativeHandle)(ref, () => controller, [controller]);
1134
1132
  (0, import_react3.useEffect)(() => {
1135
1133
  const container = containerRef.current;
package/dist/index.mjs CHANGED
@@ -1052,8 +1052,8 @@ var TextEditorController = class {
1052
1052
  this.view?.destroy();
1053
1053
  }
1054
1054
  };
1055
- var configTextEditorController = (options = {} = {}) => {
1056
- return (props) => new TextEditorController({
1055
+ var configTextEditorController = (options = {}) => {
1056
+ return (props = {}) => new TextEditorController({
1057
1057
  ...props,
1058
1058
  className: props.className || options.className,
1059
1059
  style: props.style || options.style,
@@ -1063,7 +1063,6 @@ var configTextEditorController = (options = {} = {}) => {
1063
1063
 
1064
1064
  // src/text_editor.tsx
1065
1065
  function TextEditor({
1066
- controller: externalController,
1067
1066
  ref,
1068
1067
  name,
1069
1068
  className,
@@ -1080,7 +1079,7 @@ function TextEditor({
1080
1079
  ...props
1081
1080
  } = {}) {
1082
1081
  const containerRef = useRef(null);
1083
- const innerController = useMemo(
1082
+ const controller = useMemo(
1084
1083
  () => new TextEditorController({
1085
1084
  mode,
1086
1085
  state,
@@ -1094,7 +1093,6 @@ function TextEditor({
1094
1093
  }),
1095
1094
  []
1096
1095
  );
1097
- const controller = externalController || innerController;
1098
1096
  useImperativeHandle(ref, () => controller, [controller]);
1099
1097
  useEffect2(() => {
1100
1098
  const container = containerRef.current;
@@ -10,10 +10,9 @@ import 'rxjs';
10
10
 
11
11
  type HTMLElementProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
12
12
  type TextEditorProps = Omit<HTMLElementProps, "ref"> & {
13
- controller?: TextEditorController;
14
13
  name?: string;
15
14
  ref?: Ref<TextEditorController>;
16
15
  } & TextEditorControllerProps;
17
- declare function TextEditor({ controller: externalController, ref, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps): React.JSX.Element;
16
+ declare function TextEditor({ ref, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps): React.JSX.Element;
18
17
 
19
18
  export { TextEditor, type TextEditorProps };
@@ -10,10 +10,9 @@ import 'rxjs';
10
10
 
11
11
  type HTMLElementProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
12
12
  type TextEditorProps = Omit<HTMLElementProps, "ref"> & {
13
- controller?: TextEditorController;
14
13
  name?: string;
15
14
  ref?: Ref<TextEditorController>;
16
15
  } & TextEditorControllerProps;
17
- declare function TextEditor({ controller: externalController, ref, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps): React.JSX.Element;
16
+ declare function TextEditor({ ref, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps): React.JSX.Element;
18
17
 
19
18
  export { TextEditor, type TextEditorProps };
@@ -1082,7 +1082,6 @@ var TextEditorController = class {
1082
1082
 
1083
1083
  // src/text_editor.tsx
1084
1084
  function TextEditor({
1085
- controller: externalController,
1086
1085
  ref,
1087
1086
  name,
1088
1087
  className,
@@ -1099,7 +1098,7 @@ function TextEditor({
1099
1098
  ...props
1100
1099
  } = {}) {
1101
1100
  const containerRef = (0, import_react3.useRef)(null);
1102
- const innerController = (0, import_react2.useMemo)(
1101
+ const controller = (0, import_react2.useMemo)(
1103
1102
  () => new TextEditorController({
1104
1103
  mode,
1105
1104
  state,
@@ -1113,7 +1112,6 @@ function TextEditor({
1113
1112
  }),
1114
1113
  []
1115
1114
  );
1116
- const controller = externalController || innerController;
1117
1115
  (0, import_react2.useImperativeHandle)(ref, () => controller, [controller]);
1118
1116
  (0, import_react3.useEffect)(() => {
1119
1117
  const container = containerRef.current;
@@ -1055,7 +1055,6 @@ var TextEditorController = class {
1055
1055
 
1056
1056
  // src/text_editor.tsx
1057
1057
  function TextEditor({
1058
- controller: externalController,
1059
1058
  ref,
1060
1059
  name,
1061
1060
  className,
@@ -1072,7 +1071,7 @@ function TextEditor({
1072
1071
  ...props
1073
1072
  } = {}) {
1074
1073
  const containerRef = useRef(null);
1075
- const innerController = useMemo(
1074
+ const controller = useMemo(
1076
1075
  () => new TextEditorController({
1077
1076
  mode,
1078
1077
  state,
@@ -1086,7 +1085,6 @@ function TextEditor({
1086
1085
  }),
1087
1086
  []
1088
1087
  );
1089
- const controller = externalController || innerController;
1090
1088
  useImperativeHandle(ref, () => controller, [controller]);
1091
1089
  useEffect2(() => {
1092
1090
  const container = containerRef.current;
@@ -56,6 +56,6 @@ declare class TextEditorController {
56
56
  dispose(): void;
57
57
  }
58
58
  type ConfigTextEditorOptions = Pick<TextEditorControllerProps, "className" | "style" | "attachFile">;
59
- declare const configTextEditorController: (options?: ConfigTextEditorOptions) => (props: TextEditorControllerProps) => TextEditorController;
59
+ declare const configTextEditorController: (options?: ConfigTextEditorOptions) => (props?: TextEditorControllerProps) => TextEditorController;
60
60
 
61
61
  export { type ConfigTextEditorOptions, TextEditorController, type TextEditorControllerProps, configTextEditorController };
@@ -56,6 +56,6 @@ declare class TextEditorController {
56
56
  dispose(): void;
57
57
  }
58
58
  type ConfigTextEditorOptions = Pick<TextEditorControllerProps, "className" | "style" | "attachFile">;
59
- declare const configTextEditorController: (options?: ConfigTextEditorOptions) => (props: TextEditorControllerProps) => TextEditorController;
59
+ declare const configTextEditorController: (options?: ConfigTextEditorOptions) => (props?: TextEditorControllerProps) => TextEditorController;
60
60
 
61
61
  export { type ConfigTextEditorOptions, TextEditorController, type TextEditorControllerProps, configTextEditorController };
@@ -1044,8 +1044,8 @@ var TextEditorController = class {
1044
1044
  this.view?.destroy();
1045
1045
  }
1046
1046
  };
1047
- var configTextEditorController = (options = {} = {}) => {
1048
- return (props) => new TextEditorController({
1047
+ var configTextEditorController = (options = {}) => {
1048
+ return (props = {}) => new TextEditorController({
1049
1049
  ...props,
1050
1050
  className: props.className || options.className,
1051
1051
  style: props.style || options.style,
@@ -1011,8 +1011,8 @@ var TextEditorController = class {
1011
1011
  this.view?.destroy();
1012
1012
  }
1013
1013
  };
1014
- var configTextEditorController = (options = {} = {}) => {
1015
- return (props) => new TextEditorController({
1014
+ var configTextEditorController = (options = {}) => {
1015
+ return (props = {}) => new TextEditorController({
1016
1016
  ...props,
1017
1017
  className: props.className || options.className,
1018
1018
  style: props.style || options.style,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dn-react-text-editor",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.js",