@monolith-forensics/monolith-ui 1.1.78 → 1.1.79
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.
|
@@ -18,6 +18,7 @@ interface RichTextEditorProps {
|
|
|
18
18
|
handleImageUpload?: HandleImageUpload;
|
|
19
19
|
bubbleMenuOptions?: BubbleMenuOptions;
|
|
20
20
|
toolbarOptions?: ToolbarOptions;
|
|
21
|
+
autoFocus?: boolean;
|
|
21
22
|
style?: React.CSSProperties;
|
|
22
23
|
}
|
|
23
24
|
declare const RichTextEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<RichTextEditorProps & import("react").RefAttributes<unknown>, "ref"> & {
|
|
@@ -9,7 +9,7 @@ import { startImageUpload, } from "./Plugins/UploadImagesPlugin";
|
|
|
9
9
|
import SaveBadge from "./Components/SaveBadge";
|
|
10
10
|
import Fonts from "./Enums/Fonts";
|
|
11
11
|
import RichTextEditorContext from "./Contexts/RichTextEditorContext";
|
|
12
|
-
const RichTextEditor = styled(forwardRef(({ className, editorInstanceRef, defaultValue = "", readOnly = false, font, showToolbar = true, saving = false, extensions = [], slashCommands = [], bubbleMenuOptions, toolbarOptions, onChange, handleImageUpload, style, }, ref) => {
|
|
12
|
+
const RichTextEditor = styled(forwardRef(({ className, editorInstanceRef, defaultValue = "", readOnly = false, font, showToolbar = true, saving = false, extensions = [], slashCommands = [], bubbleMenuOptions, toolbarOptions, autoFocus, onChange, handleImageUpload, style, }, ref) => {
|
|
13
13
|
const [fontState, setFontState] = useState(font || Fonts.DEFAULT);
|
|
14
14
|
// check if image extension is included
|
|
15
15
|
if (extensions === null || extensions === void 0 ? void 0 : extensions.includes(Extensions.Image)) {
|
|
@@ -80,6 +80,12 @@ const RichTextEditor = styled(forwardRef(({ className, editorInstanceRef, defaul
|
|
|
80
80
|
_ref.current = editor;
|
|
81
81
|
}
|
|
82
82
|
}, [editor]);
|
|
83
|
+
// AutoFocus on the editor
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (autoFocus && editor) {
|
|
86
|
+
editor.view.focus();
|
|
87
|
+
}
|
|
88
|
+
}, [autoFocus, editor]);
|
|
83
89
|
return (_jsx("div", { className: className, children: _jsxs(RichTextEditorContext.Provider, { value: {
|
|
84
90
|
font: fontState,
|
|
85
91
|
setFont: setFontState,
|