@thebuoyant-tsdev/mui-ts-library 3.7.1 → 3.8.0
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/README.de.md +8 -0
- package/README.md +8 -0
- package/dist/components/rich-text-editor/RichTextEditor.d.ts +7 -1
- package/dist/components/rich-text-editor/RichTextEditor.js +87 -73
- package/dist/components/rich-text-editor/RichTextEditor.types.d.ts +25 -1
- package/dist/components/rich-text-editor/RichTextEditor.types.js +13 -2
- package/dist/components/rich-text-editor/RichTextEditorEmojiPicker.d.ts +1 -1
- package/dist/components/rich-text-editor/RichTextEditorFooter.d.ts +1 -1
- package/dist/components/rich-text-editor/RichTextEditorImageDialog.d.ts +1 -1
- package/dist/components/rich-text-editor/RichTextEditorLinkDialog.d.ts +1 -1
- package/dist/components/rich-text-editor/RichTextEditorMarkdownDialog.d.ts +10 -0
- package/dist/components/rich-text-editor/RichTextEditorMarkdownDialog.js +88 -0
- package/dist/components/rich-text-editor/RichTextEditorTableMenu.d.ts +1 -1
- package/dist/components/rich-text-editor/RichTextEditorToolbar.d.ts +4 -2
- package/dist/components/rich-text-editor/RichTextEditorToolbar.js +211 -175
- package/dist/index.cjs +2 -2
- package/package.json +1 -1
package/README.de.md
CHANGED
|
@@ -343,6 +343,14 @@ Dieses Projekt folgt [Semantic Versioning](https://semver.org/). In der Praxis b
|
|
|
343
343
|
|
|
344
344
|
## Changelog
|
|
345
345
|
|
|
346
|
+
### [3.8.0] — 2026-06-23
|
|
347
|
+
|
|
348
|
+
**RichTextEditor**
|
|
349
|
+
- `showPasteAsPlainTextButton`: Toolbar-Toggle, das eingefügten Inhalt von Formatierung befreit.
|
|
350
|
+
- `showMarkdownButton` + `onMarkdownChange`: Markdown-Import/Export-Dialog und ein Live-Markdown-Callback.
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
346
354
|
### [3.7.1] — 2026-06-23
|
|
347
355
|
|
|
348
356
|
**Re-Publish — fehlende README auf npm**
|
package/README.md
CHANGED
|
@@ -343,6 +343,14 @@ This project follows [Semantic Versioning](https://semver.org/). In practice:
|
|
|
343
343
|
|
|
344
344
|
## Changelog
|
|
345
345
|
|
|
346
|
+
### [3.8.0] — 2026-06-23
|
|
347
|
+
|
|
348
|
+
**RichTextEditor**
|
|
349
|
+
- `showPasteAsPlainTextButton`: toolbar toggle that strips formatting from pasted content.
|
|
350
|
+
- `showMarkdownButton` + `onMarkdownChange`: Markdown import/export dialog and a live Markdown callback.
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
346
354
|
### [3.7.1] — 2026-06-23
|
|
347
355
|
|
|
348
356
|
**Republish — missing README on npm**
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import { type MarkdownStorage } from "tiptap-markdown";
|
|
2
|
+
declare module "@tiptap/core" {
|
|
3
|
+
interface Storage {
|
|
4
|
+
markdown: MarkdownStorage;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
1
7
|
import { type RichTextEditorProps } from "./RichTextEditor.types";
|
|
2
|
-
export declare function RichTextEditor({ disabled, error, height, helperText, maxCharacters, name, placeholder, readonly, showCharacterCount, showToolbar, showWordCount, toolbarConfig, translation, value, width, onBlur, onChange, onFocus, }: RichTextEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function RichTextEditor({ disabled, error, height, helperText, maxCharacters, name, placeholder, readonly, showCharacterCount, showToolbar, showWordCount, toolbarConfig, translation, value, width, onBlur, onChange, onFocus, onMarkdownChange, }: RichTextEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,70 +3,82 @@ import { DEFAULT_RICH_TEXT_EDITOR_TOOLBAR_CONFIG as t, DEFAULT_RICH_TEXT_EDITOR_
|
|
|
3
3
|
import { RichTextEditorContent as r } from "./RichTextEditorContent.js";
|
|
4
4
|
import { RichTextEditorToolbar as i } from "./RichTextEditorToolbar.js";
|
|
5
5
|
import { RichTextEditorFooter as a } from "./RichTextEditorFooter.js";
|
|
6
|
-
import { useEffect as o,
|
|
7
|
-
import { Box as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { useEditor as
|
|
10
|
-
import { StarterKit as
|
|
11
|
-
import { TextStyle as
|
|
12
|
-
import { Color as
|
|
13
|
-
import { Highlight as
|
|
14
|
-
import { Placeholder as
|
|
15
|
-
import { CharacterCount as
|
|
16
|
-
import { TableKit as
|
|
17
|
-
import { Image as
|
|
18
|
-
import { Markdown as
|
|
6
|
+
import { useEffect as o, useRef as s, useState as c } from "react";
|
|
7
|
+
import { Box as l, Divider as u, Paper as d } from "@mui/material";
|
|
8
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
|
+
import { useEditor as h } from "@tiptap/react";
|
|
10
|
+
import { StarterKit as g } from "@tiptap/starter-kit";
|
|
11
|
+
import { TextStyle as _ } from "@tiptap/extension-text-style";
|
|
12
|
+
import { Color as v } from "@tiptap/extension-color";
|
|
13
|
+
import { Highlight as ee } from "@tiptap/extension-highlight";
|
|
14
|
+
import { Placeholder as y } from "@tiptap/extension-placeholder";
|
|
15
|
+
import { CharacterCount as b } from "@tiptap/extension-character-count";
|
|
16
|
+
import { TableKit as x } from "@tiptap/extension-table";
|
|
17
|
+
import { Image as S } from "@tiptap/extension-image";
|
|
18
|
+
import { Markdown as C } from "tiptap-markdown";
|
|
19
19
|
//#region src/components/rich-text-editor/RichTextEditor.tsx
|
|
20
|
-
function
|
|
21
|
-
let
|
|
20
|
+
function w({ disabled: w = !1, error: T = !1, height: E, helperText: D, maxCharacters: O, name: k, placeholder: A, readonly: j = !1, showCharacterCount: M = !1, showToolbar: N = !0, showWordCount: P = !1, toolbarConfig: F, translation: I, value: L, width: R, onBlur: z, onChange: B, onFocus: V, onMarkdownChange: te }) {
|
|
21
|
+
let H = {
|
|
22
22
|
...n,
|
|
23
|
-
...
|
|
24
|
-
},
|
|
23
|
+
...I
|
|
24
|
+
}, U = {
|
|
25
25
|
...t,
|
|
26
|
-
...
|
|
27
|
-
}, [
|
|
26
|
+
...F
|
|
27
|
+
}, [W, G] = c(!1), [K, q] = c(!1), J = s(K);
|
|
28
|
+
o(() => {
|
|
29
|
+
J.current = K;
|
|
30
|
+
}, [K]);
|
|
31
|
+
let Y = e(E), X = e(R), Z = Y === "auto", Q = Z ? void 0 : Y ?? 200, ne = O !== void 0 && O > 0 || M || P, $ = h({
|
|
28
32
|
shouldRerenderOnTransaction: !0,
|
|
29
33
|
extensions: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
g.configure({ link: { openOnClick: !1 } }),
|
|
35
|
+
_,
|
|
36
|
+
v,
|
|
37
|
+
ee.configure({ multicolor: !0 }),
|
|
38
|
+
C.configure({
|
|
35
39
|
transformPastedText: !0,
|
|
36
40
|
transformCopiedText: !1
|
|
37
41
|
}),
|
|
38
|
-
|
|
39
|
-
...
|
|
40
|
-
...
|
|
42
|
+
y.configure({ placeholder: A ?? "" }),
|
|
43
|
+
...U.showTableButton ? [x] : [],
|
|
44
|
+
...U.showImageButton ? [S.configure({
|
|
41
45
|
inline: !1,
|
|
42
46
|
allowBase64: !0
|
|
43
47
|
})] : [],
|
|
44
|
-
...
|
|
48
|
+
...ne ? O !== void 0 && O > 0 ? [b.configure({ limit: O })] : [b] : []
|
|
45
49
|
],
|
|
46
|
-
content:
|
|
47
|
-
editable: !
|
|
50
|
+
content: L ?? "",
|
|
51
|
+
editable: !w && !j,
|
|
52
|
+
editorProps: { handlePaste(e, t) {
|
|
53
|
+
if (!J.current) return !1;
|
|
54
|
+
let n = t.clipboardData?.getData("text/plain");
|
|
55
|
+
if (n == null) return !1;
|
|
56
|
+
t.preventDefault();
|
|
57
|
+
let { state: r } = e;
|
|
58
|
+
return e.dispatch(r.tr.insertText(n, r.selection.from, r.selection.to)), !0;
|
|
59
|
+
} },
|
|
48
60
|
onUpdate({ editor: e }) {
|
|
49
|
-
|
|
61
|
+
B?.(e.getHTML()), te?.(e.storage.markdown.getMarkdown());
|
|
50
62
|
},
|
|
51
63
|
onBlur() {
|
|
52
|
-
|
|
64
|
+
z?.();
|
|
53
65
|
},
|
|
54
66
|
onFocus() {
|
|
55
|
-
|
|
67
|
+
V?.();
|
|
56
68
|
}
|
|
57
69
|
});
|
|
58
70
|
o(() => {
|
|
59
|
-
|
|
60
|
-
}, [
|
|
61
|
-
|
|
71
|
+
!$ || L === void 0 || $.getHTML() !== L && $.commands.setContent(L, { emitUpdate: !1 });
|
|
72
|
+
}, [$, L]), o(() => {
|
|
73
|
+
$ && $.setEditable(!w && !j);
|
|
62
74
|
}, [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
$,
|
|
76
|
+
w,
|
|
77
|
+
j
|
|
66
78
|
]);
|
|
67
|
-
let
|
|
68
|
-
return /* @__PURE__ */
|
|
69
|
-
sx:
|
|
79
|
+
let re = $?.storage.characterCount?.characters?.() ?? 0, ie = $?.storage.characterCount?.words?.() ?? 0, ae = M || O !== void 0 && O > 0 || P || !!D;
|
|
80
|
+
return /* @__PURE__ */ m(l, {
|
|
81
|
+
sx: W ? {
|
|
70
82
|
position: "fixed",
|
|
71
83
|
top: 0,
|
|
72
84
|
left: 0,
|
|
@@ -78,58 +90,60 @@ function C({ disabled: C = !1, error: w = !1, height: T, helperText: E, maxChara
|
|
|
78
90
|
bgcolor: "background.default",
|
|
79
91
|
p: 1
|
|
80
92
|
} : {
|
|
81
|
-
width:
|
|
82
|
-
...
|
|
93
|
+
width: X ?? "100%",
|
|
94
|
+
...Z ? {
|
|
83
95
|
display: "flex",
|
|
84
96
|
flexDirection: "column",
|
|
85
97
|
flex: 1
|
|
86
98
|
} : {}
|
|
87
99
|
},
|
|
88
100
|
children: [
|
|
89
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ m(d, {
|
|
90
102
|
variant: "outlined",
|
|
91
103
|
sx: {
|
|
92
104
|
display: "flex",
|
|
93
105
|
flexDirection: "column",
|
|
94
106
|
overflow: "hidden",
|
|
95
|
-
...
|
|
96
|
-
borderColor:
|
|
107
|
+
...W || Z ? { flex: 1 } : { height: Q },
|
|
108
|
+
borderColor: T ? "error.main" : void 0,
|
|
97
109
|
"&:focus-within": {
|
|
98
|
-
borderColor:
|
|
110
|
+
borderColor: T ? "error.main" : "primary.main",
|
|
99
111
|
borderWidth: 2
|
|
100
112
|
}
|
|
101
113
|
},
|
|
102
|
-
children: [
|
|
103
|
-
editor:
|
|
104
|
-
toolbarConfig:
|
|
105
|
-
translation:
|
|
106
|
-
disabled:
|
|
107
|
-
isFullscreen:
|
|
108
|
-
onToggleFullscreen: () =>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
children: [N && !j && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(i, {
|
|
115
|
+
editor: $,
|
|
116
|
+
toolbarConfig: U,
|
|
117
|
+
translation: H,
|
|
118
|
+
disabled: w,
|
|
119
|
+
isFullscreen: W,
|
|
120
|
+
onToggleFullscreen: () => G((e) => !e),
|
|
121
|
+
pasteAsPlainText: K,
|
|
122
|
+
onTogglePasteAsPlainText: () => q((e) => !e)
|
|
123
|
+
}), /* @__PURE__ */ p(u, {})] }), /* @__PURE__ */ p(r, {
|
|
124
|
+
editor: $,
|
|
125
|
+
error: T,
|
|
126
|
+
disabled: w,
|
|
127
|
+
readonly: j
|
|
114
128
|
})]
|
|
115
129
|
}),
|
|
116
|
-
|
|
117
|
-
helperText:
|
|
118
|
-
error:
|
|
119
|
-
showCharacterCount:
|
|
120
|
-
charCount:
|
|
121
|
-
maxCharacters:
|
|
122
|
-
showWordCount:
|
|
123
|
-
wordCount:
|
|
124
|
-
translation:
|
|
130
|
+
ae && /* @__PURE__ */ p(a, {
|
|
131
|
+
helperText: D,
|
|
132
|
+
error: T,
|
|
133
|
+
showCharacterCount: M || O !== void 0 && O > 0,
|
|
134
|
+
charCount: re,
|
|
135
|
+
maxCharacters: O && O > 0 ? O : void 0,
|
|
136
|
+
showWordCount: P,
|
|
137
|
+
wordCount: ie,
|
|
138
|
+
translation: H
|
|
125
139
|
}),
|
|
126
|
-
|
|
140
|
+
k && /* @__PURE__ */ p("input", {
|
|
127
141
|
type: "hidden",
|
|
128
|
-
name:
|
|
129
|
-
value:
|
|
142
|
+
name: k,
|
|
143
|
+
value: $ ? $.getHTML() : ""
|
|
130
144
|
})
|
|
131
145
|
]
|
|
132
146
|
});
|
|
133
147
|
}
|
|
134
148
|
//#endregion
|
|
135
|
-
export {
|
|
149
|
+
export { w as RichTextEditor };
|
|
@@ -24,6 +24,10 @@ export type RichTextEditorToolbarConfig = {
|
|
|
24
24
|
showImageButton?: boolean;
|
|
25
25
|
/** Emoji-Picker — standardmäßig deaktiviert (opt-in) */
|
|
26
26
|
showEmojiButton?: boolean;
|
|
27
|
+
/** Toggle: eingefügter Inhalt wird von Formatierung befreit — standardmäßig deaktiviert (opt-in) */
|
|
28
|
+
showPasteAsPlainTextButton?: boolean;
|
|
29
|
+
/** Markdown-Import/Export-Dialog — standardmäßig deaktiviert (opt-in) */
|
|
30
|
+
showMarkdownButton?: boolean;
|
|
27
31
|
};
|
|
28
32
|
export declare const DEFAULT_RICH_TEXT_EDITOR_TOOLBAR_CONFIG: Required<RichTextEditorToolbarConfig>;
|
|
29
33
|
export type RichTextEditorTranslation = {
|
|
@@ -77,8 +81,26 @@ export type RichTextEditorTranslation = {
|
|
|
77
81
|
imageDialogCancel: string;
|
|
78
82
|
emoji: string;
|
|
79
83
|
emojiSearchPlaceholder: string;
|
|
84
|
+
/** Tooltip wenn Klartext-Paste AUS ist (Klick aktiviert es) @since 3.8.0 */
|
|
85
|
+
pasteAsPlainText?: string;
|
|
86
|
+
/** Tooltip wenn Klartext-Paste AN ist (Klick deaktiviert es) @since 3.8.0 */
|
|
87
|
+
pasteAsHtml?: string;
|
|
88
|
+
/** Tooltip für den Markdown-Button @since 3.8.0 */
|
|
89
|
+
markdown?: string;
|
|
90
|
+
/** @since 3.8.0 */
|
|
91
|
+
markdownDialogTitle?: string;
|
|
92
|
+
/** @since 3.8.0 */
|
|
93
|
+
markdownDialogDescription?: string;
|
|
94
|
+
/** @since 3.8.0 */
|
|
95
|
+
markdownDialogApply?: string;
|
|
96
|
+
/** @since 3.8.0 */
|
|
97
|
+
markdownDialogCancel?: string;
|
|
98
|
+
/** @since 3.8.0 */
|
|
99
|
+
markdownDialogCopy?: string;
|
|
100
|
+
/** @since 3.8.0 */
|
|
101
|
+
markdownDialogCopied?: string;
|
|
80
102
|
};
|
|
81
|
-
export declare const DEFAULT_RICH_TEXT_EDITOR_TRANSLATION: RichTextEditorTranslation
|
|
103
|
+
export declare const DEFAULT_RICH_TEXT_EDITOR_TRANSLATION: Required<RichTextEditorTranslation>;
|
|
82
104
|
export type RichTextEditorProps = {
|
|
83
105
|
disabled?: boolean;
|
|
84
106
|
error?: boolean;
|
|
@@ -102,4 +124,6 @@ export type RichTextEditorProps = {
|
|
|
102
124
|
onBlur?: () => void;
|
|
103
125
|
onChange?: (value: string) => void;
|
|
104
126
|
onFocus?: () => void;
|
|
127
|
+
/** Wird bei jeder Änderung zusätzlich zu onChange mit dem Inhalt als Markdown aufgerufen */
|
|
128
|
+
onMarkdownChange?: (markdown: string) => void;
|
|
105
129
|
};
|
|
@@ -20,7 +20,9 @@ var e = {
|
|
|
20
20
|
showFullscreenButton: !1,
|
|
21
21
|
showTableButton: !1,
|
|
22
22
|
showImageButton: !1,
|
|
23
|
-
showEmojiButton: !1
|
|
23
|
+
showEmojiButton: !1,
|
|
24
|
+
showPasteAsPlainTextButton: !1,
|
|
25
|
+
showMarkdownButton: !1
|
|
24
26
|
}, t = {
|
|
25
27
|
bold: "Bold",
|
|
26
28
|
italic: "Italic",
|
|
@@ -68,7 +70,16 @@ var e = {
|
|
|
68
70
|
imageDialogSave: "Insert",
|
|
69
71
|
imageDialogCancel: "Cancel",
|
|
70
72
|
emoji: "Emoji",
|
|
71
|
-
emojiSearchPlaceholder: "Search emoji…"
|
|
73
|
+
emojiSearchPlaceholder: "Search emoji…",
|
|
74
|
+
pasteAsPlainText: "Paste as plain text",
|
|
75
|
+
pasteAsHtml: "Paste with formatting",
|
|
76
|
+
markdown: "Markdown",
|
|
77
|
+
markdownDialogTitle: "Markdown",
|
|
78
|
+
markdownDialogDescription: "Edit as Markdown, then apply to replace the editor content. Copy to export.",
|
|
79
|
+
markdownDialogApply: "Apply",
|
|
80
|
+
markdownDialogCancel: "Cancel",
|
|
81
|
+
markdownDialogCopy: "Copy",
|
|
82
|
+
markdownDialogCopied: "Copied!"
|
|
72
83
|
};
|
|
73
84
|
//#endregion
|
|
74
85
|
export { e as DEFAULT_RICH_TEXT_EDITOR_TOOLBAR_CONFIG, t as DEFAULT_RICH_TEXT_EDITOR_TRANSLATION };
|
|
@@ -4,7 +4,7 @@ type RichTextEditorEmojiPickerProps = {
|
|
|
4
4
|
open: boolean;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
onSelect: (emoji: string) => void;
|
|
7
|
-
translation: RichTextEditorTranslation
|
|
7
|
+
translation: Required<RichTextEditorTranslation>;
|
|
8
8
|
};
|
|
9
9
|
export declare function RichTextEditorEmojiPicker({ anchorEl, open, onClose, onSelect, translation: t, }: RichTextEditorEmojiPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -7,7 +7,7 @@ type RichTextEditorFooterProps = {
|
|
|
7
7
|
maxCharacters?: number;
|
|
8
8
|
showWordCount?: boolean;
|
|
9
9
|
wordCount: number;
|
|
10
|
-
translation: RichTextEditorTranslation
|
|
10
|
+
translation: Required<RichTextEditorTranslation>;
|
|
11
11
|
};
|
|
12
12
|
export declare function RichTextEditorFooter({ helperText, error, showCharacterCount, charCount, maxCharacters, showWordCount, wordCount, translation: t, }: RichTextEditorFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -4,7 +4,7 @@ type RichTextEditorImageDialogProps = {
|
|
|
4
4
|
open: boolean;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
editor: Editor;
|
|
7
|
-
translation: RichTextEditorTranslation
|
|
7
|
+
translation: Required<RichTextEditorTranslation>;
|
|
8
8
|
};
|
|
9
9
|
export declare function RichTextEditorImageDialog({ open, onClose, editor, translation: t, }: RichTextEditorImageDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -4,7 +4,7 @@ type RichTextEditorLinkDialogProps = {
|
|
|
4
4
|
open: boolean;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
editor: Editor;
|
|
7
|
-
translation: RichTextEditorTranslation
|
|
7
|
+
translation: Required<RichTextEditorTranslation>;
|
|
8
8
|
};
|
|
9
9
|
export declare function RichTextEditorLinkDialog({ open, onClose, editor, translation: t, }: RichTextEditorLinkDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Editor } from "@tiptap/react";
|
|
2
|
+
import { type RichTextEditorTranslation } from "./RichTextEditor.types";
|
|
3
|
+
type RichTextEditorMarkdownDialogProps = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
editor: Editor;
|
|
7
|
+
translation: Required<RichTextEditorTranslation>;
|
|
8
|
+
};
|
|
9
|
+
export declare function RichTextEditorMarkdownDialog({ open, onClose, editor, translation: t, }: RichTextEditorMarkdownDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useEffect as e, useState as t } from "react";
|
|
2
|
+
import { Box as n, Button as r, Dialog as i, DialogActions as a, DialogContent as o, DialogTitle as s, TextField as c, Typography as l } from "@mui/material";
|
|
3
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
|
+
import f from "@mui/icons-material/ContentCopy";
|
|
5
|
+
import p from "@mui/icons-material/Check";
|
|
6
|
+
//#region src/components/rich-text-editor/RichTextEditorMarkdownDialog.tsx
|
|
7
|
+
function m({ open: m, onClose: h, editor: g, translation: _ }) {
|
|
8
|
+
let [v, y] = t(""), [b, x] = t(!1);
|
|
9
|
+
e(() => {
|
|
10
|
+
m && y(g.storage.markdown.getMarkdown());
|
|
11
|
+
}, [m, g]);
|
|
12
|
+
function S() {
|
|
13
|
+
g.commands.setContent(v), h();
|
|
14
|
+
}
|
|
15
|
+
function C() {
|
|
16
|
+
navigator.clipboard.writeText(v).then(() => {
|
|
17
|
+
x(!0), setTimeout(() => x(!1), 2e3);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ d(i, {
|
|
21
|
+
open: m,
|
|
22
|
+
onClose: h,
|
|
23
|
+
maxWidth: "sm",
|
|
24
|
+
fullWidth: !0,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ u(s, { children: _.markdownDialogTitle }),
|
|
27
|
+
/* @__PURE__ */ d(o, {
|
|
28
|
+
sx: {
|
|
29
|
+
display: "flex",
|
|
30
|
+
flexDirection: "column",
|
|
31
|
+
gap: 1.5,
|
|
32
|
+
pt: "16px !important"
|
|
33
|
+
},
|
|
34
|
+
children: [/* @__PURE__ */ u(l, {
|
|
35
|
+
variant: "body2",
|
|
36
|
+
color: "text.secondary",
|
|
37
|
+
children: _.markdownDialogDescription
|
|
38
|
+
}), /* @__PURE__ */ u(c, {
|
|
39
|
+
autoFocus: !0,
|
|
40
|
+
fullWidth: !0,
|
|
41
|
+
multiline: !0,
|
|
42
|
+
minRows: 8,
|
|
43
|
+
maxRows: 16,
|
|
44
|
+
value: v,
|
|
45
|
+
onChange: (e) => y(e.target.value),
|
|
46
|
+
variant: "outlined",
|
|
47
|
+
size: "small",
|
|
48
|
+
sx: { fontFamily: "monospace" },
|
|
49
|
+
slotProps: { htmlInput: { style: {
|
|
50
|
+
fontFamily: "monospace",
|
|
51
|
+
fontSize: "0.8125rem"
|
|
52
|
+
} } }
|
|
53
|
+
})]
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ d(a, {
|
|
56
|
+
sx: {
|
|
57
|
+
px: 3,
|
|
58
|
+
pb: 2,
|
|
59
|
+
gap: 1
|
|
60
|
+
},
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ u(n, {
|
|
63
|
+
sx: { flex: 1 },
|
|
64
|
+
children: /* @__PURE__ */ u(r, {
|
|
65
|
+
onClick: C,
|
|
66
|
+
startIcon: b ? /* @__PURE__ */ u(p, {
|
|
67
|
+
fontSize: "small",
|
|
68
|
+
color: "success"
|
|
69
|
+
}) : /* @__PURE__ */ u(f, { fontSize: "small" }),
|
|
70
|
+
children: b ? _.markdownDialogCopied : _.markdownDialogCopy
|
|
71
|
+
})
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ u(r, {
|
|
74
|
+
onClick: h,
|
|
75
|
+
children: _.markdownDialogCancel
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ u(r, {
|
|
78
|
+
onClick: S,
|
|
79
|
+
variant: "contained",
|
|
80
|
+
children: _.markdownDialogApply
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { m as RichTextEditorMarkdownDialog };
|
|
@@ -2,7 +2,7 @@ import { type Editor } from "@tiptap/react";
|
|
|
2
2
|
import { type RichTextEditorTranslation } from "./RichTextEditor.types";
|
|
3
3
|
type RichTextEditorTableMenuProps = {
|
|
4
4
|
editor: Editor | null;
|
|
5
|
-
translation: RichTextEditorTranslation
|
|
5
|
+
translation: Required<RichTextEditorTranslation>;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare function RichTextEditorTableMenu({ editor, translation: t, disabled, }: RichTextEditorTableMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,10 +3,12 @@ import { type RichTextEditorTranslation, type RichTextEditorToolbarConfig } from
|
|
|
3
3
|
type RichTextEditorToolbarProps = {
|
|
4
4
|
editor: Editor | null;
|
|
5
5
|
toolbarConfig: Required<RichTextEditorToolbarConfig>;
|
|
6
|
-
translation: RichTextEditorTranslation
|
|
6
|
+
translation: Required<RichTextEditorTranslation>;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
isFullscreen: boolean;
|
|
9
9
|
onToggleFullscreen: () => void;
|
|
10
|
+
pasteAsPlainText: boolean;
|
|
11
|
+
onTogglePasteAsPlainText: () => void;
|
|
10
12
|
};
|
|
11
|
-
export declare function RichTextEditorToolbar({ editor, toolbarConfig: tc, translation: t, disabled, isFullscreen, onToggleFullscreen, }: RichTextEditorToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function RichTextEditorToolbar({ editor, toolbarConfig: tc, translation: t, disabled, isFullscreen, onToggleFullscreen, pasteAsPlainText, onTogglePasteAsPlainText, }: RichTextEditorToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
export {};
|