@foodpilot/foods 2.12.4 → 2.12.5
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.
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @property {boolean} displayOutput - Optional flag to show the output mode
|
|
6
6
|
* @property {string} placeholder - Optional placeholder text when editor is empty
|
|
7
7
|
* @property {string} initialContent - Optional initial HTML content for the editor
|
|
8
|
+
* @property {boolean} allowBase64Images - Optional flag allowing base64 image sources when parsing HTML
|
|
8
9
|
*/
|
|
9
10
|
interface RichTextEditorProps {
|
|
10
11
|
onChange?: (value: string) => void;
|
|
@@ -12,6 +13,7 @@ interface RichTextEditorProps {
|
|
|
12
13
|
placeholder?: string;
|
|
13
14
|
initialContent?: string;
|
|
14
15
|
value?: string;
|
|
16
|
+
allowBase64Images?: boolean;
|
|
15
17
|
}
|
|
16
18
|
export declare const RichTextEditor: (props: RichTextEditorProps) => React.JSX.Element | null;
|
|
17
19
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useEditor as o}from"@tiptap/react";import i from"@tiptap/starter-kit";import r from"@tiptap/extension-text-align";import n from"@tiptap/extension-text-style";import p from"@tiptap/extension-font-family";import s from"@tiptap/extension-underline";import
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useEditor as o}from"@tiptap/react";import i from"@tiptap/starter-kit";import r from"@tiptap/extension-text-align";import n from"@tiptap/extension-text-style";import p from"@tiptap/extension-font-family";import s from"@tiptap/extension-underline";import a from"@tiptap/extension-placeholder";import m from"@tiptap/extension-image";import l from"@tiptap/extension-link";import f from"@tiptap/extension-horizontal-rule";import{Color as u}from"@tiptap/extension-color";import{FontSize as c}from"./extensions/FontSize.js";import{BackgroundColor as d}from"./extensions/BackgroundColor.js";import{BorderRadius as x}from"./extensions/BorderRadius.js";import g from"./toolbar/Toolbar.js";import{EditorContainer as y,StyledEditorContent as k}from"./components/Editor/style/index.js";import{SvgIconExtension as h}from"./extensions/SvgIconExtension.js";import{LabelExtension as j}from"./extensions/LabelExtension.js";import{EditorOutput as v}from"./editor/EditorOutput.js";import{useEffect as b}from"react";const w=({onChange:w,displayOutput:E=!1,placeholder:L="",initialContent:B="",value:O="",allowBase64Images:S=!1})=>{const C=o({extensions:[i,r.configure({types:["heading","paragraph"]}),n,p,s,c,u.configure({types:["textStyle"]}),d.configure({types:["textStyle"]}),x.configure({types:["textStyle"]}),h,j,a.configure({placeholder:L}),l.configure({openOnClick:!1,linkOnPaste:!0,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer nofollow",target:"_blank"},validate:t=>!!t}),m.configure({inline:!0,allowBase64:S}),f],content:B,onUpdate:({editor:t})=>{w?.(t.getHTML())}});return b(()=>{if(!C)return;const t=()=>{C.isActive("link")&&""===C.getAttributes("link").href&&C.commands.unsetLink()},e=e=>{"Backspace"!==e.key&&"Delete"!==e.key||setTimeout(t,10)},o=C.view.dom;return o.addEventListener("keydown",e),()=>{o.removeEventListener("keydown",e)}},[C]),C?/* @__PURE__ */t(y,{children:[
|
|
2
2
|
/* @__PURE__ */e(g,{editor:C}),
|
|
3
|
-
/* @__PURE__ */e(k,{editor:C,value:
|
|
4
|
-
/* @__PURE__ */e(v,{editor:C,displayOutput:
|
|
3
|
+
/* @__PURE__ */e(k,{editor:C,value:O}),
|
|
4
|
+
/* @__PURE__ */e(v,{editor:C,displayOutput:E})]}):null};export{w as RichTextEditor};
|