reactjs-tiptap-editor 0.2.29 → 0.3.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/lib/ActionMenuButton-Bycn676n.js +33 -0
- package/lib/ActionMenuButton-CpFNwSUZ.cjs +1 -0
- package/lib/Attachment.cjs +19 -0
- package/lib/Attachment.d.cts +344 -0
- package/lib/Attachment.d.ts +344 -0
- package/lib/Attachment.js +259 -0
- package/lib/Blockquote.cjs +1 -0
- package/lib/Blockquote.d.cts +343 -0
- package/lib/Blockquote.d.ts +343 -0
- package/lib/Blockquote.js +65 -0
- package/lib/Bold.cjs +1 -0
- package/lib/Bold.d.cts +343 -0
- package/lib/Bold.d.ts +343 -0
- package/lib/Bold.js +90 -0
- package/lib/BulletList.cjs +1 -0
- package/lib/BulletList.d.cts +343 -0
- package/lib/BulletList.d.ts +343 -0
- package/lib/BulletList.js +72 -0
- package/lib/Clear.cjs +1 -0
- package/lib/Clear.d.cts +342 -0
- package/lib/Clear.d.ts +342 -0
- package/lib/Clear.js +23 -0
- package/lib/Code.cjs +1 -0
- package/lib/Code.d.cts +343 -0
- package/lib/Code.d.ts +343 -0
- package/lib/Code.js +70 -0
- package/lib/CodeBlock.cjs +39 -0
- package/lib/CodeBlock.d.cts +352 -0
- package/lib/CodeBlock.d.ts +352 -0
- package/lib/CodeBlock.js +3639 -0
- package/lib/Color.cjs +1 -0
- package/lib/Color.d.cts +350 -0
- package/lib/Color.d.ts +350 -0
- package/lib/Color.js +141 -0
- package/lib/Document.cjs +1 -0
- package/lib/Document.d.cts +272 -0
- package/lib/Document.d.ts +272 -0
- package/lib/Document.js +13 -0
- package/lib/Drawer-BZadE1gM.js +1367 -0
- package/lib/Drawer-rwnFvgZR.cjs +1 -0
- package/lib/Drawer.cjs +1 -0
- package/lib/Drawer.d.cts +344 -0
- package/lib/Drawer.d.ts +344 -0
- package/lib/Drawer.js +7 -0
- package/lib/Emoji.cjs +1 -0
- package/lib/Emoji.d.cts +277 -0
- package/lib/Emoji.d.ts +277 -0
- package/lib/Emoji.js +2168 -0
- package/lib/Excalidraw-B2414Smc.js +651 -0
- package/lib/Excalidraw-D21vMFe0.cjs +1 -0
- package/lib/Excalidraw.cjs +1 -0
- package/lib/Excalidraw.d.cts +278 -0
- package/lib/Excalidraw.d.ts +278 -0
- package/lib/Excalidraw.js +6 -0
- package/lib/ExportPdf.cjs +15 -0
- package/lib/ExportPdf.d.cts +270 -0
- package/lib/ExportPdf.d.ts +270 -0
- package/lib/ExportPdf.js +67 -0
- package/lib/ExportWord.cjs +1 -0
- package/lib/ExportWord.d.cts +341 -0
- package/lib/ExportWord.d.ts +341 -0
- package/lib/ExportWord.js +72 -0
- package/lib/FontFamily.cjs +1 -0
- package/lib/FontFamily.d.cts +354 -0
- package/lib/FontFamily.d.ts +354 -0
- package/lib/FontFamily.js +136 -0
- package/lib/FontSize.cjs +1 -0
- package/lib/FontSize.d.cts +359 -0
- package/lib/FontSize.d.ts +359 -0
- package/lib/FontSize.js +110 -0
- package/lib/FormatPainter.cjs +1 -0
- package/lib/FormatPainter.d.cts +353 -0
- package/lib/FormatPainter.d.ts +353 -0
- package/lib/FormatPainter.js +74 -0
- package/lib/Heading.cjs +1 -0
- package/lib/Heading.d.cts +343 -0
- package/lib/Heading.d.ts +343 -0
- package/lib/Heading.js +147 -0
- package/lib/Highlight.cjs +1 -0
- package/lib/Highlight.d.cts +344 -0
- package/lib/Highlight.d.ts +344 -0
- package/lib/Highlight.js +85 -0
- package/lib/History.cjs +1 -0
- package/lib/History.d.cts +343 -0
- package/lib/History.d.ts +343 -0
- package/lib/History.js +431 -0
- package/lib/HorizontalRule.cjs +1 -0
- package/lib/HorizontalRule.d.cts +343 -0
- package/lib/HorizontalRule.d.ts +343 -0
- package/lib/HorizontalRule.js +87 -0
- package/lib/Iframe.cjs +1 -0
- package/lib/Iframe.d.cts +277 -0
- package/lib/Iframe.d.ts +277 -0
- package/lib/Iframe.js +6 -0
- package/lib/Image.cjs +1 -0
- package/lib/Image.d.cts +370 -0
- package/lib/Image.d.ts +370 -0
- package/lib/Image.js +7 -0
- package/lib/ImageGif.cjs +1 -0
- package/lib/ImageGif.d.cts +292 -0
- package/lib/ImageGif.d.ts +292 -0
- package/lib/ImageGif.js +7 -0
- package/lib/ImportWord.cjs +231 -0
- package/lib/ImportWord.d.cts +353 -0
- package/lib/ImportWord.d.ts +353 -0
- package/lib/ImportWord.js +16620 -0
- package/lib/Indent.cjs +1 -0
- package/lib/Indent.d.cts +344 -0
- package/lib/Indent.d.ts +344 -0
- package/lib/Indent.js +78 -0
- package/lib/Italic.cjs +1 -0
- package/lib/Italic.d.cts +343 -0
- package/lib/Italic.d.ts +343 -0
- package/lib/Italic.js +91 -0
- package/lib/Katex.cjs +1 -0
- package/lib/Katex.d.cts +279 -0
- package/lib/Katex.d.ts +279 -0
- package/lib/Katex.js +197 -0
- package/lib/LineHeight.cjs +1 -0
- package/lib/LineHeight.d.cts +347 -0
- package/lib/LineHeight.d.ts +347 -0
- package/lib/LineHeight.js +137 -0
- package/lib/Link.cjs +5 -0
- package/lib/Link.d.cts +343 -0
- package/lib/Link.d.ts +343 -0
- package/lib/Link.js +1048 -0
- package/lib/ListItem.cjs +1 -0
- package/lib/ListItem.d.cts +269 -0
- package/lib/ListItem.d.ts +269 -0
- package/lib/ListItem.js +33 -0
- package/lib/Mention.cjs +1 -0
- package/lib/Mention.d.cts +272 -0
- package/lib/Mention.d.ts +272 -0
- package/lib/Mention.js +233 -0
- package/lib/Mermaid.cjs +2 -0
- package/lib/Mermaid.d.cts +344 -0
- package/lib/Mermaid.d.ts +344 -0
- package/lib/Mermaid.js +390 -0
- package/lib/MoreMark.cjs +1 -0
- package/lib/MoreMark.d.cts +355 -0
- package/lib/MoreMark.d.ts +355 -0
- package/lib/MoreMark.js +95 -0
- package/lib/MultiColumn.cjs +1 -0
- package/lib/MultiColumn.d.cts +277 -0
- package/lib/MultiColumn.d.ts +277 -0
- package/lib/MultiColumn.js +8 -0
- package/lib/OrderedList.cjs +1 -0
- package/lib/OrderedList.d.cts +343 -0
- package/lib/OrderedList.d.ts +343 -0
- package/lib/OrderedList.js +90 -0
- package/lib/RichTextEditor-Cy9XKEI5.js +11178 -0
- package/lib/RichTextEditor-DkpDEr5U.cjs +137 -0
- package/lib/SearchAndReplace.cjs +1 -0
- package/lib/SearchAndReplace.d.cts +358 -0
- package/lib/SearchAndReplace.d.ts +358 -0
- package/lib/SearchAndReplace.js +339 -0
- package/lib/Selection.cjs +1 -0
- package/lib/Selection.d.cts +272 -0
- package/lib/Selection.d.ts +272 -0
- package/lib/Selection.js +25 -0
- package/lib/SlashCommand.cjs +1 -0
- package/lib/SlashCommand.d.cts +299 -0
- package/lib/SlashCommand.d.ts +299 -0
- package/lib/SlashCommand.js +369 -0
- package/lib/Strike.cjs +1 -0
- package/lib/Strike.d.cts +343 -0
- package/lib/Strike.d.ts +343 -0
- package/lib/Strike.js +80 -0
- package/lib/SubAndSuperScript.cjs +1 -0
- package/lib/SubAndSuperScript.d.cts +358 -0
- package/lib/SubAndSuperScript.d.ts +358 -0
- package/lib/SubAndSuperScript.js +41 -0
- package/lib/Table.cjs +1 -0
- package/lib/Table.d.cts +366 -0
- package/lib/Table.d.ts +366 -0
- package/lib/Table.js +2165 -0
- package/lib/TableOfContent.cjs +1 -0
- package/lib/TableOfContent.d.cts +274 -0
- package/lib/TableOfContent.d.ts +274 -0
- package/lib/TableOfContent.js +184 -0
- package/lib/TaskList.cjs +1 -0
- package/lib/TaskList.d.cts +349 -0
- package/lib/TaskList.d.ts +349 -0
- package/lib/TaskList.js +175 -0
- package/lib/TextAlign.cjs +1 -0
- package/lib/TextAlign.d.cts +353 -0
- package/lib/TextAlign.d.ts +353 -0
- package/lib/TextAlign.js +165 -0
- package/lib/TextBubble.cjs +1 -0
- package/lib/TextBubble.d.cts +343 -0
- package/lib/TextBubble.d.ts +343 -0
- package/lib/TextBubble.js +131 -0
- package/lib/TextDirection.cjs +1 -0
- package/lib/TextDirection.d.cts +270 -0
- package/lib/TextDirection.d.ts +270 -0
- package/lib/TextDirection.js +142 -0
- package/lib/TextUnderline.cjs +1 -0
- package/lib/TextUnderline.d.cts +343 -0
- package/lib/TextUnderline.d.ts +343 -0
- package/lib/TextUnderline.js +61 -0
- package/lib/TrailingNode.cjs +1 -0
- package/lib/TrailingNode.d.cts +280 -0
- package/lib/TrailingNode.d.ts +280 -0
- package/lib/TrailingNode.js +41 -0
- package/lib/Twitter-B_tSItrW.js +1743 -0
- package/lib/Twitter-CfDC4bFV.cjs +17 -0
- package/lib/Twitter.cjs +1 -0
- package/lib/Twitter.d.cts +295 -0
- package/lib/Twitter.d.ts +295 -0
- package/lib/Twitter.js +6 -0
- package/lib/Video.cjs +1 -0
- package/lib/Video.d.cts +371 -0
- package/lib/Video.d.ts +371 -0
- package/lib/Video.js +6 -0
- package/lib/bubble-extra.cjs +2 -0
- package/lib/bubble-extra.d.cts +294 -0
- package/lib/bubble-extra.d.ts +294 -0
- package/lib/bubble-extra.js +623 -0
- package/lib/dom-dataset-CAXnsjYE.cjs +33 -0
- package/lib/dom-dataset-CJ7GyQ2E.js +999 -0
- package/lib/index-COecBbaE.cjs +89 -0
- package/lib/index-ClFtfQ0J.cjs +1 -0
- package/lib/index-CvYIX2-x.js +129 -0
- package/lib/index-CySbCeQd.cjs +1 -0
- package/lib/{index-CO-iymkb.js → index-D9llIWB5.js} +442 -101
- package/lib/index-DXBa3JBo.js +46 -0
- package/lib/index-DjP7Onch.cjs +1 -0
- package/lib/index-Drmyqk9P.js +12322 -0
- package/lib/index-DuhDIOel.js +76 -0
- package/lib/index-LbrE7K9i.cjs +1 -0
- package/lib/index.cjs +2 -1
- package/lib/index.d.cts +290 -108
- package/lib/index.d.ts +290 -108
- package/lib/index.js +587 -13
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +108 -108
- package/lib/locale-bundle.d.ts +108 -108
- package/lib/locale-bundle.js +1 -1
- package/lib/shortId-Bfj8TyNr.cjs +2 -0
- package/lib/shortId-WJVkrvml.js +30 -0
- package/lib/style.css +1 -1
- package/lib/textarea-B45fP3gP.cjs +1 -0
- package/lib/textarea-DXTdXr2y.js +20 -0
- package/package.json +678 -15
- package/lib/RichTextEditor-Ce2IeNE6.js +0 -8265
- package/lib/RichTextEditor-hDDApaDD.cjs +0 -136
- package/lib/extension-bundle.cjs +0 -33
- package/lib/extension-bundle.d.cts +0 -951
- package/lib/extension-bundle.d.ts +0 -951
- package/lib/extension-bundle.js +0 -5982
- package/lib/index-CJ6Hb9MN.cjs +0 -1
- package/lib/tiptap-DOP8lVCQ.js +0 -5950
- package/lib/tiptap-Dq62HiQ9.cjs +0 -113
- package/lib/vendor-BbgkyoD-.js +0 -40297
- package/lib/vendor-DdwtMmSr.cjs +0 -302
package/lib/TextAlign.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { E as T } from "./index-Drmyqk9P.js";
|
|
2
|
+
import { jsxs as g, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as b } from "react";
|
|
4
|
+
import { P as M, m as v, A as S, k as A, n as C, T as j, a as K, r as w, b as P, s as z } from "./RichTextEditor-Cy9XKEI5.js";
|
|
5
|
+
const L = T.create({
|
|
6
|
+
name: "textAlign",
|
|
7
|
+
addOptions() {
|
|
8
|
+
return {
|
|
9
|
+
types: [],
|
|
10
|
+
alignments: ["left", "center", "right", "justify"],
|
|
11
|
+
defaultAlignment: null
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
addGlobalAttributes() {
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
types: this.options.types,
|
|
18
|
+
attributes: {
|
|
19
|
+
textAlign: {
|
|
20
|
+
default: this.options.defaultAlignment,
|
|
21
|
+
parseHTML: (t) => {
|
|
22
|
+
const i = t.style.textAlign;
|
|
23
|
+
return this.options.alignments.includes(i) ? i : this.options.defaultAlignment;
|
|
24
|
+
},
|
|
25
|
+
renderHTML: (t) => t.textAlign ? { style: `text-align: ${t.textAlign}` } : {}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
addCommands() {
|
|
32
|
+
return {
|
|
33
|
+
setTextAlign: (t) => ({ commands: i }) => this.options.alignments.includes(t) ? this.options.types.map((l) => i.updateAttributes(l, { textAlign: t })).every((l) => l) : !1,
|
|
34
|
+
unsetTextAlign: () => ({ commands: t }) => this.options.types.map((i) => t.resetAttributes(i, "textAlign")).every((i) => i)
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
addKeyboardShortcuts() {
|
|
38
|
+
return {
|
|
39
|
+
"Mod-Shift-l": () => this.editor.commands.setTextAlign("left"),
|
|
40
|
+
"Mod-Shift-e": () => this.editor.commands.setTextAlign("center"),
|
|
41
|
+
"Mod-Shift-r": () => this.editor.commands.setTextAlign("right"),
|
|
42
|
+
"Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
function N(t) {
|
|
47
|
+
var l;
|
|
48
|
+
const i = b(() => {
|
|
49
|
+
var a;
|
|
50
|
+
const e = (a = t == null ? void 0 : t.items) == null ? void 0 : a.find((c) => c.isActive());
|
|
51
|
+
return e && !e.default ? {
|
|
52
|
+
...e,
|
|
53
|
+
icon: e.icon ? e.icon : t.icon
|
|
54
|
+
} : {
|
|
55
|
+
title: t == null ? void 0 : t.tooltip,
|
|
56
|
+
icon: t.icon,
|
|
57
|
+
isActive: () => !1
|
|
58
|
+
};
|
|
59
|
+
}, [t]);
|
|
60
|
+
return /* @__PURE__ */ g(M, { modal: !0, children: [
|
|
61
|
+
/* @__PURE__ */ n(
|
|
62
|
+
v,
|
|
63
|
+
{
|
|
64
|
+
asChild: !0,
|
|
65
|
+
disabled: t == null ? void 0 : t.disabled,
|
|
66
|
+
children: /* @__PURE__ */ n(
|
|
67
|
+
S,
|
|
68
|
+
{
|
|
69
|
+
customClass: "!richtext-w-12 richtext-h-12",
|
|
70
|
+
disabled: t == null ? void 0 : t.disabled,
|
|
71
|
+
icon: t == null ? void 0 : t.icon,
|
|
72
|
+
tooltip: t == null ? void 0 : t.tooltip,
|
|
73
|
+
children: /* @__PURE__ */ n(
|
|
74
|
+
A,
|
|
75
|
+
{
|
|
76
|
+
className: "richtext-ml-1 richtext-size-3 richtext-text-zinc-500",
|
|
77
|
+
name: "MenuDown"
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ n(
|
|
85
|
+
C,
|
|
86
|
+
{
|
|
87
|
+
align: "start",
|
|
88
|
+
className: "richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",
|
|
89
|
+
side: "bottom",
|
|
90
|
+
children: (l = t == null ? void 0 : t.items) == null ? void 0 : l.map((e, r) => {
|
|
91
|
+
var a, c;
|
|
92
|
+
return /* @__PURE__ */ g(j, { children: [
|
|
93
|
+
/* @__PURE__ */ n(K, { asChild: !0, children: /* @__PURE__ */ n(
|
|
94
|
+
w,
|
|
95
|
+
{
|
|
96
|
+
className: "richtext-size-7 richtext-p-1",
|
|
97
|
+
"data-state": i.title === e.title ? "on" : "off",
|
|
98
|
+
onClick: e == null ? void 0 : e.action,
|
|
99
|
+
pressed: i.title === e.title,
|
|
100
|
+
size: "sm",
|
|
101
|
+
children: (e == null ? void 0 : e.icon) && /* @__PURE__ */ n(A, { name: e.icon })
|
|
102
|
+
}
|
|
103
|
+
) }),
|
|
104
|
+
/* @__PURE__ */ g(P, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
|
|
105
|
+
/* @__PURE__ */ n("span", { children: e.title }),
|
|
106
|
+
!!((a = e.shortcutKeys) != null && a.length) && /* @__PURE__ */ n("span", { children: (c = e.shortcutKeys) == null ? void 0 : c.map((o) => z(o)).join(" ") })
|
|
107
|
+
] })
|
|
108
|
+
] }, `text-align-${r}`);
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] });
|
|
113
|
+
}
|
|
114
|
+
const H = /* @__PURE__ */ L.extend({
|
|
115
|
+
addOptions() {
|
|
116
|
+
var t;
|
|
117
|
+
return {
|
|
118
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
119
|
+
types: ["heading", "paragraph", "list_item", "title"],
|
|
120
|
+
button({
|
|
121
|
+
editor: i,
|
|
122
|
+
extension: l,
|
|
123
|
+
t: e
|
|
124
|
+
}) {
|
|
125
|
+
var u;
|
|
126
|
+
const r = ((u = l.options) == null ? void 0 : u.alignments) || [], a = {
|
|
127
|
+
left: ["mod", "Shift", "L"],
|
|
128
|
+
center: ["mod", "Shift", "E"],
|
|
129
|
+
right: ["mod", "Shift", "R"],
|
|
130
|
+
justify: ["mod", "Shift", "J"]
|
|
131
|
+
}, c = {
|
|
132
|
+
left: "AlignLeft",
|
|
133
|
+
center: "AlignCenter",
|
|
134
|
+
right: "AlignRight",
|
|
135
|
+
justify: "AlignJustify"
|
|
136
|
+
}, o = r.map((s) => {
|
|
137
|
+
var x, h, m;
|
|
138
|
+
return {
|
|
139
|
+
title: e(`editor.textalign.${s}.tooltip`),
|
|
140
|
+
icon: c[s],
|
|
141
|
+
shortcutKeys: a[s],
|
|
142
|
+
isActive: () => i.isActive({ textAlign: s }) || !1,
|
|
143
|
+
action: () => {
|
|
144
|
+
var d, f;
|
|
145
|
+
return (f = (d = i.commands) == null ? void 0 : d.setTextAlign) == null ? void 0 : f.call(d, s);
|
|
146
|
+
},
|
|
147
|
+
disabled: !((m = (h = (x = i == null ? void 0 : i.can) == null ? void 0 : x.call(i)) == null ? void 0 : h.setTextAlign) != null && m.call(h, s))
|
|
148
|
+
};
|
|
149
|
+
}), y = o.filter((s) => s.disabled).length === o.length;
|
|
150
|
+
return {
|
|
151
|
+
component: N,
|
|
152
|
+
componentProps: {
|
|
153
|
+
icon: "AlignJustify",
|
|
154
|
+
tooltip: e("editor.textalign.tooltip"),
|
|
155
|
+
disabled: y,
|
|
156
|
+
items: o
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
export {
|
|
164
|
+
H as TextAlign
|
|
165
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("./index-COecBbaE.cjs"),t=require("react/jsx-runtime"),l=require("react"),x=require("lucide-react"),c=require("./RichTextEditor-DkpDEr5U.cjs"),g=require("./index-LbrE7K9i.cjs");function b(e){const{t:i}=g.useLocale(),n=l.useMemo(()=>[{name:"paragraph",label:i("editor.paragraph.tooltip"),iconName:"Heading1",isActive:()=>e.editor.isActive("paragraph")&&!e.editor.isActive("orderedList")&&!e.editor.isActive("bulletList")&&!e.editor.isActive("taskList"),action:()=>e.editor.chain().focus().clearNodes().run()},{name:"heading1",label:i("editor.heading.h1.tooltip"),isActive:()=>e.editor.isActive("heading",{level:1}),iconName:"Heading1",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:1}).run()},{name:"heading2",label:i("editor.heading.h2.tooltip"),isActive:()=>e.editor.isActive("heading",{level:2}),iconName:"Heading2",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:2}).run()},{name:"heading3",label:i("editor.heading.h3.tooltip"),isActive:()=>e.editor.isActive("heading",{level:3}),iconName:"Heading3",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:3}).run()},{name:"bulletList",label:i("editor.bulletlist.tooltip"),isActive:()=>e.editor.isActive("bulletList"),iconName:"List",action:()=>e.editor.chain().focus().clearNodes().toggleBulletList().run()},{name:"numberedList",label:i("editor.orderedlist.tooltip"),isActive:()=>e.editor.isActive("orderedList"),iconName:"ListOrdered",action:()=>e.editor.chain().focus().clearNodes().toggleOrderedList().run()},{name:"taskList",label:i("editor.tasklist.tooltip"),isActive:()=>e.editor.isActive("taskList"),iconName:"ListTodo",action:()=>e.editor.chain().focus().clearNodes().toggleTaskList().run()},{name:"blockquote",label:i("editor.blockquote.tooltip"),isActive:()=>e.editor.isActive("blockquote"),iconName:"TextQuote",action:()=>e.editor.chain().focus().clearNodes().toggleBlockquote().run()}],[e.editor,i]),a=l.useMemo(()=>n.findLast(o=>o.isActive())??{label:"Empty"},[n]);return t.jsxs(c.DropdownMenu,{children:[t.jsx(c.DropdownMenuTrigger,{asChild:!0,children:t.jsxs(c.Button,{className:"richtext-flex richtext-h-[32px] richtext-gap-1 richtext-px-1.5",variant:"ghost",children:[t.jsxs("span",{className:"richtext-whitespace-nowrap richtext-text-sm richtext-font-normal",children:[" ",a==null?void 0:a.label]}),t.jsx(x.ChevronDown,{className:"richtext-size-4"})]})}),t.jsx(c.DropdownMenuContent,{align:"start",className:"richtext-w-full richtext-p-1",hideWhenDetached:!0,sideOffset:5,children:n.map((o,d)=>{var r;const u=c.icons[o.iconName];return t.jsx(c.DropdownMenuCheckboxItem,{checked:((r=o.isActive)==null?void 0:r.call(o))||!1,className:"richtext-cursor-pointer",onClick:()=>o.action(),children:t.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-px-2",children:[t.jsx(u,{className:"richtext-h3 richtext-w-3"}),t.jsxs("span",{children:[" ",o.label]})]})},`text-bubble-${d}`)})})]})}const s=h.Extension.create({name:"text-bubble",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),toolbar:!1,button:()=>({component:b,componentProps:{}})}}});exports.TextBubble=s;exports.default=s;
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { Extension } from '@tiptap/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents the ButtonView function.
|
|
6
|
+
*/
|
|
7
|
+
declare type ButtonView<T = any> = (options: ButtonViewParams<T>) => ButtonViewReturn | ButtonViewReturn[];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Represents the parameters for the ButtonView function.
|
|
11
|
+
*/
|
|
12
|
+
declare interface ButtonViewParams<T = any> {
|
|
13
|
+
/** Editor object */
|
|
14
|
+
editor: Editor;
|
|
15
|
+
/** Extension object */
|
|
16
|
+
extension: Extension<T>;
|
|
17
|
+
/** Translation function */
|
|
18
|
+
t: (path: string) => string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents the return value for the ButtonView component.
|
|
23
|
+
*/
|
|
24
|
+
declare interface ButtonViewReturn {
|
|
25
|
+
/** Component */
|
|
26
|
+
component: unknown;
|
|
27
|
+
/** Component props */
|
|
28
|
+
componentProps: ButtonViewReturnComponentProps;
|
|
29
|
+
/** Component slots */
|
|
30
|
+
componentSlots?: ButtonViewReturnComponentSlots;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the props for the ButtonView component.
|
|
35
|
+
*/
|
|
36
|
+
declare interface ButtonViewReturnComponentProps {
|
|
37
|
+
/** Method triggered when action is performed */
|
|
38
|
+
action?: (value?: any) => void;
|
|
39
|
+
/** Whether it is in the active state */
|
|
40
|
+
isActive?: () => boolean;
|
|
41
|
+
/** Button icon */
|
|
42
|
+
icon?: any;
|
|
43
|
+
/** Text displayed on hover */
|
|
44
|
+
tooltip?: string;
|
|
45
|
+
[x: string]: any;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Represents the slots for the ButtonView component.
|
|
50
|
+
*/
|
|
51
|
+
declare interface ButtonViewReturnComponentSlots {
|
|
52
|
+
/** Dialog slot */
|
|
53
|
+
dialog: () => any;
|
|
54
|
+
[x: string]: () => any;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Represents the general options for Tiptap extensions.
|
|
59
|
+
*/
|
|
60
|
+
declare interface GeneralOptions<T> {
|
|
61
|
+
/** Enabled divider */
|
|
62
|
+
divider: boolean;
|
|
63
|
+
/** Enabled spacer */
|
|
64
|
+
spacer: boolean;
|
|
65
|
+
/** Button view function */
|
|
66
|
+
button: ButtonView<T>;
|
|
67
|
+
/** Show on Toolbar */
|
|
68
|
+
toolbar?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare const TextBubble: Extension<TextBubbleOptions, any>;
|
|
72
|
+
export { TextBubble }
|
|
73
|
+
export default TextBubble;
|
|
74
|
+
|
|
75
|
+
export declare interface TextBubbleOptions extends GeneralOptions<TextBubbleOptions> {
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { }
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
declare module '@tiptap/core' {
|
|
82
|
+
interface Commands<ReturnType> {
|
|
83
|
+
attachment: {
|
|
84
|
+
setAttachment: (attrs?: unknown) => ReturnType;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
declare module '@tiptap/core' {
|
|
91
|
+
interface Commands<ReturnType> {
|
|
92
|
+
setCodeBlock: {
|
|
93
|
+
setCodeBlock: (options?: any) => ReturnType;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
declare module '@tiptap/core' {
|
|
100
|
+
interface Commands<ReturnType> {
|
|
101
|
+
excalidraw: {
|
|
102
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
declare module '@tiptap/core' {
|
|
109
|
+
interface Commands<ReturnType> {
|
|
110
|
+
emoji: {
|
|
111
|
+
setEmoji: (emoji: {
|
|
112
|
+
name: string;
|
|
113
|
+
emoji: string;
|
|
114
|
+
}) => ReturnType;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
declare module '@tiptap/core' {
|
|
121
|
+
interface Commands<ReturnType> {
|
|
122
|
+
drawer: {
|
|
123
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
124
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
declare module '@tiptap/core' {
|
|
131
|
+
interface Commands<ReturnType> {
|
|
132
|
+
exportWord: {
|
|
133
|
+
exportToWord: () => ReturnType;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
declare module '@tiptap/core' {
|
|
140
|
+
interface Commands<ReturnType> {
|
|
141
|
+
fontSize: {
|
|
142
|
+
/**
|
|
143
|
+
* Set the text font size. ex: "12px", "2em", or "small". Must be a valid
|
|
144
|
+
* CSS font-size
|
|
145
|
+
* (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size).
|
|
146
|
+
*/
|
|
147
|
+
setFontSize: (fontSize: string) => ReturnType;
|
|
148
|
+
/**
|
|
149
|
+
* Unset the font size
|
|
150
|
+
*/
|
|
151
|
+
unsetFontSize: () => ReturnType;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
declare module '@tiptap/core' {
|
|
158
|
+
interface Commands<ReturnType> {
|
|
159
|
+
painter: {
|
|
160
|
+
setPainter: (marks: Mark[]) => ReturnType;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
declare module '@tiptap/core' {
|
|
167
|
+
interface Commands<ReturnType> {
|
|
168
|
+
iframe: {
|
|
169
|
+
/**
|
|
170
|
+
* Add an iframe
|
|
171
|
+
*/
|
|
172
|
+
setIframe: (options: {
|
|
173
|
+
src: string;
|
|
174
|
+
service: string;
|
|
175
|
+
}) => ReturnType;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
declare module '@tiptap/core' {
|
|
182
|
+
interface Commands<ReturnType> {
|
|
183
|
+
imageUpload: {
|
|
184
|
+
/**
|
|
185
|
+
* Add an image
|
|
186
|
+
*/
|
|
187
|
+
setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
188
|
+
/**
|
|
189
|
+
* Update an image
|
|
190
|
+
*/
|
|
191
|
+
updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
192
|
+
/**
|
|
193
|
+
* Set image alignment
|
|
194
|
+
*/
|
|
195
|
+
setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
declare module '@tiptap/core' {
|
|
202
|
+
interface Commands<ReturnType> {
|
|
203
|
+
imageGifUpload: {
|
|
204
|
+
/**
|
|
205
|
+
* Add an image gif
|
|
206
|
+
*/
|
|
207
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
208
|
+
/**
|
|
209
|
+
* Update an image gif
|
|
210
|
+
*/
|
|
211
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
212
|
+
/**
|
|
213
|
+
* Set image alignment
|
|
214
|
+
*/
|
|
215
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
declare module '@tiptap/core' {
|
|
222
|
+
interface Commands<ReturnType> {
|
|
223
|
+
indent: {
|
|
224
|
+
/**
|
|
225
|
+
* Set the indent attribute
|
|
226
|
+
*/
|
|
227
|
+
indent: () => ReturnType;
|
|
228
|
+
/**
|
|
229
|
+
* Set the outdent attribute
|
|
230
|
+
*/
|
|
231
|
+
outdent: () => ReturnType;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
declare module '@tiptap/core' {
|
|
238
|
+
interface Commands<ReturnType> {
|
|
239
|
+
katex: {
|
|
240
|
+
setKatex: (arg?: IKatexAttrs) => ReturnType;
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
declare module '@tiptap/core' {
|
|
247
|
+
interface Commands<ReturnType> {
|
|
248
|
+
lineHeight: {
|
|
249
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
250
|
+
unsetLineHeight: () => ReturnType;
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
declare module '@tiptap/core' {
|
|
257
|
+
interface Commands<ReturnType> {
|
|
258
|
+
mermaid: {
|
|
259
|
+
setMermaid: (options: any, replace?: any) => ReturnType;
|
|
260
|
+
setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
declare module '@tiptap/core' {
|
|
267
|
+
interface Commands<ReturnType> {
|
|
268
|
+
columns: {
|
|
269
|
+
insertColumns: (attrs?: {
|
|
270
|
+
cols: number;
|
|
271
|
+
}) => ReturnType;
|
|
272
|
+
addColBefore: () => ReturnType;
|
|
273
|
+
addColAfter: () => ReturnType;
|
|
274
|
+
deleteCol: () => ReturnType;
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
declare module '@tiptap/core' {
|
|
281
|
+
interface Commands<ReturnType> {
|
|
282
|
+
search: {
|
|
283
|
+
setSearchTerm: (searchTerm: string) => ReturnType;
|
|
284
|
+
setReplaceTerm: (replaceTerm: string) => ReturnType;
|
|
285
|
+
replace: () => ReturnType;
|
|
286
|
+
replaceAll: () => ReturnType;
|
|
287
|
+
goToPrevSearchResult: () => void;
|
|
288
|
+
goToNextSearchResult: () => void;
|
|
289
|
+
setCaseSensitive: (caseSensitive: boolean) => ReturnType;
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
declare module '@tiptap/core' {
|
|
296
|
+
interface Commands<ReturnType> {
|
|
297
|
+
tableOfContents: {
|
|
298
|
+
setTableOfContents: () => ReturnType;
|
|
299
|
+
removeTableOfContents: () => ReturnType;
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
declare module '@tiptap/core' {
|
|
306
|
+
interface Commands<ReturnType> {
|
|
307
|
+
twitter: {
|
|
308
|
+
/**
|
|
309
|
+
* Insert a tweet
|
|
310
|
+
* @param options The tweet attributes
|
|
311
|
+
* @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
|
|
312
|
+
*/
|
|
313
|
+
setTweet: (options: SetTweetOptions) => ReturnType;
|
|
314
|
+
updateTweet: (options: SetTweetOptions) => ReturnType;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
declare module '@tiptap/core' {
|
|
321
|
+
interface Commands<ReturnType> {
|
|
322
|
+
video: {
|
|
323
|
+
/**
|
|
324
|
+
* Add an video
|
|
325
|
+
*/
|
|
326
|
+
setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
|
|
327
|
+
/**
|
|
328
|
+
* Update an video
|
|
329
|
+
*/
|
|
330
|
+
updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
declare module '@tiptap/core' {
|
|
337
|
+
interface Commands<ReturnType> {
|
|
338
|
+
tableCellBackground: {
|
|
339
|
+
setTableCellBackground: (color: string) => ReturnType;
|
|
340
|
+
unsetTableCellBackground: () => ReturnType;
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
}
|