@cyberyozh/text-editor 0.2.0 → 0.2.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/editor.css +1 -0
- package/dist/editor.css.map +1 -1
- package/dist/editor.js +44 -45
- package/dist/editor.js.map +1 -1
- package/dist/editor.mjs +49 -50
- package/dist/editor.mjs.map +1 -1
- package/dist/render.js +29 -38
- package/dist/render.js.map +1 -1
- package/dist/render.mjs +34 -43
- package/dist/render.mjs.map +1 -1
- package/dist/styles/index.css +1 -0
- package/package.json +38 -38
- package/src/editor/controls/bubble-menu-content.tsx +12 -3
- package/src/editor/controls/character-count.tsx +7 -4
- package/src/editor/dialogs/image-dialog/image-dialog.css +1 -0
package/dist/styles/index.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberyozh/text-editor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Rich text editor library based on Tiptap for CyberYozh",
|
|
5
5
|
"author": "CyberYozh",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,43 +47,43 @@
|
|
|
47
47
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@floating-ui/dom": "
|
|
51
|
-
"@tiptap/core": "
|
|
52
|
-
"@tiptap/extension-blockquote": "
|
|
53
|
-
"@tiptap/extension-bubble-menu": "
|
|
54
|
-
"@tiptap/extension-code": "
|
|
55
|
-
"@tiptap/extension-code-block-lowlight": "
|
|
56
|
-
"@tiptap/extension-collaboration": "
|
|
57
|
-
"@tiptap/extension-details": "
|
|
58
|
-
"@tiptap/extension-drag-handle": "
|
|
59
|
-
"@tiptap/extension-drag-handle-react": "
|
|
60
|
-
"@tiptap/extension-floating-menu": "
|
|
61
|
-
"@tiptap/extension-hard-break": "
|
|
62
|
-
"@tiptap/extension-highlight": "
|
|
63
|
-
"@tiptap/extension-horizontal-rule": "
|
|
64
|
-
"@tiptap/extension-image": "
|
|
65
|
-
"@tiptap/extension-link": "
|
|
66
|
-
"@tiptap/extension-list": "
|
|
67
|
-
"@tiptap/extension-mathematics": "
|
|
68
|
-
"@tiptap/extension-node-range": "
|
|
69
|
-
"@tiptap/extension-subscript": "
|
|
70
|
-
"@tiptap/extension-superscript": "
|
|
71
|
-
"@tiptap/extension-table": "
|
|
72
|
-
"@tiptap/extension-text-align": "
|
|
73
|
-
"@tiptap/extensions": "
|
|
74
|
-
"@tiptap/html": "
|
|
75
|
-
"@tiptap/pm": "
|
|
76
|
-
"@tiptap/react": "
|
|
77
|
-
"@tiptap/starter-kit": "
|
|
78
|
-
"@tiptap/static-renderer": "
|
|
79
|
-
"@tiptap/suggestion": "
|
|
80
|
-
"@tiptap/y-tiptap": "
|
|
81
|
-
"emoji-picker-react": "
|
|
82
|
-
"highlight.js": "
|
|
83
|
-
"katex": "
|
|
84
|
-
"lowlight": "
|
|
85
|
-
"y-protocols": "
|
|
86
|
-
"yjs": "
|
|
50
|
+
"@floating-ui/dom": "1.7.6",
|
|
51
|
+
"@tiptap/core": "3.23.6",
|
|
52
|
+
"@tiptap/extension-blockquote": "3.23.6",
|
|
53
|
+
"@tiptap/extension-bubble-menu": "3.23.6",
|
|
54
|
+
"@tiptap/extension-code": "3.23.6",
|
|
55
|
+
"@tiptap/extension-code-block-lowlight": "3.23.6",
|
|
56
|
+
"@tiptap/extension-collaboration": "3.23.6",
|
|
57
|
+
"@tiptap/extension-details": "3.23.6",
|
|
58
|
+
"@tiptap/extension-drag-handle": "3.23.6",
|
|
59
|
+
"@tiptap/extension-drag-handle-react": "3.23.6",
|
|
60
|
+
"@tiptap/extension-floating-menu": "3.23.6",
|
|
61
|
+
"@tiptap/extension-hard-break": "3.23.6",
|
|
62
|
+
"@tiptap/extension-highlight": "3.23.6",
|
|
63
|
+
"@tiptap/extension-horizontal-rule": "3.23.6",
|
|
64
|
+
"@tiptap/extension-image": "3.23.6",
|
|
65
|
+
"@tiptap/extension-link": "3.23.6",
|
|
66
|
+
"@tiptap/extension-list": "3.23.6",
|
|
67
|
+
"@tiptap/extension-mathematics": "3.23.6",
|
|
68
|
+
"@tiptap/extension-node-range": "3.23.6",
|
|
69
|
+
"@tiptap/extension-subscript": "3.23.6",
|
|
70
|
+
"@tiptap/extension-superscript": "3.23.6",
|
|
71
|
+
"@tiptap/extension-table": "3.23.6",
|
|
72
|
+
"@tiptap/extension-text-align": "3.23.6",
|
|
73
|
+
"@tiptap/extensions": "3.23.6",
|
|
74
|
+
"@tiptap/html": "3.23.6",
|
|
75
|
+
"@tiptap/pm": "3.23.6",
|
|
76
|
+
"@tiptap/react": "3.23.6",
|
|
77
|
+
"@tiptap/starter-kit": "3.23.6",
|
|
78
|
+
"@tiptap/static-renderer": "3.23.6",
|
|
79
|
+
"@tiptap/suggestion": "3.23.6",
|
|
80
|
+
"@tiptap/y-tiptap": "3.0.3",
|
|
81
|
+
"emoji-picker-react": "4.19.1",
|
|
82
|
+
"highlight.js": "11.11.1",
|
|
83
|
+
"katex": "0.16.35",
|
|
84
|
+
"lowlight": "3.3.0",
|
|
85
|
+
"y-protocols": "1.0.7",
|
|
86
|
+
"yjs": "13.6.30"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@changesets/cli": "^2.30.0",
|
|
@@ -69,10 +69,19 @@ export const BubbleMenuContent = ({ editor, onLinkClick }: Props) => {
|
|
|
69
69
|
} = useEditorState({
|
|
70
70
|
editor,
|
|
71
71
|
selector: (ctx) => {
|
|
72
|
+
let canAvalable = false;
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
ctx.editor.can().undo();
|
|
76
|
+
canAvalable = true;
|
|
77
|
+
} catch {
|
|
78
|
+
// When `lang` changes, the editor reloads and there is a brief period where parts of its internal state are inaccessible, causing certain methods to throw exceptions
|
|
79
|
+
}
|
|
80
|
+
|
|
72
81
|
return {
|
|
73
|
-
canUndo: ctx.editor.can().undo(),
|
|
74
|
-
canRedo: ctx.editor.can().redo(),
|
|
75
|
-
canClearMarks: ctx.editor.can().unsetAllMarks(),
|
|
82
|
+
canUndo: canAvalable ? ctx.editor.can().undo() : false,
|
|
83
|
+
canRedo: canAvalable ? ctx.editor.can().redo() : false,
|
|
84
|
+
canClearMarks: canAvalable ? ctx.editor.can().unsetAllMarks() : false,
|
|
76
85
|
isHeading2: ctx.editor.isActive("heading", { level: 2 }),
|
|
77
86
|
isHeading3: ctx.editor.isActive("heading", { level: 3 }),
|
|
78
87
|
isHeading4: ctx.editor.isActive("heading", { level: 4 }),
|
|
@@ -11,10 +11,13 @@ export const CharacterCount = ({ editor }: Props) => {
|
|
|
11
11
|
const translations = useTiptapTranslations();
|
|
12
12
|
const { charactersCount, wordsCount } = useEditorState({
|
|
13
13
|
editor,
|
|
14
|
-
selector: (context) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
selector: (context) => {
|
|
15
|
+
return {
|
|
16
|
+
charactersCount:
|
|
17
|
+
context.editor.storage.characterCount?.characters() || 0,
|
|
18
|
+
wordsCount: context.editor.storage.characterCount?.words() || 0,
|
|
19
|
+
};
|
|
20
|
+
},
|
|
18
21
|
});
|
|
19
22
|
|
|
20
23
|
return (
|