mino-daisy-react 1.1.0 → 1.1.1
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.js +4575 -326
- package/dist/rich-text-editor/markdown-transformers.d.ts +36 -0
- package/dist/rich-text-editor/markdown-transformers.d.ts.map +1 -0
- package/dist/rich-text-editor/plugins.d.ts +9 -3
- package/dist/rich-text-editor/plugins.d.ts.map +1 -1
- package/dist/rich-text-editor/rich-text-editor.d.ts +35 -4
- package/dist/rich-text-editor/rich-text-editor.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown transformers matching RichTextEditor's supported nodes.
|
|
3
|
+
*
|
|
4
|
+
* Used for:
|
|
5
|
+
* - Converting markdown → Lexical nodes (InitialContentPlugin)
|
|
6
|
+
* - Converting Lexical nodes → markdown (OnChangePlugin)
|
|
7
|
+
* - Real-time markdown shortcuts (MarkdownShortcutsPlugin)
|
|
8
|
+
*
|
|
9
|
+
* Supported markdown syntax:
|
|
10
|
+
* - Headings: # H1, ## H2, ### H3, etc.
|
|
11
|
+
* - Blockquotes: > quote text
|
|
12
|
+
* - Bold: **bold** or __bold__
|
|
13
|
+
* - Italic: *italic* or _italic_
|
|
14
|
+
* - Bold + Italic: ***bold italic*** or ___bold italic___
|
|
15
|
+
* - Strikethrough: ~~strikethrough~~
|
|
16
|
+
* - Inline code: `code`
|
|
17
|
+
* - Links: [text](url)
|
|
18
|
+
* - Unordered lists: - item or * item
|
|
19
|
+
* - Ordered lists: 1. item
|
|
20
|
+
*/
|
|
21
|
+
export declare const MARKDOWN_TRANSFORMERS: (import("@lexical/markdown").ElementTransformer | Readonly<{
|
|
22
|
+
format: ReadonlyArray<import("lexical").TextFormatType>;
|
|
23
|
+
tag: string;
|
|
24
|
+
intraword?: boolean;
|
|
25
|
+
type: "text-format";
|
|
26
|
+
}> | Readonly<{
|
|
27
|
+
dependencies: Array<import("lexical").Klass<import("lexical").LexicalNode>>;
|
|
28
|
+
export?: (node: import("lexical").LexicalNode, exportChildren: (node: import("lexical").ElementNode) => string, exportFormat: (node: import("lexical").TextNode, textContent: string) => string) => string | null;
|
|
29
|
+
importRegExp?: RegExp;
|
|
30
|
+
regExp: RegExp;
|
|
31
|
+
replace?: (node: import("lexical").TextNode, match: RegExpMatchArray) => void | import("lexical").TextNode;
|
|
32
|
+
getEndIndex?: (node: import("lexical").TextNode, match: RegExpMatchArray) => number | false;
|
|
33
|
+
trigger?: string;
|
|
34
|
+
type: "text-match";
|
|
35
|
+
}>)[];
|
|
36
|
+
//# sourceMappingURL=markdown-transformers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-transformers.d.ts","sourceRoot":"","sources":["../../src/rich-text-editor/markdown-transformers.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;KAcjC,CAAA"}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import type { LexicalEditor } from 'lexical';
|
|
2
2
|
export interface OnChangePluginProps {
|
|
3
|
-
onChange?: (
|
|
3
|
+
onChange?: (content: string) => void;
|
|
4
|
+
contentFormat?: 'html' | 'markdown';
|
|
4
5
|
}
|
|
5
|
-
export declare function OnChangePlugin({ onChange }: OnChangePluginProps): null;
|
|
6
|
+
export declare function OnChangePlugin({ onChange, contentFormat }: OnChangePluginProps): null;
|
|
6
7
|
export interface RefPluginProps {
|
|
7
8
|
editorRef?: React.Ref<LexicalEditor>;
|
|
8
9
|
}
|
|
9
10
|
export declare function RefPlugin({ editorRef }: RefPluginProps): null;
|
|
10
11
|
export interface InitialContentPluginProps {
|
|
11
12
|
content?: string;
|
|
13
|
+
contentFormat?: 'html' | 'markdown';
|
|
12
14
|
}
|
|
13
|
-
export declare function InitialContentPlugin({ content }: InitialContentPluginProps): null;
|
|
15
|
+
export declare function InitialContentPlugin({ content, contentFormat, }: InitialContentPluginProps): null;
|
|
16
|
+
export interface MarkdownShortcutsPluginProps {
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function MarkdownShortcutsPlugin({ enabled }: MarkdownShortcutsPluginProps): import("react/jsx-runtime").JSX.Element | null;
|
|
14
20
|
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/rich-text-editor/plugins.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/rich-text-editor/plugins.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAK5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,aAAa,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;CACpC;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,aAAsB,EAAE,EAAE,mBAAmB,QAoBvF;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;CACrC;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,cAAc,QActD;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;CACpC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,aAAsB,GACvB,EAAE,yBAAyB,QAuB3B;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,uBAAuB,CAAC,EAAE,OAAe,EAAE,EAAE,4BAA4B,kDAIxF"}
|
|
@@ -2,15 +2,46 @@ import type { LexicalEditor } from 'lexical';
|
|
|
2
2
|
import type { HTMLAttributes } from 'react';
|
|
3
3
|
export interface RichTextEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
4
4
|
/**
|
|
5
|
-
* Initial
|
|
5
|
+
* Initial content for the editor.
|
|
6
|
+
* Format depends on contentFormat prop.
|
|
6
7
|
* For empty state, use empty string or undefined.
|
|
7
8
|
*/
|
|
8
9
|
initialContent?: string;
|
|
9
10
|
/**
|
|
10
11
|
* Callback fired when editor content changes.
|
|
11
|
-
* Receives
|
|
12
|
+
* Receives content string in format specified by contentFormat prop.
|
|
12
13
|
*/
|
|
13
|
-
onChange?: (
|
|
14
|
+
onChange?: (content: string) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Content format for initialContent and onChange output.
|
|
17
|
+
* - 'html': Accept/export HTML (default, backwards compatible)
|
|
18
|
+
* - 'markdown': Accept/export markdown while editing in WYSIWYG mode
|
|
19
|
+
*
|
|
20
|
+
* Note: When using 'markdown', complex HTML styling may be lost during conversion.
|
|
21
|
+
* The editor always displays in WYSIWYG mode regardless of format.
|
|
22
|
+
*
|
|
23
|
+
* @default 'html'
|
|
24
|
+
*/
|
|
25
|
+
contentFormat?: 'html' | 'markdown';
|
|
26
|
+
/**
|
|
27
|
+
* Enable real-time markdown shortcut conversion while typing.
|
|
28
|
+
* Works independently of contentFormat - you can use markdown shortcuts
|
|
29
|
+
* even when outputting HTML.
|
|
30
|
+
*
|
|
31
|
+
* Supported shortcuts:
|
|
32
|
+
* - Headings: # H1, ## H2, ### H3, etc.
|
|
33
|
+
* - Blockquotes: > quote text
|
|
34
|
+
* - Bold: **text** or __text__
|
|
35
|
+
* - Italic: *text* or _text_
|
|
36
|
+
* - Strikethrough: ~~text~~
|
|
37
|
+
* - Inline code: `code`
|
|
38
|
+
* - Links: [text](url)
|
|
39
|
+
* - Unordered lists: - item or * item
|
|
40
|
+
* - Ordered lists: 1. item
|
|
41
|
+
*
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
enableMarkdownShortcuts?: boolean;
|
|
14
45
|
/**
|
|
15
46
|
* If true, editor is read-only and toolbar is hidden.
|
|
16
47
|
*/
|
|
@@ -32,7 +63,7 @@ export interface RichTextEditorProps extends Omit<HTMLAttributes<HTMLDivElement>
|
|
|
32
63
|
*/
|
|
33
64
|
ref?: React.Ref<LexicalEditor>;
|
|
34
65
|
}
|
|
35
|
-
export declare function RichTextEditor({ initialContent, onChange, disabled, placeholder, toolbarClassName, editorClassName, className, ref, ...props }: RichTextEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
export declare function RichTextEditor({ initialContent, onChange, contentFormat, enableMarkdownShortcuts, disabled, placeholder, toolbarClassName, editorClassName, className, ref, ...props }: RichTextEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
36
67
|
export declare namespace RichTextEditor {
|
|
37
68
|
var displayName: string;
|
|
38
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text-editor.d.ts","sourceRoot":"","sources":["../../src/rich-text-editor/rich-text-editor.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAI3C,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC3F
|
|
1
|
+
{"version":3,"file":"rich-text-editor.d.ts","sourceRoot":"","sources":["../../src/rich-text-editor/rich-text-editor.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAI3C,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC3F;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAEpC;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IAEnC;;;;;;;;;;;;;;;;;OAiBG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAA;IAEjC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;CAC/B;AA8BD,wBAAgB,cAAc,CAAC,EAC7B,cAAc,EACd,QAAQ,EACR,aAAsB,EACtB,uBAA+B,EAC/B,QAAgB,EAChB,WAA+B,EAC/B,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,mBAAmB,2CA+CrB;yBA3De,cAAc"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "https://github.com/giacomorebonato/mino-daisy-react.git"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.1.
|
|
7
|
+
"version": "1.1.1",
|
|
8
8
|
"description": "React component library wrapping DaisyUI components",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "./dist/index.js",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
],
|
|
30
30
|
"author": "Giacomo Rebonato",
|
|
31
31
|
"license": "MIT",
|
|
32
|
-
"packageManager": "pnpm@10.20.0",
|
|
33
32
|
"peerDependencies": {
|
|
34
33
|
"daisyui": ">=5.0.0",
|
|
35
34
|
"react": ">=19.0.0",
|
|
@@ -65,6 +64,7 @@
|
|
|
65
64
|
"@lexical/html": "^0.38.2",
|
|
66
65
|
"@lexical/link": "^0.38.2",
|
|
67
66
|
"@lexical/list": "^0.38.2",
|
|
67
|
+
"@lexical/markdown": "^0.38.2",
|
|
68
68
|
"@lexical/react": "^0.38.2",
|
|
69
69
|
"@lexical/rich-text": "^0.38.2",
|
|
70
70
|
"@lexical/selection": "^0.38.2",
|