@cloudbase/weda-ui 3.11.7 → 3.11.8
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.
|
@@ -86,7 +86,7 @@ initialContent, placeholder, iconPack, maxSize, cloudPath, visible, }) {
|
|
|
86
86
|
const [editorHeight, setEditorHeight] = React.useState(0);
|
|
87
87
|
const [syncedValue] = useSyncValue(xss(value, getWhitelist()));
|
|
88
88
|
const [currentMap, setCurrentMap] = React.useState({});
|
|
89
|
-
const [currentCursor, setCurrentCursor] = React.useState(
|
|
89
|
+
const [currentCursor, setCurrentCursor] = React.useState(undefined);
|
|
90
90
|
const [toolbar, setToolbar] = React.useState(platform === 'h5' ? toolbarArrayH5.join(' ') : toolbarPC);
|
|
91
91
|
const ref = React.useRef({});
|
|
92
92
|
const editorDomRef = React.useRef(null);
|
|
@@ -314,7 +314,9 @@ initialContent, placeholder, iconPack, maxSize, cloudPath, visible, }) {
|
|
|
314
314
|
ref.current.editor.setHTML(tempValue);
|
|
315
315
|
}
|
|
316
316
|
window.setTimeout(() => {
|
|
317
|
-
|
|
317
|
+
if (currentCursor) {
|
|
318
|
+
ref.current.editor.selection(currentCursor, currentCursor);
|
|
319
|
+
}
|
|
318
320
|
}, 0);
|
|
319
321
|
}
|
|
320
322
|
}, [syncedValue, ref.current.editor]);
|
|
@@ -81,33 +81,33 @@ export const WdText = forwardRef(function WdText({ className, style, id, level:
|
|
|
81
81
|
case 'title-1':
|
|
82
82
|
return (_jsx("h1", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
83
83
|
//@ts-expect-error contentEditable type def sucks
|
|
84
|
-
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
84
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events === null || events === void 0 ? void 0 : events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
85
85
|
case 'title-2':
|
|
86
86
|
return (_jsx("h2", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
87
87
|
//@ts-expect-error contentEditable type def sucks
|
|
88
|
-
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
88
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events === null || events === void 0 ? void 0 : events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
89
89
|
case 'title-3':
|
|
90
90
|
return (_jsx("h3", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
91
91
|
//@ts-expect-error contentEditable type def sucks
|
|
92
|
-
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
92
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events === null || events === void 0 ? void 0 : events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
93
93
|
case 'title-4':
|
|
94
94
|
return (_jsx("h4", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
95
95
|
//@ts-expect-error contentEditable type def sucks
|
|
96
|
-
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
96
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events === null || events === void 0 ? void 0 : events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
97
97
|
case 'title-5':
|
|
98
98
|
return (_jsx("h5", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
99
99
|
//@ts-expect-error contentEditable type def sucks
|
|
100
|
-
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
100
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events === null || events === void 0 ? void 0 : events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
101
101
|
case 'title-6':
|
|
102
102
|
case 'title-7':
|
|
103
103
|
case 'title-8':
|
|
104
104
|
case 'title-9':
|
|
105
105
|
return (_jsx("h6", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
106
106
|
//@ts-expect-error contentEditable type def sucks
|
|
107
|
-
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
107
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events === null || events === void 0 ? void 0 : events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
108
108
|
default:
|
|
109
109
|
return (_jsx("p", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
110
110
|
//@ts-expect-error contentEditable type def sucks
|
|
111
|
-
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
111
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events === null || events === void 0 ? void 0 : events.tap({}, { originEvent: e }), ...propsStartWithOn, children: textToString(text) }));
|
|
112
112
|
}
|
|
113
113
|
});
|