@clevertask/scribe 0.1.4 → 0.1.6
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.md +3 -0
- package/dist/BarMenu-CXaFlpRJ.js +272 -0
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.d.ts.map +1 -1
- package/dist/components/Menu/BarMenu.js +2 -10
- package/dist/components/Menu/BubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/BubbleMenu.js +165 -1023
- package/dist/components/Menu/LinkBubbleMenu.d.ts +8 -0
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -0
- package/dist/components/Menu/LinkBubbleMenu.js +78 -0
- package/dist/components/Menu/LinkEditor.d.ts +14 -0
- package/dist/components/Menu/LinkEditor.d.ts.map +1 -0
- package/dist/components/Menu/LinkEditor.js +140 -0
- package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
- package/dist/components/Menu/Mobile/ListOptionBar.js +38 -44
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +5 -0
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -0
- package/dist/components/Menu/linkBubbleMenuPlugin.js +7 -0
- package/dist/components/Menu/linkUrl.d.ts +2 -0
- package/dist/components/Menu/linkUrl.d.ts.map +1 -0
- package/dist/components/Menu/linkUrl.js +21 -0
- package/dist/components/Scribe/extension/emoji/EmojiList.js +58 -45
- package/dist/components/Scribe/extension/emoji/suggest.d.ts +2 -2
- package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +39 -43
- package/dist/components/Scribe/extension/extension-link.d.ts.map +1 -1
- package/dist/components/Scribe/extension/extension-link.js +2 -4
- package/dist/components/Scribe/extension/extension-markdown-paste.d.ts.map +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +50 -45
- package/dist/components/Scribe/extension/extension-selectedText.d.ts.map +1 -1
- package/dist/components/Scribe/extension/extension-selectedText.js +10 -12
- package/dist/components/Scribe/extension/getPopupMountTarget.d.ts.map +1 -1
- package/dist/components/Scribe/extension/getPopupMountTarget.js +12 -15
- package/dist/components/Scribe/extension/index.d.ts +4 -4
- package/dist/components/Scribe/extension/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +2 -39521
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3369 -3731
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -6
- package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/items.js +177 -176
- package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +35 -41
- package/dist/components/Scribe/extension/tableOfContents.js +153 -180
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +113 -153
- package/dist/dist-BQjH-i-q.js +7016 -0
- package/dist/dist-CnXCIcnl.js +3506 -0
- package/dist/dist-Cp938P7P.js +689 -0
- package/dist/extension-CZOsheCI.js +56236 -0
- package/dist/extension-link-DZID_SYl.js +908 -0
- package/dist/floating-ui.dom-rih69525.js +928 -0
- package/dist/html-to-markdown-CrNOkSye.js +497 -0
- package/dist/icons/ToolbarIcons.d.ts.map +1 -1
- package/dist/icons/ToolbarIcons.js +76 -135
- package/dist/main.css +10 -0
- package/dist/main.js +7 -15
- package/dist/markdown-to-html-DEczPfuq.js +1458 -0
- package/dist/menus-CakIdDdY.js +633 -0
- package/dist/purify.es-DF9CW1cl.js +767 -0
- package/dist/rolldown-runtime-CtkjhSXr.js +4 -0
- package/dist/slashCommand-B7CRIaKG.js +429 -0
- package/dist/tables-CjOC70rm.js +1345 -0
- package/dist/tippy.esm-D9LL2xiE.js +1713 -0
- package/dist/utils/convert-legacy-math-delimiters.d.ts.map +1 -1
- package/dist/utils/convert-legacy-math-delimiters.js +7 -13
- package/dist/utils/create-scribe-editor.js +2 -31
- package/dist/utils/html-to-markdown.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.js +2 -600
- package/dist/utils/index.js +24 -12
- package/dist/utils/is-in-viewport.d.ts.map +1 -1
- package/dist/utils/is-in-viewport.js +6 -6
- package/dist/utils/markdown-to-html.d.ts.map +1 -1
- package/dist/utils/markdown-to-html.js +2 -5
- package/dist/vite-env.d.js +0 -1
- package/package.json +38 -36
- package/dist/BarMenu-BNk2I0zi.js +0 -327
- package/dist/extension-link-P1rro4zO.js +0 -1059
- package/dist/floating-ui.dom-ZRy7FSVk.js +0 -1246
- package/dist/index-BMISMQrG.js +0 -855
- package/dist/index-ByyiiYsp.js +0 -1410
- package/dist/index-CnKS-BY2.js +0 -13834
- package/dist/index-CnQHDObA.js +0 -539
- package/dist/markdown-to-html-Bw9L43K6.js +0 -1135
- package/dist/purify.es-DC1iJOxX.js +0 -864
- package/dist/tippy.esm-DLHdsnfG.js +0 -1711
package/dist/utils/index.js
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
1
|
+
import { t as e } from "../dist-BQjH-i-q.js";
|
|
2
|
+
import { t } from "../html-to-markdown-CrNOkSye.js";
|
|
3
|
+
import { t as n } from "../markdown-to-html-DEczPfuq.js";
|
|
4
|
+
import { isInViewport as r } from "./is-in-viewport.js";
|
|
5
|
+
import { convertLegacyMathDelimiters as i } from "./convert-legacy-math-delimiters.js";
|
|
6
|
+
import { t as a } from "../extension-CZOsheCI.js";
|
|
7
|
+
//#region lib/utils/create-scribe-editor.ts
|
|
8
|
+
function o({ content: n = "", editable: r = !1, onContentChange: i }) {
|
|
9
|
+
return new e({
|
|
10
|
+
content: n,
|
|
11
|
+
editable: r,
|
|
12
|
+
extensions: a({}),
|
|
13
|
+
onUpdate({ editor: e }) {
|
|
14
|
+
i && i({
|
|
15
|
+
htmlContent: e.getHTML(),
|
|
16
|
+
jsonContent: e.getJSON(),
|
|
17
|
+
markdownContent: t(e.getHTML())
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
editorProps: { attributes: { class: "scribe" } }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { i as convertLegacyMathDelimiters, o as createScribeEditor, t as html2md, r as isInViewport, n as md2html };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-in-viewport.d.ts","sourceRoot":"","sources":["../../lib/utils/is-in-viewport.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"is-in-viewport.d.ts","sourceRoot":"","sources":["../../lib/utils/is-in-viewport.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,QAAS,WAAW,aAAa,WAAW,YASpE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
i as isInViewport
|
|
1
|
+
//#region lib/utils/is-in-viewport.ts
|
|
2
|
+
var e = (e, t) => {
|
|
3
|
+
let n = e.offsetTop, r = n + e.clientHeight, i = t.scrollTop, a = i + t.clientHeight;
|
|
4
|
+
return n >= i && r <= a;
|
|
7
5
|
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { e as isInViewport };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-to-html.d.ts","sourceRoot":"","sources":["../../lib/utils/markdown-to-html.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"markdown-to-html.d.ts","sourceRoot":"","sources":["../../lib/utils/markdown-to-html.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,OAAQ,MAAM,WAA2D,CAAC"}
|
package/dist/vite-env.d.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clevertask/scribe",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Radix-based Tiptap rich text editor with a Notion-style block interface for viewing and creating content. Perfect for diverse needs like notes, documents, AI chat, Markdown parsing, and comments.",
|
|
6
6
|
"keywords": [
|
|
@@ -36,66 +36,68 @@
|
|
|
36
36
|
"registry": "https://registry.npmjs.org/"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@tiptap/core": "^3.
|
|
40
|
-
"@tiptap/extension-emoji": "^3.
|
|
41
|
-
"@tiptap/extension-focus": "^3.
|
|
42
|
-
"@tiptap/extension-highlight": "^3.
|
|
43
|
-
"@tiptap/extension-image": "^3.
|
|
44
|
-
"@tiptap/extension-link": "^3.
|
|
45
|
-
"@tiptap/extension-mathematics": "^3.
|
|
46
|
-
"@tiptap/extension-placeholder": "^3.
|
|
47
|
-
"@tiptap/extension-table": "^3.
|
|
48
|
-
"@tiptap/extension-table-cell": "^3.
|
|
49
|
-
"@tiptap/extension-table-header": "^3.
|
|
50
|
-
"@tiptap/extension-table-row": "^3.
|
|
51
|
-
"@tiptap/extension-task-item": "^3.
|
|
52
|
-
"@tiptap/extension-task-list": "^3.
|
|
53
|
-
"@tiptap/extension-typography": "^3.
|
|
54
|
-
"@tiptap/pm": "^3.
|
|
55
|
-
"@tiptap/react": "^3.
|
|
56
|
-
"@tiptap/starter-kit": "^3.
|
|
57
|
-
"@tiptap/suggestion": "^3.
|
|
39
|
+
"@tiptap/core": "^3.29.0",
|
|
40
|
+
"@tiptap/extension-emoji": "^3.29.0",
|
|
41
|
+
"@tiptap/extension-focus": "^3.29.0",
|
|
42
|
+
"@tiptap/extension-highlight": "^3.29.0",
|
|
43
|
+
"@tiptap/extension-image": "^3.29.0",
|
|
44
|
+
"@tiptap/extension-link": "^3.29.0",
|
|
45
|
+
"@tiptap/extension-mathematics": "^3.29.0",
|
|
46
|
+
"@tiptap/extension-placeholder": "^3.29.0",
|
|
47
|
+
"@tiptap/extension-table": "^3.29.0",
|
|
48
|
+
"@tiptap/extension-table-cell": "^3.29.0",
|
|
49
|
+
"@tiptap/extension-table-header": "^3.29.0",
|
|
50
|
+
"@tiptap/extension-table-row": "^3.29.0",
|
|
51
|
+
"@tiptap/extension-task-item": "^3.29.0",
|
|
52
|
+
"@tiptap/extension-task-list": "^3.29.0",
|
|
53
|
+
"@tiptap/extension-typography": "^3.29.0",
|
|
54
|
+
"@tiptap/pm": "^3.29.0",
|
|
55
|
+
"@tiptap/react": "^3.29.0",
|
|
56
|
+
"@tiptap/starter-kit": "^3.29.0",
|
|
57
|
+
"@tiptap/suggestion": "^3.29.0",
|
|
58
58
|
"clsx": "^2.1.1",
|
|
59
59
|
"dompurify": "^3.4.12",
|
|
60
|
-
"katex": "^0.
|
|
61
|
-
"marked": "^
|
|
60
|
+
"katex": "^0.18.1",
|
|
61
|
+
"marked": "^18.0.7",
|
|
62
62
|
"tippy.js": "^6.3.7",
|
|
63
63
|
"turndown": "^7.2.4"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@eslint/js": "^9.39.5",
|
|
67
66
|
"@radix-ui/themes": "^3.3.0",
|
|
67
|
+
"@testing-library/dom": "^10.4.1",
|
|
68
|
+
"@testing-library/jest-dom": "^7.0.0",
|
|
69
|
+
"@testing-library/react": "^16.3.2",
|
|
68
70
|
"@types/lodash": "^4.17.24",
|
|
69
71
|
"@types/node": "^24.13.3",
|
|
70
72
|
"@types/react": "^19.2.17",
|
|
71
73
|
"@types/react-dom": "^19.2.3",
|
|
72
74
|
"@types/turndown": "^5.0.6",
|
|
73
|
-
"@vitejs/plugin-react": "^
|
|
74
|
-
"eslint": "^9.39.5",
|
|
75
|
-
"eslint-plugin-react-hooks": "^7.1.1",
|
|
76
|
-
"eslint-plugin-react-refresh": "^0.5.3",
|
|
75
|
+
"@vitejs/plugin-react": "^6.0.4",
|
|
77
76
|
"glob": "^13.0.6",
|
|
78
|
-
"
|
|
77
|
+
"jsdom": "^29.1.1",
|
|
79
78
|
"lodash": "^4.18.1",
|
|
80
79
|
"oxfmt": "^0.60.0",
|
|
81
|
-
"
|
|
82
|
-
"typescript
|
|
83
|
-
"vite": "^
|
|
84
|
-
"vite-plugin-lib-inject-css": "^2.2.2"
|
|
80
|
+
"oxlint": "^1.75.0",
|
|
81
|
+
"typescript": "~7.0.2",
|
|
82
|
+
"vite": "^8.1.5",
|
|
83
|
+
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
84
|
+
"vitest": "^4.1.10"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@radix-ui/themes": ">=3.3.0",
|
|
88
88
|
"react": ">=18.3.1 <20.0.0",
|
|
89
89
|
"react-dom": ">=18.3.1 <20.0.0"
|
|
90
90
|
},
|
|
91
|
-
"prepublishOnly": "npm run build",
|
|
92
91
|
"scripts": {
|
|
93
92
|
"dev": "vite",
|
|
94
|
-
"build": "vite build && npm run build:style && tsc -p tsconfig.types.json --noCheck",
|
|
93
|
+
"build": "vite build && npm run check:browser-bundle && npm run build:style && tsc -p tsconfig.types.json --noCheck",
|
|
95
94
|
"build:style": "mkdir -p ./dist && cp ./lib/styles/main.css ./dist/main.css",
|
|
96
|
-
"
|
|
95
|
+
"check:browser-bundle": "node scripts/check-browser-bundle.mjs",
|
|
96
|
+
"lint": "oxlint . --report-unused-disable-directives --deny-warnings",
|
|
97
97
|
"preview": "vite preview",
|
|
98
98
|
"fmt": "oxfmt",
|
|
99
|
-
"fmt:check": "oxfmt --check"
|
|
99
|
+
"fmt:check": "oxfmt --check",
|
|
100
|
+
"test": "vitest run --config vitest.config.ts",
|
|
101
|
+
"validate:deps": "pnpm run fmt:check && pnpm run lint && pnpm run test && pnpm run build"
|
|
100
102
|
}
|
|
101
103
|
}
|
package/dist/BarMenu-BNk2I0zi.js
DELETED
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import { jsx as i, jsxs as l } from "react/jsx-runtime";
|
|
2
|
-
import { Box as A, Flex as r, Popover as g, IconButton as B, Text as m, TextField as R, Button as f, Separator as F } from "@radix-ui/themes";
|
|
3
|
-
import { u as H } from "./index-BMISMQrG.js";
|
|
4
|
-
import { useState as v, useCallback as u, Fragment as U } from "react";
|
|
5
|
-
import { getPopupMountTarget as V } from "./components/Scribe/extension/getPopupMountTarget.js";
|
|
6
|
-
import { BoldIcon as q, ItalicIcon as E, StrikeIcon as W, InlineCodeIcon as Q, HighlightIcon as G, UnorderedListIcon as J, OrderedListIcon as K, LinkIcon as X, ImageIcon as Y, CodeBlockIcon as Z, BlockQuoteIcon as _, HorizontalLineIcon as ee } from "./icons/ToolbarIcons.js";
|
|
7
|
-
function O(e) {
|
|
8
|
-
var s, a, t = "";
|
|
9
|
-
if (typeof e == "string" || typeof e == "number") t += e;
|
|
10
|
-
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
11
|
-
var h = e.length;
|
|
12
|
-
for (s = 0; s < h; s++) e[s] && (a = O(e[s])) && (t && (t += " "), t += a);
|
|
13
|
-
} else for (a in e) e[a] && (t && (t += " "), t += a);
|
|
14
|
-
return t;
|
|
15
|
-
}
|
|
16
|
-
function I() {
|
|
17
|
-
for (var e, s, a = 0, t = "", h = arguments.length; a < h; a++) (e = arguments[a]) && (s = O(e)) && (t && (t += " "), t += s);
|
|
18
|
-
return t;
|
|
19
|
-
}
|
|
20
|
-
const ce = ({ editor: e }) => {
|
|
21
|
-
const [s, a] = v(!1), [t, h] = v(!1), [p, y] = v(""), [b, L] = v(""), C = V(e), c = H({
|
|
22
|
-
editor: e,
|
|
23
|
-
selector: ({ editor: n }) => n ? {
|
|
24
|
-
isBold: n.isActive("bold"),
|
|
25
|
-
isItalic: n.isActive("italic"),
|
|
26
|
-
isStrike: n.isActive("strike"),
|
|
27
|
-
isCode: n.isActive("code"),
|
|
28
|
-
isHighlight: n.isActive("highlight"),
|
|
29
|
-
isBulletList: n.isActive("bulletList"),
|
|
30
|
-
isOrderedList: n.isActive("orderedList"),
|
|
31
|
-
isLink: n.isActive("link"),
|
|
32
|
-
isImage: n.isActive("image"),
|
|
33
|
-
isCodeBlock: n.isActive("codeBlock"),
|
|
34
|
-
isBlockquote: n.isActive("blockquote")
|
|
35
|
-
} : null
|
|
36
|
-
}), z = u(
|
|
37
|
-
(n) => {
|
|
38
|
-
if (n) {
|
|
39
|
-
const d = e.getAttributes("link").href ?? "";
|
|
40
|
-
y(d), h(!1);
|
|
41
|
-
}
|
|
42
|
-
a(n);
|
|
43
|
-
},
|
|
44
|
-
[e]
|
|
45
|
-
), M = u(
|
|
46
|
-
(n) => {
|
|
47
|
-
if (n) {
|
|
48
|
-
const d = e.getAttributes("image").src ?? "";
|
|
49
|
-
L(d), a(!1);
|
|
50
|
-
}
|
|
51
|
-
h(n);
|
|
52
|
-
},
|
|
53
|
-
[e]
|
|
54
|
-
), S = u(() => {
|
|
55
|
-
const n = p.trim();
|
|
56
|
-
if (n.length === 0) {
|
|
57
|
-
e.chain().focus().extendMarkRange("link").unsetLink().run(), a(!1);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
e.chain().focus().extendMarkRange("link").setLink({ href: n }).selectTextblockEnd().run(), a(!1);
|
|
61
|
-
}, [e, p]), P = u(() => {
|
|
62
|
-
e.chain().focus().extendMarkRange("link").unsetLink().run(), a(!1);
|
|
63
|
-
}, [e]), T = u(() => {
|
|
64
|
-
const n = b.trim();
|
|
65
|
-
n && (e.chain().focus().setImage({ src: n }).run(), h(!1));
|
|
66
|
-
}, [e, b]), D = u(
|
|
67
|
-
(n, d) => {
|
|
68
|
-
n.preventDefault(), d();
|
|
69
|
-
},
|
|
70
|
-
[]
|
|
71
|
-
), w = u((n) => {
|
|
72
|
-
n.preventDefault();
|
|
73
|
-
}, []), N = u(
|
|
74
|
-
({ target: { value: n } }) => {
|
|
75
|
-
y(n);
|
|
76
|
-
},
|
|
77
|
-
[]
|
|
78
|
-
), $ = u(
|
|
79
|
-
({ target: { value: n } }) => {
|
|
80
|
-
L(n);
|
|
81
|
-
},
|
|
82
|
-
[]
|
|
83
|
-
), x = [
|
|
84
|
-
[
|
|
85
|
-
{
|
|
86
|
-
name: "bold",
|
|
87
|
-
icon: q,
|
|
88
|
-
command: () => e.chain().focus().toggleBold().run(),
|
|
89
|
-
isActive: () => !!c?.isBold
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: "italic",
|
|
93
|
-
icon: E,
|
|
94
|
-
command: () => e.chain().focus().toggleItalic().run(),
|
|
95
|
-
isActive: () => !!c?.isItalic
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
name: "strike",
|
|
99
|
-
icon: W,
|
|
100
|
-
command: () => e.chain().focus().toggleStrike().run(),
|
|
101
|
-
isActive: () => !!c?.isStrike
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
[
|
|
105
|
-
{
|
|
106
|
-
name: "inline-code",
|
|
107
|
-
icon: Q,
|
|
108
|
-
command: () => e.chain().focus().toggleCode().run(),
|
|
109
|
-
isActive: () => !!c?.isCode
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: "highlight",
|
|
113
|
-
icon: G,
|
|
114
|
-
command: () => e.chain().focus().toggleHighlight().run(),
|
|
115
|
-
isActive: () => !!c?.isHighlight
|
|
116
|
-
}
|
|
117
|
-
],
|
|
118
|
-
[
|
|
119
|
-
{
|
|
120
|
-
name: "unordered-list",
|
|
121
|
-
icon: J,
|
|
122
|
-
command: () => e.chain().focus().toggleBulletList().run(),
|
|
123
|
-
isActive: () => !!c?.isBulletList
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: "ordered-list",
|
|
127
|
-
icon: K,
|
|
128
|
-
command: () => e.chain().focus().toggleOrderedList().run(),
|
|
129
|
-
isActive: () => !!c?.isOrderedList
|
|
130
|
-
}
|
|
131
|
-
],
|
|
132
|
-
[
|
|
133
|
-
{
|
|
134
|
-
name: "link",
|
|
135
|
-
icon: X,
|
|
136
|
-
isActive: () => !!c?.isLink,
|
|
137
|
-
popover: "link"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: "image",
|
|
141
|
-
icon: Y,
|
|
142
|
-
isActive: () => !!c?.isImage,
|
|
143
|
-
disabled: !1,
|
|
144
|
-
popover: "image"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
name: "code-block",
|
|
148
|
-
icon: Z,
|
|
149
|
-
command: () => e.chain().focus().toggleCodeBlock().run(),
|
|
150
|
-
isActive: () => !!c?.isCodeBlock
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
name: "block-quote",
|
|
154
|
-
icon: _,
|
|
155
|
-
command: () => e.chain().focus().toggleBlockquote().run(),
|
|
156
|
-
isActive: () => !!c?.isBlockquote
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
name: "horizontal-line",
|
|
160
|
-
icon: ee,
|
|
161
|
-
command: () => e.chain().focus().setHorizontalRule().run(),
|
|
162
|
-
isActive: () => !1
|
|
163
|
-
}
|
|
164
|
-
]
|
|
165
|
-
];
|
|
166
|
-
return /* @__PURE__ */ i(A, { className: "scribe-toolbar", children: /* @__PURE__ */ i(r, { align: "center", gap: "3", wrap: "wrap", children: x.map((n, d) => /* @__PURE__ */ l(U, { children: [
|
|
167
|
-
/* @__PURE__ */ i(r, { align: "center", gap: "2", wrap: "wrap", children: n.map((o, k) => o.popover === "link" ? /* @__PURE__ */ l(
|
|
168
|
-
g.Root,
|
|
169
|
-
{
|
|
170
|
-
open: s,
|
|
171
|
-
onOpenChange: z,
|
|
172
|
-
children: [
|
|
173
|
-
/* @__PURE__ */ i(g.Trigger, { children: /* @__PURE__ */ i(
|
|
174
|
-
B,
|
|
175
|
-
{
|
|
176
|
-
type: "button",
|
|
177
|
-
radius: "medium",
|
|
178
|
-
color: "gray",
|
|
179
|
-
variant: o.isActive() ? "soft" : "ghost",
|
|
180
|
-
disabled: o.disabled || !e.isEditable,
|
|
181
|
-
title: o.name,
|
|
182
|
-
onMouseDown: w,
|
|
183
|
-
className: I(o.disabled && "scribe-toolbar-button--disabled"),
|
|
184
|
-
children: /* @__PURE__ */ i(o.icon, { className: "scribe-toolbar-icon" })
|
|
185
|
-
}
|
|
186
|
-
) }),
|
|
187
|
-
/* @__PURE__ */ i(
|
|
188
|
-
g.Content,
|
|
189
|
-
{
|
|
190
|
-
container: C,
|
|
191
|
-
size: "2",
|
|
192
|
-
side: "bottom",
|
|
193
|
-
align: "start",
|
|
194
|
-
style: { maxWidth: "calc(100vw - 32px)", width: 320 },
|
|
195
|
-
children: /* @__PURE__ */ l(r, { direction: "column", gap: "4", children: [
|
|
196
|
-
/* @__PURE__ */ l(A, { children: [
|
|
197
|
-
/* @__PURE__ */ i(m, { as: "p", size: "3", weight: "medium", children: "Link" }),
|
|
198
|
-
/* @__PURE__ */ i(m, { as: "p", size: "2", color: "gray", children: "Add or update a link for the current selection." })
|
|
199
|
-
] }),
|
|
200
|
-
/* @__PURE__ */ i("label", { children: /* @__PURE__ */ l(r, { direction: "column", gap: "2", children: [
|
|
201
|
-
/* @__PURE__ */ i(m, { as: "span", size: "2", weight: "medium", children: "URL" }),
|
|
202
|
-
/* @__PURE__ */ i(
|
|
203
|
-
R.Root,
|
|
204
|
-
{
|
|
205
|
-
autoFocus: !0,
|
|
206
|
-
placeholder: "https://example.com",
|
|
207
|
-
value: p,
|
|
208
|
-
onChange: N
|
|
209
|
-
}
|
|
210
|
-
)
|
|
211
|
-
] }) }),
|
|
212
|
-
/* @__PURE__ */ l(r, { justify: "between", gap: "3", wrap: "wrap", children: [
|
|
213
|
-
/* @__PURE__ */ i(
|
|
214
|
-
f,
|
|
215
|
-
{
|
|
216
|
-
type: "button",
|
|
217
|
-
color: "red",
|
|
218
|
-
variant: "soft",
|
|
219
|
-
disabled: !((e.getAttributes("link").href ?? "").trim() || p.trim()),
|
|
220
|
-
onClick: P,
|
|
221
|
-
children: "Remove link"
|
|
222
|
-
}
|
|
223
|
-
),
|
|
224
|
-
/* @__PURE__ */ l(r, { gap: "2", justify: "end", style: { marginLeft: "auto" }, children: [
|
|
225
|
-
/* @__PURE__ */ i(g.Close, { children: /* @__PURE__ */ i(f, { type: "button", variant: "soft", color: "gray", children: "Cancel" }) }),
|
|
226
|
-
/* @__PURE__ */ i(
|
|
227
|
-
f,
|
|
228
|
-
{
|
|
229
|
-
type: "button",
|
|
230
|
-
disabled: p.trim().length === 0,
|
|
231
|
-
onClick: S,
|
|
232
|
-
children: "Save"
|
|
233
|
-
}
|
|
234
|
-
)
|
|
235
|
-
] })
|
|
236
|
-
] })
|
|
237
|
-
] })
|
|
238
|
-
}
|
|
239
|
-
)
|
|
240
|
-
]
|
|
241
|
-
},
|
|
242
|
-
`${o.name}-${k}`
|
|
243
|
-
) : o.popover === "image" ? /* @__PURE__ */ l(
|
|
244
|
-
g.Root,
|
|
245
|
-
{
|
|
246
|
-
open: t,
|
|
247
|
-
onOpenChange: M,
|
|
248
|
-
children: [
|
|
249
|
-
/* @__PURE__ */ i(g.Trigger, { children: /* @__PURE__ */ i(
|
|
250
|
-
B,
|
|
251
|
-
{
|
|
252
|
-
type: "button",
|
|
253
|
-
radius: "medium",
|
|
254
|
-
color: "gray",
|
|
255
|
-
variant: o.isActive() ? "soft" : "ghost",
|
|
256
|
-
disabled: o.disabled || !e.isEditable,
|
|
257
|
-
title: o.name,
|
|
258
|
-
onMouseDown: w,
|
|
259
|
-
className: I(o.disabled && "scribe-toolbar-button--disabled"),
|
|
260
|
-
children: /* @__PURE__ */ i(o.icon, { className: "scribe-toolbar-icon" })
|
|
261
|
-
}
|
|
262
|
-
) }),
|
|
263
|
-
/* @__PURE__ */ i(
|
|
264
|
-
g.Content,
|
|
265
|
-
{
|
|
266
|
-
container: C,
|
|
267
|
-
size: "2",
|
|
268
|
-
side: "bottom",
|
|
269
|
-
align: "start",
|
|
270
|
-
style: { maxWidth: "calc(100vw - 32px)", width: 320 },
|
|
271
|
-
children: /* @__PURE__ */ l(r, { direction: "column", gap: "4", children: [
|
|
272
|
-
/* @__PURE__ */ l(A, { children: [
|
|
273
|
-
/* @__PURE__ */ i(m, { as: "p", size: "3", weight: "medium", children: "Image" }),
|
|
274
|
-
/* @__PURE__ */ i(m, { as: "p", size: "2", color: "gray", children: "Insert an image from a URL." })
|
|
275
|
-
] }),
|
|
276
|
-
/* @__PURE__ */ i("label", { children: /* @__PURE__ */ l(r, { direction: "column", gap: "2", children: [
|
|
277
|
-
/* @__PURE__ */ i(m, { as: "span", size: "2", weight: "medium", children: "Image URL" }),
|
|
278
|
-
/* @__PURE__ */ i(
|
|
279
|
-
R.Root,
|
|
280
|
-
{
|
|
281
|
-
autoFocus: !0,
|
|
282
|
-
placeholder: "https://example.com/image.png",
|
|
283
|
-
value: b,
|
|
284
|
-
onChange: $
|
|
285
|
-
}
|
|
286
|
-
)
|
|
287
|
-
] }) }),
|
|
288
|
-
/* @__PURE__ */ l(r, { justify: "end", gap: "2", children: [
|
|
289
|
-
/* @__PURE__ */ i(g.Close, { children: /* @__PURE__ */ i(f, { type: "button", variant: "soft", color: "gray", children: "Cancel" }) }),
|
|
290
|
-
/* @__PURE__ */ i(
|
|
291
|
-
f,
|
|
292
|
-
{
|
|
293
|
-
type: "button",
|
|
294
|
-
disabled: b.trim().length === 0,
|
|
295
|
-
onClick: T,
|
|
296
|
-
children: "Save"
|
|
297
|
-
}
|
|
298
|
-
)
|
|
299
|
-
] })
|
|
300
|
-
] })
|
|
301
|
-
}
|
|
302
|
-
)
|
|
303
|
-
]
|
|
304
|
-
},
|
|
305
|
-
`${o.name}-${k}`
|
|
306
|
-
) : /* @__PURE__ */ i(
|
|
307
|
-
B,
|
|
308
|
-
{
|
|
309
|
-
type: "button",
|
|
310
|
-
radius: "medium",
|
|
311
|
-
color: "gray",
|
|
312
|
-
variant: o.isActive() ? "soft" : "ghost",
|
|
313
|
-
disabled: o.disabled || !e.isEditable,
|
|
314
|
-
title: o.name,
|
|
315
|
-
onMouseDown: (j) => D(j, o.command),
|
|
316
|
-
className: I(o.disabled && "scribe-toolbar-button--disabled"),
|
|
317
|
-
children: /* @__PURE__ */ i(o.icon, { className: "scribe-toolbar-icon" })
|
|
318
|
-
},
|
|
319
|
-
`${o.name}-${k}`
|
|
320
|
-
)) }),
|
|
321
|
-
d !== x.length - 1 ? /* @__PURE__ */ i(F, { orientation: "vertical", decorative: !0, style: { height: 20 } }) : null
|
|
322
|
-
] }, `format-group-${d}`)) }) });
|
|
323
|
-
};
|
|
324
|
-
export {
|
|
325
|
-
ce as B,
|
|
326
|
-
I as c
|
|
327
|
-
};
|