@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.
@@ -497,6 +497,7 @@
497
497
  gap: 12px;
498
498
  }
499
499
  .image-dialog-preview {
500
+ width: auto;
500
501
  max-width: 100%;
501
502
  height: auto;
502
503
  margin-bottom: 12px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyberyozh/text-editor",
3
- "version": "0.2.0",
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": "^1.7.6",
51
- "@tiptap/core": "^3.20.0",
52
- "@tiptap/extension-blockquote": "^3.20.0",
53
- "@tiptap/extension-bubble-menu": "^3.20.0",
54
- "@tiptap/extension-code": "^3.20.0",
55
- "@tiptap/extension-code-block-lowlight": "^3.20.0",
56
- "@tiptap/extension-collaboration": "^3.20.0",
57
- "@tiptap/extension-details": "^3.20.0",
58
- "@tiptap/extension-drag-handle": "^3.20.0",
59
- "@tiptap/extension-drag-handle-react": "^3.20.0",
60
- "@tiptap/extension-floating-menu": "^3.20.0",
61
- "@tiptap/extension-hard-break": "^3.20.0",
62
- "@tiptap/extension-highlight": "^3.20.0",
63
- "@tiptap/extension-horizontal-rule": "^3.20.0",
64
- "@tiptap/extension-image": "^3.20.0",
65
- "@tiptap/extension-link": "^3.20.0",
66
- "@tiptap/extension-list": "^3.20.0",
67
- "@tiptap/extension-mathematics": "^3.20.0",
68
- "@tiptap/extension-node-range": "^3.20.0",
69
- "@tiptap/extension-subscript": "^3.20.0",
70
- "@tiptap/extension-superscript": "^3.20.0",
71
- "@tiptap/extension-table": "^3.20.0",
72
- "@tiptap/extension-text-align": "^3.20.0",
73
- "@tiptap/extensions": "^3.20.0",
74
- "@tiptap/html": "^3.20.0",
75
- "@tiptap/pm": "^3.20.0",
76
- "@tiptap/react": "^3.17.1",
77
- "@tiptap/starter-kit": "^3.20.0",
78
- "@tiptap/static-renderer": "^3.20.0",
79
- "@tiptap/suggestion": "^3.20.0",
80
- "@tiptap/y-tiptap": "^3.0.2",
81
- "emoji-picker-react": "^4.18.0",
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.29"
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
- charactersCount: context.editor.storage.characterCount.characters(),
16
- wordsCount: context.editor.storage.characterCount.words(),
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 (
@@ -25,6 +25,7 @@
25
25
  }
26
26
 
27
27
  .image-dialog-preview {
28
+ width: auto;
28
29
  max-width: 100%;
29
30
  height: auto;
30
31
  margin-bottom: 12px;