@portabletext/editor 2.9.0 → 2.9.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/lib/_chunks-dts/behavior.types.action.d.ts +12 -12
- package/lib/index.cjs +6 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +6 -2
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.ts +3 -3
- package/package.json +2 -2
- package/src/editor/Editable.tsx +12 -1
package/lib/plugins/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Behavior, Editor, EditorEmittedEvent, EditorSchema } from "../_chunks-dts/behavior.types.action.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react21 from "react";
|
|
3
3
|
import React from "react";
|
|
4
4
|
/**
|
|
5
5
|
* @beta
|
|
@@ -181,7 +181,7 @@ type MarkdownPluginConfig = MarkdownBehaviorsConfig & {
|
|
|
181
181
|
*/
|
|
182
182
|
declare function MarkdownPlugin(props: {
|
|
183
183
|
config: MarkdownPluginConfig;
|
|
184
|
-
}):
|
|
184
|
+
}): react21.JSX.Element;
|
|
185
185
|
/**
|
|
186
186
|
* @beta
|
|
187
187
|
* Restrict the editor to one line. The plugin takes care of blocking
|
|
@@ -192,5 +192,5 @@ declare function MarkdownPlugin(props: {
|
|
|
192
192
|
*
|
|
193
193
|
* @deprecated Install the plugin from `@portabletext/plugin-one-line`
|
|
194
194
|
*/
|
|
195
|
-
declare function OneLinePlugin():
|
|
195
|
+
declare function OneLinePlugin(): react21.JSX.Element;
|
|
196
196
|
export { BehaviorPlugin, DecoratorShortcutPlugin, EditorRefPlugin, EventListenerPlugin, MarkdownPlugin, type MarkdownPluginConfig, OneLinePlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portabletext/editor",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"description": "Portable Text Editor made in React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"slate-dom": "^0.118.1",
|
|
80
80
|
"slate-react": "0.117.4",
|
|
81
81
|
"xstate": "^5.21.0",
|
|
82
|
-
"@portabletext/keyboard-shortcuts": "^1.1.1",
|
|
83
82
|
"@portabletext/block-tools": "^3.5.5",
|
|
83
|
+
"@portabletext/keyboard-shortcuts": "^1.1.1",
|
|
84
84
|
"@portabletext/patches": "^1.1.8",
|
|
85
85
|
"@portabletext/schema": "^1.2.0"
|
|
86
86
|
},
|
package/src/editor/Editable.tsx
CHANGED
|
@@ -1027,7 +1027,18 @@ function validateSelection(slateEditor: Editor, activeElement: HTMLDivElement) {
|
|
|
1027
1027
|
if (!slateEditor.selection) {
|
|
1028
1028
|
return
|
|
1029
1029
|
}
|
|
1030
|
-
|
|
1030
|
+
|
|
1031
|
+
let root: Document | ShadowRoot | undefined
|
|
1032
|
+
|
|
1033
|
+
try {
|
|
1034
|
+
root = ReactEditor.findDocumentOrShadowRoot(slateEditor)
|
|
1035
|
+
} catch {}
|
|
1036
|
+
|
|
1037
|
+
if (!root) {
|
|
1038
|
+
// The editor has most likely been unmounted
|
|
1039
|
+
return
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1031
1042
|
// Return if the editor isn't the active element
|
|
1032
1043
|
if (activeElement !== root.activeElement) {
|
|
1033
1044
|
return
|