@firecms/editor 3.0.1 → 3.1.0-canary.1df3b2c
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/editor.d.ts +20 -1
- package/dist/index.es.js +5 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +29 -29
package/dist/editor.d.ts
CHANGED
|
@@ -2,6 +2,20 @@ import React from "react";
|
|
|
2
2
|
import { type JSONContent } from "./components";
|
|
3
3
|
import { EditorAIController } from "./types";
|
|
4
4
|
export type FireCMSEditorTextSize = "sm" | "base" | "lg";
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for the markdown editor.
|
|
7
|
+
*/
|
|
8
|
+
export interface MarkdownEditorConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Allow HTML input/output. When set to false, HTML tags in pasted content
|
|
11
|
+
* will be stripped. Defaults to true.
|
|
12
|
+
*/
|
|
13
|
+
html?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Convert pasted text to markdown format. Defaults to false.
|
|
16
|
+
*/
|
|
17
|
+
transformPastedText?: boolean;
|
|
18
|
+
}
|
|
5
19
|
export type FireCMSEditorProps = {
|
|
6
20
|
content?: JSONContent | string;
|
|
7
21
|
onMarkdownContentChange?: (content: string) => void;
|
|
@@ -17,9 +31,14 @@ export type FireCMSEditorProps = {
|
|
|
17
31
|
aiController?: EditorAIController;
|
|
18
32
|
customComponents?: CustomEditorComponent[];
|
|
19
33
|
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for markdown parsing and serialization.
|
|
36
|
+
* Controls how HTML is handled during paste operations.
|
|
37
|
+
*/
|
|
38
|
+
markdownConfig?: MarkdownEditorConfig;
|
|
20
39
|
};
|
|
21
40
|
export type CustomEditorComponent = {
|
|
22
41
|
name: string;
|
|
23
42
|
component: React.FC;
|
|
24
43
|
};
|
|
25
|
-
export declare const FireCMSEditor: ({ content, onJsonContentChange, onHtmlContentChange, onMarkdownContentChange, version, textSize, highlight, handleImageUpload, aiController, disabled }: FireCMSEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export declare const FireCMSEditor: ({ content, onJsonContentChange, onHtmlContentChange, onMarkdownContentChange, version, textSize, highlight, handleImageUpload, aiController, disabled, markdownConfig }: FireCMSEditorProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.es.js
CHANGED
|
@@ -1921,7 +1921,8 @@ const FireCMSEditor = ({
|
|
|
1921
1921
|
highlight,
|
|
1922
1922
|
handleImageUpload,
|
|
1923
1923
|
aiController,
|
|
1924
|
-
disabled
|
|
1924
|
+
disabled,
|
|
1925
|
+
markdownConfig
|
|
1925
1926
|
}) => {
|
|
1926
1927
|
const ref = React.useRef(null);
|
|
1927
1928
|
const editorRef = React.useRef(null);
|
|
@@ -1974,7 +1975,8 @@ const FireCMSEditor = ({
|
|
|
1974
1975
|
const extensions = useMemo(() => [starterKit, Document.extend({}), HighlightDecorationExtension(highlight), TextLoadingDecorationExtension, Underline, Bold, TextStyleKit, Italic, Strike, Color, Highlight.configure({
|
|
1975
1976
|
multicolor: true
|
|
1976
1977
|
}), Heading, CustomKeymap, DragAndDrop, placeholder, tiptapLink, imageExtension, taskList, taskItem, Markdown.configure({
|
|
1977
|
-
html: true
|
|
1978
|
+
html: markdownConfig?.html ?? true,
|
|
1979
|
+
transformPastedText: markdownConfig?.transformPastedText ?? false
|
|
1978
1980
|
}), horizontalRule, bulletList, orderedList, listItem, blockquote, codeBlock, code, SlashCommand.configure({
|
|
1979
1981
|
HTMLAttributes: {
|
|
1980
1982
|
class: "mention"
|
|
@@ -1983,7 +1985,7 @@ const FireCMSEditor = ({
|
|
|
1983
1985
|
upload: handleImageUpload,
|
|
1984
1986
|
aiController
|
|
1985
1987
|
})
|
|
1986
|
-
})], []);
|
|
1988
|
+
})], [markdownConfig?.html, markdownConfig?.transformPastedText]);
|
|
1987
1989
|
return /* @__PURE__ */ jsx("div", { ref, className: "relative min-h-[300px] w-full", children: /* @__PURE__ */ jsx(EditorProvider, { content: content ?? "", extensions, immediatelyRender: canUseDOM, editorProps: {
|
|
1988
1990
|
editable: () => !disabled,
|
|
1989
1991
|
attributes: {
|