@blocklet/editor 2.1.121 → 2.1.123

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.
@@ -120,6 +120,7 @@ export class EditorTranslator {
120
120
  this.editor.update(() => {
121
121
  if (!sid) {
122
122
  this.editor.setEditorState(this.originalEditorState);
123
+ this.translations = [];
123
124
  }
124
125
  else if (this.options.displayMode === 'translationOnly') {
125
126
  const nodeKey = this.sidToNodeKeyMap.get(sid);
@@ -72,6 +72,24 @@ function InternalInlineTranslationPlugin({ translateService, detectLanguage, onT
72
72
  document.removeEventListener('keydown', handler);
73
73
  };
74
74
  }, [editor, editorTranslator]);
75
+ // 对于翻译后的内容,禁止 checkbox 点击交互
76
+ useEffect(() => {
77
+ const onClick = (event) => {
78
+ const target = event.target;
79
+ if (editorTranslator.isTranslated && target.closest('li[role="checkbox"]')) {
80
+ event.preventDefault();
81
+ event.stopPropagation();
82
+ }
83
+ };
84
+ return editor.registerRootListener((rootElement, prevRootElement) => {
85
+ if (prevRootElement) {
86
+ prevRootElement.removeEventListener('click', onClick, { capture: true });
87
+ }
88
+ if (rootElement) {
89
+ rootElement.addEventListener('click', onClick, { capture: true });
90
+ }
91
+ });
92
+ }, [editor, editorTranslator]);
75
93
  if (editor.isEditable()) {
76
94
  return null;
77
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/editor",
3
- "version": "2.1.121",
3
+ "version": "2.1.123",
4
4
  "main": "lib/index.js",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -66,7 +66,7 @@
66
66
  "ufo": "^1.5.4",
67
67
  "url-join": "^4.0.1",
68
68
  "zustand": "^4.5.5",
69
- "@blocklet/pdf": "^2.1.121"
69
+ "@blocklet/pdf": "^2.1.123"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@babel/core": "^7.25.2",