@elia-ori/editor 0.1.23 → 0.1.25

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.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { JSONContent, Node } from '@tiptap/core';
2
3
  import { NodeType } from '@tiptap/pm/model';
3
- import { Node } from '@tiptap/core';
4
4
 
5
5
  type UploadFunction = (file: File, onProgress?: (event: {
6
6
  progress: number;
@@ -56,7 +56,7 @@ declare module "@tiptap/react" {
56
56
  type ToolbarItem = 'undo-redo' | 'heading' | 'list' | 'blockquote' | 'code-block' | 'callout' | 'table' | 'format' | 'text-color' | 'highlight' | 'link' | 'superscript' | 'subscript' | 'align' | 'image';
57
57
  interface EliaEditorProps {
58
58
  content?: string;
59
- onChange?: (html: string) => void;
59
+ onChange?: (html: string, json: JSONContent) => void;
60
60
  placeholder?: string;
61
61
  toolbar?: ToolbarItem[];
62
62
  onImageUpload?: UploadFunction;
@@ -72,8 +72,10 @@ interface EliaEditorProps {
72
72
  bottomOffset?: number;
73
73
  /** 最小高度(預設 200px) */
74
74
  minHeight?: number;
75
+ /** 卡片樣式:邊框 + 圓角 + 陰影 */
76
+ card?: boolean;
75
77
  }
76
- declare function EliaEditor({ content, onChange, placeholder, toolbar, onImageUpload, className, editorClassName, autofocus, readOnly, embedded, autoHeight, bottomOffset, minHeight, }: EliaEditorProps): react_jsx_runtime.JSX.Element;
78
+ declare function EliaEditor({ content, onChange, placeholder, toolbar, onImageUpload, className, editorClassName, autofocus, readOnly, embedded, autoHeight, bottomOffset, minHeight, card, }: EliaEditorProps): react_jsx_runtime.JSX.Element;
77
79
 
78
80
  type CalloutType = 'success' | 'warning' | 'error' | 'info';
79
81
  interface CalloutOptions {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { JSONContent, Node } from '@tiptap/core';
2
3
  import { NodeType } from '@tiptap/pm/model';
3
- import { Node } from '@tiptap/core';
4
4
 
5
5
  type UploadFunction = (file: File, onProgress?: (event: {
6
6
  progress: number;
@@ -56,7 +56,7 @@ declare module "@tiptap/react" {
56
56
  type ToolbarItem = 'undo-redo' | 'heading' | 'list' | 'blockquote' | 'code-block' | 'callout' | 'table' | 'format' | 'text-color' | 'highlight' | 'link' | 'superscript' | 'subscript' | 'align' | 'image';
57
57
  interface EliaEditorProps {
58
58
  content?: string;
59
- onChange?: (html: string) => void;
59
+ onChange?: (html: string, json: JSONContent) => void;
60
60
  placeholder?: string;
61
61
  toolbar?: ToolbarItem[];
62
62
  onImageUpload?: UploadFunction;
@@ -72,8 +72,10 @@ interface EliaEditorProps {
72
72
  bottomOffset?: number;
73
73
  /** 最小高度(預設 200px) */
74
74
  minHeight?: number;
75
+ /** 卡片樣式:邊框 + 圓角 + 陰影 */
76
+ card?: boolean;
75
77
  }
76
- declare function EliaEditor({ content, onChange, placeholder, toolbar, onImageUpload, className, editorClassName, autofocus, readOnly, embedded, autoHeight, bottomOffset, minHeight, }: EliaEditorProps): react_jsx_runtime.JSX.Element;
78
+ declare function EliaEditor({ content, onChange, placeholder, toolbar, onImageUpload, className, editorClassName, autofocus, readOnly, embedded, autoHeight, bottomOffset, minHeight, card, }: EliaEditorProps): react_jsx_runtime.JSX.Element;
77
79
 
78
80
  type CalloutType = 'success' | 'warning' | 'error' | 'info';
79
81
  interface CalloutOptions {
package/dist/index.js CHANGED
@@ -6182,7 +6182,8 @@ function EliaEditor({
6182
6182
  embedded = false,
6183
6183
  autoHeight = false,
6184
6184
  bottomOffset = 24,
6185
- minHeight = 200
6185
+ minHeight = 200,
6186
+ card = false
6186
6187
  }) {
6187
6188
  const isMobile = useIsBreakpoint();
6188
6189
  const { height } = useWindowSize();
@@ -6201,7 +6202,7 @@ function EliaEditor({
6201
6202
  const handleUpdate = useCallback30(
6202
6203
  ({ editor: editor2 }) => {
6203
6204
  isInternalUpdate.current = true;
6204
- onChange?.(editor2.getHTML());
6205
+ onChange?.(editor2.getHTML(), editor2.getJSON());
6205
6206
  },
6206
6207
  [onChange]
6207
6208
  );
@@ -6286,7 +6287,12 @@ function EliaEditor({
6286
6287
  "div",
6287
6288
  {
6288
6289
  ref: containerRef,
6289
- className: cn("simple-editor-wrapper", embedded && "simple-editor-embedded", className),
6290
+ className: cn(
6291
+ "simple-editor-wrapper",
6292
+ embedded && "simple-editor-embedded",
6293
+ card && "simple-editor-card",
6294
+ className
6295
+ ),
6290
6296
  style: computedHeight ? { height: computedHeight } : void 0,
6291
6297
  children: /* @__PURE__ */ jsxs40(EditorContext.Provider, { value: { editor }, children: [
6292
6298
  /* @__PURE__ */ jsx63(