@clevertask/scribe 0.0.12 → 0.0.13

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.
Files changed (30) hide show
  1. package/README.md +80 -4
  2. package/dist/components/Menu/BarMenu.js +21 -21
  3. package/dist/components/Menu/BubbleMenu.js +1 -1
  4. package/dist/components/Menu/Mobile/ListOptionBar.js +35 -38
  5. package/dist/components/Scribe/extension/emoji/suggest.js +5 -6
  6. package/dist/components/Scribe/extension/extension-link.js +2 -2
  7. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  8. package/dist/components/Scribe/extension/index.js +2 -2
  9. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +4 -4
  10. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  11. package/dist/components/Scribe/extension/slashCommand/items.js +6 -7
  12. package/dist/components/Scribe/extension/slashCommand/renderItems.js +10 -11
  13. package/dist/components/Scribe/index.js +78 -79
  14. package/dist/index-BfaHEr44.js +159 -0
  15. package/dist/{index-VneQGVTd.js → index-Bvgjhwaj.js} +11 -47
  16. package/dist/{index-CCS9HOYd.js → index-CWvaDN_2.js} +21 -29
  17. package/dist/{index-DoNRu1rY.js → index-flsxByQS.js} +17 -17
  18. package/dist/main.js +8 -6
  19. package/dist/marked.esm-H7n4rMcO.js +1554 -0
  20. package/dist/{purify.es-BGaRrCfO.js → purify.es-DcWaZU6I.js} +0 -1
  21. package/dist/utils/convert-legacy-math-delimiters.d.ts +1 -0
  22. package/dist/utils/convert-legacy-math-delimiters.js +13 -0
  23. package/dist/utils/create-scribe-editor.js +3 -3
  24. package/dist/utils/html-to-markdown.js +1 -1
  25. package/dist/utils/index.d.ts +1 -0
  26. package/dist/utils/index.js +8 -6
  27. package/dist/utils/markdown-to-html.js +2 -2
  28. package/package.json +46 -43
  29. package/dist/index-B0pieAxt.js +0 -160
  30. package/dist/marked.esm-BS_MmRZC.js +0 -1566
@@ -1,4 +1,3 @@
1
- /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
2
1
  const {
3
2
  entries: _t,
4
3
  setPrototypeOf: ct,
@@ -0,0 +1 @@
1
+ export declare const convertLegacyMathDelimiters: (input: string) => string;
@@ -0,0 +1,13 @@
1
+ const r = (t) => t.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), o = (t) => `<span data-type="inline-math" data-latex="${r(t.trim())}"></span>`, p = (t) => `<div data-type="block-math" data-latex="${r(t.trim())}"></div>`, s = (t) => /\\[a-zA-Z]+|[_^]/.test(t), g = /\\\(([^\n]+?)\\\)|\\\[([^\n]+?)\\\]|\[([^\n]+?)\]|\(([^\n]+?)\)/g, d = (t) => t.replace(g, (e, n, a, l, c) => {
2
+ const i = n || a || l || c || "";
3
+ return !!!(n || a) && !s(i) ? e : o(i);
4
+ }), m = (t) => t.split(/(<[^>]+>)/g).map((e) => e.startsWith("<") ? e : d(e)).join(""), x = (t) => {
5
+ const e = t.replace(
6
+ /(^|\n)[ \t]*(?:\\\[|\[)([\s\S]*?)(?:\\\]|\])[ \t]*(?=\n|$)/g,
7
+ (n, a, l) => s(l) ? `${a}${p(l)}` : n
8
+ );
9
+ return m(e);
10
+ };
11
+ export {
12
+ x as convertLegacyMathDelimiters
13
+ };
@@ -1,8 +1,8 @@
1
- import { E as i } from "../index-DoNRu1rY.js";
1
+ import { E as i } from "../index-flsxByQS.js";
2
2
  import { initExtensions as n } from "../components/Scribe/extension/index.js";
3
3
  import { html2md as m } from "./html-to-markdown.js";
4
- import "../marked.esm-BS_MmRZC.js";
5
- import "../purify.es-BGaRrCfO.js";
4
+ import "../marked.esm-H7n4rMcO.js";
5
+ import "../purify.es-DcWaZU6I.js";
6
6
  function d({ content: r = "", editable: e = !1, onContentChange: o }) {
7
7
  return new i({
8
8
  content: r,
@@ -1,4 +1,4 @@
1
- import { p as c } from "../purify.es-BGaRrCfO.js";
1
+ import { p as c } from "../purify.es-DcWaZU6I.js";
2
2
  import { T as i } from "../turndown.browser.es-RmA_HBaI.js";
3
3
  const p = (a) => {
4
4
  const e = new i({
@@ -1,4 +1,5 @@
1
1
  export * from './html-to-markdown';
2
2
  export * from './markdown-to-html';
3
3
  export * from './is-in-viewport';
4
+ export * from './convert-legacy-math-delimiters';
4
5
  export * from './create-scribe-editor';
@@ -1,10 +1,12 @@
1
- import { html2md as t } from "./html-to-markdown.js";
1
+ import { html2md as o } from "./html-to-markdown.js";
2
2
  import { md2html as m } from "./markdown-to-html.js";
3
- import { isInViewport as f } from "./is-in-viewport.js";
4
- import { createScribeEditor as x } from "./create-scribe-editor.js";
3
+ import { isInViewport as p } from "./is-in-viewport.js";
4
+ import { convertLegacyMathDelimiters as x } from "./convert-legacy-math-delimiters.js";
5
+ import { createScribeEditor as a } from "./create-scribe-editor.js";
5
6
  export {
6
- x as createScribeEditor,
7
- t as html2md,
8
- f as isInViewport,
7
+ x as convertLegacyMathDelimiters,
8
+ a as createScribeEditor,
9
+ o as html2md,
10
+ p as isInViewport,
9
11
  m as md2html
10
12
  };
@@ -1,5 +1,5 @@
1
- import { m as r } from "../marked.esm-BS_MmRZC.js";
2
- import { p as a } from "../purify.es-BGaRrCfO.js";
1
+ import { m as r } from "../marked.esm-H7n4rMcO.js";
2
+ import { p as a } from "../purify.es-DcWaZU6I.js";
3
3
  const p = (m) => a.sanitize(r.parse(m, { async: !1 }));
4
4
  export {
5
5
  p as md2html
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A Tiptap-based 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.",
4
4
  "author": "CleverTask",
5
5
  "private": false,
6
- "version": "0.0.12",
6
+ "version": "0.0.13",
7
7
  "type": "module",
8
8
  "main": "dist/main.js",
9
9
  "types": "dist/main.d.ts",
@@ -32,32 +32,35 @@
32
32
  "url": "git+https://github.com/clevertask/scribe.git"
33
33
  },
34
34
  "peerDependencies": {
35
- "react": "^18.3.1",
36
- "react-dom": "^18.3.1"
35
+ "react": ">=18.3.1 <20.0.0",
36
+ "react-dom": ">=18.3.1 <20.0.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@tailwindcss/typography": "^0.5.16",
40
- "@types/lodash": "^4.17.20",
41
- "@types/node": "^22.16.0",
42
- "@types/react": "^18.3.23",
43
- "@types/react-dom": "^18.3.7",
44
- "@types/turndown": "^5.0.5",
45
- "@typescript-eslint/eslint-plugin": "^8.35.1",
46
- "@typescript-eslint/parser": "^8.35.1",
47
- "@vitejs/plugin-react": "^4.6.0",
48
- "autoprefixer": "^10.4.21",
49
- "eslint": "^9.30.1",
50
- "eslint-plugin-react-hooks": "^5.2.0",
51
- "eslint-plugin-react-refresh": "^0.4.20",
52
- "glob": "^11.0.3",
53
- "lodash": "^4.17.21",
39
+ "@eslint/js": "^9.39.3",
40
+ "@tailwindcss/typography": "^0.5.19",
41
+ "@types/lodash": "^4.17.23",
42
+ "@types/node": "^24.10.13",
43
+ "@types/react": "^19.2.14",
44
+ "@types/react-dom": "^19.2.3",
45
+ "@types/turndown": "^5.0.6",
46
+ "@typescript-eslint/eslint-plugin": "^8.56.0",
47
+ "@typescript-eslint/parser": "^8.56.0",
48
+ "@vitejs/plugin-react": "^5.1.4",
49
+ "autoprefixer": "^10.4.24",
50
+ "eslint": "^9.39.3",
51
+ "eslint-plugin-react-hooks": "^7.0.1",
52
+ "eslint-plugin-react-refresh": "^0.5.0",
53
+ "glob": "^13.0.6",
54
+ "globals": "^17.3.0",
55
+ "lodash": "^4.17.23",
54
56
  "postcss": "^8.5.6",
55
57
  "postcss-cli": "^11.0.1",
56
58
  "prettier": "3.4.2",
57
- "tailwindcss": "^3.4.17",
58
- "typescript": "^5.8.3",
59
- "vite": "^6.3.5",
60
- "vite-plugin-dts": "^4.5.4",
59
+ "tailwindcss": "^3.4.19",
60
+ "typescript": "~5.9.3",
61
+ "typescript-eslint": "^8.56.0",
62
+ "unplugin-dts": "1.0.0-beta.6",
63
+ "vite": "^7.3.1",
61
64
  "vite-plugin-lib-inject-css": "^2.2.2"
62
65
  },
63
66
  "prepublishOnly": "npm run build",
@@ -66,31 +69,31 @@
66
69
  "registry": "https://registry.npmjs.org/"
67
70
  },
68
71
  "dependencies": {
69
- "@tiptap/core": "^2.25.0",
70
- "@tiptap/extension-emoji": "^2.25.0",
71
- "@tiptap/extension-focus": "^2.25.0",
72
- "@tiptap/extension-highlight": "^2.25.0",
73
- "@tiptap/extension-image": "^2.25.0",
74
- "@tiptap/extension-link": "^2.25.0",
75
- "@tiptap/extension-mathematics": "^3.19.0",
76
- "@tiptap/extension-placeholder": "^2.25.0",
77
- "@tiptap/extension-table": "^2.25.0",
78
- "@tiptap/extension-table-cell": "^2.25.0",
79
- "@tiptap/extension-table-header": "^2.25.0",
80
- "@tiptap/extension-table-row": "^2.25.0",
81
- "@tiptap/extension-task-item": "^2.25.0",
82
- "@tiptap/extension-task-list": "^2.25.0",
83
- "@tiptap/extension-typography": "^2.25.0",
84
- "@tiptap/pm": "^2.25.0",
85
- "@tiptap/react": "^2.25.0",
86
- "@tiptap/starter-kit": "^2.25.0",
87
- "@tiptap/suggestion": "^2.25.0",
72
+ "@tiptap/core": "^2.27.2",
73
+ "@tiptap/extension-emoji": "^2.27.2",
74
+ "@tiptap/extension-focus": "^2.27.2",
75
+ "@tiptap/extension-highlight": "^2.27.2",
76
+ "@tiptap/extension-image": "^2.27.2",
77
+ "@tiptap/extension-link": "^2.27.2",
78
+ "@tiptap/extension-mathematics": "^3.20.0",
79
+ "@tiptap/extension-placeholder": "^2.27.2",
80
+ "@tiptap/extension-table": "^2.27.2",
81
+ "@tiptap/extension-table-cell": "^2.27.2",
82
+ "@tiptap/extension-table-header": "^2.27.2",
83
+ "@tiptap/extension-table-row": "^2.27.2",
84
+ "@tiptap/extension-task-item": "^2.27.2",
85
+ "@tiptap/extension-task-list": "^2.27.2",
86
+ "@tiptap/extension-typography": "^2.27.2",
87
+ "@tiptap/pm": "^2.27.2",
88
+ "@tiptap/react": "^2.27.2",
89
+ "@tiptap/starter-kit": "^2.27.2",
90
+ "@tiptap/suggestion": "^2.27.2",
88
91
  "clsx": "^2.1.1",
89
92
  "dompurify": "^3.3.1",
90
- "katex": "^0.16.22",
93
+ "katex": "^0.16.28",
91
94
  "marked": "^15.0.12",
92
95
  "tippy.js": "^6.3.7",
93
- "turndown": "^7.2.0"
96
+ "turndown": "^7.2.2"
94
97
  },
95
98
  "scripts": {
96
99
  "dev": "vite",
@@ -1,160 +0,0 @@
1
- import { P as L, b as U, D as z, c as G, e as H, a as J } from "./index-DoNRu1rY.js";
2
- function Q(g) {
3
- var i;
4
- const { char: v, allowSpaces: m, allowToIncludeChar: P, allowedPrefixes: p, startOfLine: K, $position: f } = g, C = m && !P, h = H(v), B = new RegExp(`\\s${h}$`), M = K ? "^" : "", R = P ? "" : h, $ = C ? new RegExp(`${M}${h}.*?(?=\\s${R}|$)`, "gm") : new RegExp(`${M}(?:^)?${h}[^\\s${R}]*`, "gm"), x = ((i = f.nodeBefore) === null || i === void 0 ? void 0 : i.isText) && f.nodeBefore.text;
5
- if (!x)
6
- return null;
7
- const k = f.pos - x.length, n = Array.from(x.matchAll($)).pop();
8
- if (!n || n.input === void 0 || n.index === void 0)
9
- return null;
10
- const e = n.input.slice(Math.max(0, n.index - 1), n.index), w = new RegExp(`^[${p == null ? void 0 : p.join("")}\0]?$`).test(e);
11
- if (p !== null && !w)
12
- return null;
13
- const o = k + n.index;
14
- let a = o + n[0].length;
15
- return C && B.test(x.slice(a - 1, a + 1)) && (n[0] += " ", a += 1), o < f.pos && a >= f.pos ? {
16
- range: {
17
- from: o,
18
- to: a
19
- },
20
- query: n[0].slice(v.length),
21
- text: n[0]
22
- } : null;
23
- }
24
- const V = new L("suggestion");
25
- function W({ pluginKey: g = V, editor: i, char: v = "@", allowSpaces: m = !1, allowToIncludeChar: P = !1, allowedPrefixes: p = [" "], startOfLine: K = !1, decorationTag: f = "span", decorationClass: C = "suggestion", decorationContent: h = "", decorationEmptyClass: B = "is-empty", command: M = () => null, items: R = () => [], render: $ = () => ({}), allow: x = () => !0, findSuggestionMatch: k = Q }) {
26
- let n;
27
- const e = $ == null ? void 0 : $(), w = new U({
28
- key: g,
29
- view() {
30
- return {
31
- update: async (o, a) => {
32
- var l, c, r, u, d, q, y;
33
- const t = (l = this.key) === null || l === void 0 ? void 0 : l.getState(a), s = (c = this.key) === null || c === void 0 ? void 0 : c.getState(o.state), _ = t.active && s.active && t.range.from !== s.range.from, b = !t.active && s.active, j = t.active && !s.active, A = !b && !j && t.query !== s.query, E = b || _ && A, D = A || _, N = j || _ && A;
34
- if (!E && !D && !N)
35
- return;
36
- const S = N && !E ? t : s, F = o.dom.querySelector(`[data-decoration-id="${S.decorationId}"]`);
37
- n = {
38
- editor: i,
39
- range: S.range,
40
- query: S.query,
41
- text: S.text,
42
- items: [],
43
- command: (I) => M({
44
- editor: i,
45
- range: S.range,
46
- props: I
47
- }),
48
- decorationNode: F,
49
- // virtual node for popper.js or tippy.js
50
- // this can be used for building popups without a DOM node
51
- clientRect: F ? () => {
52
- var I;
53
- const { decorationId: T } = (I = this.key) === null || I === void 0 ? void 0 : I.getState(i.state), O = o.dom.querySelector(`[data-decoration-id="${T}"]`);
54
- return (O == null ? void 0 : O.getBoundingClientRect()) || null;
55
- } : null
56
- }, E && ((r = e == null ? void 0 : e.onBeforeStart) === null || r === void 0 || r.call(e, n)), D && ((u = e == null ? void 0 : e.onBeforeUpdate) === null || u === void 0 || u.call(e, n)), (D || E) && (n.items = await R({
57
- editor: i,
58
- query: S.query
59
- })), N && ((d = e == null ? void 0 : e.onExit) === null || d === void 0 || d.call(e, n)), D && ((q = e == null ? void 0 : e.onUpdate) === null || q === void 0 || q.call(e, n)), E && ((y = e == null ? void 0 : e.onStart) === null || y === void 0 || y.call(e, n));
60
- },
61
- destroy: () => {
62
- var o;
63
- n && ((o = e == null ? void 0 : e.onExit) === null || o === void 0 || o.call(e, n));
64
- }
65
- };
66
- },
67
- state: {
68
- // Initialize the plugin's internal state.
69
- init() {
70
- return {
71
- active: !1,
72
- range: {
73
- from: 0,
74
- to: 0
75
- },
76
- query: null,
77
- text: null,
78
- composing: !1
79
- };
80
- },
81
- // Apply changes to the plugin state from a view transaction.
82
- apply(o, a, l, c) {
83
- const { isEditable: r } = i, { composing: u } = i.view, { selection: d } = o, { empty: q, from: y } = d, t = { ...a };
84
- if (t.composing = u, r && (q || i.view.composing)) {
85
- (y < a.range.from || y > a.range.to) && !u && !a.composing && (t.active = !1);
86
- const s = k({
87
- char: v,
88
- allowSpaces: m,
89
- allowToIncludeChar: P,
90
- allowedPrefixes: p,
91
- startOfLine: K,
92
- $position: d.$from
93
- }), _ = `id_${Math.floor(Math.random() * 4294967295)}`;
94
- s && x({
95
- editor: i,
96
- state: c,
97
- range: s.range,
98
- isActive: a.active
99
- }) ? (t.active = !0, t.decorationId = a.decorationId ? a.decorationId : _, t.range = s.range, t.query = s.query, t.text = s.text) : t.active = !1;
100
- } else
101
- t.active = !1;
102
- return t.active || (t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null), t;
103
- }
104
- },
105
- props: {
106
- // Call the keydown hook if suggestion is active.
107
- handleKeyDown(o, a) {
108
- var l;
109
- const { active: c, range: r } = w.getState(o.state);
110
- return c && ((l = e == null ? void 0 : e.onKeyDown) === null || l === void 0 ? void 0 : l.call(e, { view: o, event: a, range: r })) || !1;
111
- },
112
- // Setup decorator on the currently active suggestion.
113
- decorations(o) {
114
- const { active: a, range: l, decorationId: c, query: r } = w.getState(o);
115
- if (!a)
116
- return null;
117
- const u = !(r != null && r.length), d = [C];
118
- return u && d.push(B), z.create(o.doc, [
119
- G.inline(l.from, l.to, {
120
- nodeName: f,
121
- class: d.join(" "),
122
- "data-decoration-id": c,
123
- "data-decoration-content": h
124
- })
125
- ]);
126
- }
127
- }
128
- });
129
- return w;
130
- }
131
- const X = new L("slashSuggestion"), Z = J.create({
132
- name: "slashCommand",
133
- addOptions() {
134
- var g;
135
- return {
136
- ...(g = this.parent) == null ? void 0 : g.call(this),
137
- slashSuggestion: {
138
- char: "/",
139
- startOfLine: !0,
140
- command: ({ editor: i, range: v, props: m }) => {
141
- m.command({ editor: i, range: v, props: m });
142
- }
143
- }
144
- };
145
- },
146
- addProseMirrorPlugins() {
147
- return [
148
- W({
149
- pluginKey: X,
150
- ...this.options.slashSuggestion,
151
- editor: this.editor
152
- })
153
- ];
154
- }
155
- });
156
- export {
157
- Z as S,
158
- W as a,
159
- X as s
160
- };