dn-react-text-editor 0.2.1 → 0.2.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/dist/create_text_editor.js +27 -23
- package/dist/create_text_editor.mjs +27 -23
- package/dist/index.js +27 -23
- package/dist/index.mjs +27 -23
- package/package.json +1 -1
|
@@ -1048,32 +1048,36 @@ function createTextEditor(options = {}) {
|
|
|
1048
1048
|
} = {}) {
|
|
1049
1049
|
const containerRef = (0, import_react3.useRef)(null);
|
|
1050
1050
|
const controllerRef = (0, import_react3.useRef)(null);
|
|
1051
|
-
(0, import_react2.useImperativeHandle)(
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
container
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1051
|
+
(0, import_react2.useImperativeHandle)(
|
|
1052
|
+
ref || controllerRef,
|
|
1053
|
+
() => {
|
|
1054
|
+
const container = containerRef.current;
|
|
1055
|
+
const textEditorController = createTextEditorController(
|
|
1056
|
+
container,
|
|
1057
|
+
schema,
|
|
1058
|
+
options,
|
|
1059
|
+
{
|
|
1060
|
+
mode,
|
|
1061
|
+
state,
|
|
1062
|
+
editor,
|
|
1063
|
+
defaultValue,
|
|
1064
|
+
updateDelay,
|
|
1065
|
+
placeholder
|
|
1066
|
+
}
|
|
1067
|
+
);
|
|
1068
|
+
controllerRef.current = textEditorController;
|
|
1069
|
+
return textEditorController;
|
|
1070
|
+
},
|
|
1071
|
+
[]
|
|
1072
|
+
);
|
|
1069
1073
|
(0, import_react3.useEffect)(() => {
|
|
1070
|
-
const controller = controllerRef.current;
|
|
1071
|
-
if (!controller) {
|
|
1072
|
-
return;
|
|
1073
|
-
}
|
|
1074
1074
|
if (autoFocus) {
|
|
1075
|
-
|
|
1075
|
+
controllerRef.current?.view.focus();
|
|
1076
1076
|
}
|
|
1077
|
+
return () => {
|
|
1078
|
+
console.log(controllerRef.current);
|
|
1079
|
+
controllerRef.current?.view.destroy();
|
|
1080
|
+
};
|
|
1077
1081
|
}, []);
|
|
1078
1082
|
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(
|
|
1079
1083
|
TextEditorInput,
|
|
@@ -1020,32 +1020,36 @@ function createTextEditor(options = {}) {
|
|
|
1020
1020
|
} = {}) {
|
|
1021
1021
|
const containerRef = useRef(null);
|
|
1022
1022
|
const controllerRef = useRef(null);
|
|
1023
|
-
useImperativeHandle(
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
container
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1023
|
+
useImperativeHandle(
|
|
1024
|
+
ref || controllerRef,
|
|
1025
|
+
() => {
|
|
1026
|
+
const container = containerRef.current;
|
|
1027
|
+
const textEditorController = createTextEditorController(
|
|
1028
|
+
container,
|
|
1029
|
+
schema,
|
|
1030
|
+
options,
|
|
1031
|
+
{
|
|
1032
|
+
mode,
|
|
1033
|
+
state,
|
|
1034
|
+
editor,
|
|
1035
|
+
defaultValue,
|
|
1036
|
+
updateDelay,
|
|
1037
|
+
placeholder
|
|
1038
|
+
}
|
|
1039
|
+
);
|
|
1040
|
+
controllerRef.current = textEditorController;
|
|
1041
|
+
return textEditorController;
|
|
1042
|
+
},
|
|
1043
|
+
[]
|
|
1044
|
+
);
|
|
1041
1045
|
useEffect2(() => {
|
|
1042
|
-
const controller = controllerRef.current;
|
|
1043
|
-
if (!controller) {
|
|
1044
|
-
return;
|
|
1045
|
-
}
|
|
1046
1046
|
if (autoFocus) {
|
|
1047
|
-
|
|
1047
|
+
controllerRef.current?.view.focus();
|
|
1048
1048
|
}
|
|
1049
|
+
return () => {
|
|
1050
|
+
console.log(controllerRef.current);
|
|
1051
|
+
controllerRef.current?.view.destroy();
|
|
1052
|
+
};
|
|
1049
1053
|
}, []);
|
|
1050
1054
|
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", { ...props, ref: containerRef, className }), /* @__PURE__ */ React2.createElement(
|
|
1051
1055
|
TextEditorInput,
|
package/dist/index.js
CHANGED
|
@@ -1054,32 +1054,36 @@ function createTextEditor(options = {}) {
|
|
|
1054
1054
|
} = {}) {
|
|
1055
1055
|
const containerRef = (0, import_react3.useRef)(null);
|
|
1056
1056
|
const controllerRef = (0, import_react3.useRef)(null);
|
|
1057
|
-
(0, import_react2.useImperativeHandle)(
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
container
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1057
|
+
(0, import_react2.useImperativeHandle)(
|
|
1058
|
+
ref || controllerRef,
|
|
1059
|
+
() => {
|
|
1060
|
+
const container = containerRef.current;
|
|
1061
|
+
const textEditorController = createTextEditorController(
|
|
1062
|
+
container,
|
|
1063
|
+
schema,
|
|
1064
|
+
options,
|
|
1065
|
+
{
|
|
1066
|
+
mode,
|
|
1067
|
+
state,
|
|
1068
|
+
editor,
|
|
1069
|
+
defaultValue,
|
|
1070
|
+
updateDelay,
|
|
1071
|
+
placeholder
|
|
1072
|
+
}
|
|
1073
|
+
);
|
|
1074
|
+
controllerRef.current = textEditorController;
|
|
1075
|
+
return textEditorController;
|
|
1076
|
+
},
|
|
1077
|
+
[]
|
|
1078
|
+
);
|
|
1075
1079
|
(0, import_react3.useEffect)(() => {
|
|
1076
|
-
const controller = controllerRef.current;
|
|
1077
|
-
if (!controller) {
|
|
1078
|
-
return;
|
|
1079
|
-
}
|
|
1080
1080
|
if (autoFocus) {
|
|
1081
|
-
|
|
1081
|
+
controllerRef.current?.view.focus();
|
|
1082
1082
|
}
|
|
1083
|
+
return () => {
|
|
1084
|
+
console.log(controllerRef.current);
|
|
1085
|
+
controllerRef.current?.view.destroy();
|
|
1086
|
+
};
|
|
1083
1087
|
}, []);
|
|
1084
1088
|
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(
|
|
1085
1089
|
TextEditorInput,
|
package/dist/index.mjs
CHANGED
|
@@ -1020,32 +1020,36 @@ function createTextEditor(options = {}) {
|
|
|
1020
1020
|
} = {}) {
|
|
1021
1021
|
const containerRef = useRef(null);
|
|
1022
1022
|
const controllerRef = useRef(null);
|
|
1023
|
-
useImperativeHandle(
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
container
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1023
|
+
useImperativeHandle(
|
|
1024
|
+
ref || controllerRef,
|
|
1025
|
+
() => {
|
|
1026
|
+
const container = containerRef.current;
|
|
1027
|
+
const textEditorController = createTextEditorController(
|
|
1028
|
+
container,
|
|
1029
|
+
schema,
|
|
1030
|
+
options,
|
|
1031
|
+
{
|
|
1032
|
+
mode,
|
|
1033
|
+
state,
|
|
1034
|
+
editor,
|
|
1035
|
+
defaultValue,
|
|
1036
|
+
updateDelay,
|
|
1037
|
+
placeholder
|
|
1038
|
+
}
|
|
1039
|
+
);
|
|
1040
|
+
controllerRef.current = textEditorController;
|
|
1041
|
+
return textEditorController;
|
|
1042
|
+
},
|
|
1043
|
+
[]
|
|
1044
|
+
);
|
|
1041
1045
|
useEffect2(() => {
|
|
1042
|
-
const controller = controllerRef.current;
|
|
1043
|
-
if (!controller) {
|
|
1044
|
-
return;
|
|
1045
|
-
}
|
|
1046
1046
|
if (autoFocus) {
|
|
1047
|
-
|
|
1047
|
+
controllerRef.current?.view.focus();
|
|
1048
1048
|
}
|
|
1049
|
+
return () => {
|
|
1050
|
+
console.log(controllerRef.current);
|
|
1051
|
+
controllerRef.current?.view.destroy();
|
|
1052
|
+
};
|
|
1049
1053
|
}, []);
|
|
1050
1054
|
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", { ...props, ref: containerRef, className }), /* @__PURE__ */ React2.createElement(
|
|
1051
1055
|
TextEditorInput,
|