@portabletext/editor 3.3.5 → 3.3.7
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/index.d.ts +9 -9
- package/lib/_chunks-es/util.slice-blocks.js +3 -3
- package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
- package/lib/index.js +279 -58
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.js +1 -1
- package/lib/plugins/index.js.map +1 -1
- package/package.json +9 -13
package/lib/plugins/index.js
CHANGED
|
@@ -19,7 +19,7 @@ function _temp(unregister) {
|
|
|
19
19
|
const EditorRefPlugin = React.forwardRef((_, ref) => {
|
|
20
20
|
const $ = c(2), editor = useEditor(), portableTextEditorRef = React.useRef(editor);
|
|
21
21
|
let t0, t1;
|
|
22
|
-
return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => portableTextEditorRef.current, t1 = [], $[0] = t0, $[1] = t1) : (t0 = $[0], t1 = $[1]), React.useImperativeHandle(ref, t0, t1), null;
|
|
22
|
+
return $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = () => portableTextEditorRef.current, t1 = [], $[0] = t0, $[1] = t1) : (t0 = $[0], t1 = $[1]), React.useImperativeHandle(ref, t0, t1), null;
|
|
23
23
|
});
|
|
24
24
|
EditorRefPlugin.displayName = "EditorRefPlugin";
|
|
25
25
|
function EventListenerPlugin(props) {
|
package/lib/plugins/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/plugins/plugin.behavior.tsx","../../src/plugins/plugin.editor-ref.tsx","../../src/plugins/plugin.event-listener.tsx"],"sourcesContent":["import {useEffect} from 'react'\nimport type {Behavior} from '../behaviors/behavior.types.behavior'\nimport {useEditor} from '../editor/use-editor'\n\n/**\n * @beta\n */\nexport function BehaviorPlugin(props: {behaviors: Array<Behavior>}) {\n const editor = useEditor()\n\n useEffect(() => {\n const unregisterBehaviors = props.behaviors.map((behavior) =>\n editor.registerBehavior({behavior}),\n )\n\n return () => {\n unregisterBehaviors.forEach((unregister) => {\n unregister()\n })\n }\n }, [editor, props.behaviors])\n\n return null\n}\n","import React from 'react'\nimport type {Editor} from '../editor'\nimport {useEditor} from '../editor/use-editor'\n\n/**\n * @beta\n */\nexport const EditorRefPlugin = React.forwardRef<Editor | null>((_, ref) => {\n const editor = useEditor()\n\n const portableTextEditorRef = React.useRef(editor)\n\n React.useImperativeHandle(ref, () => portableTextEditorRef.current, [])\n\n return null\n})\nEditorRefPlugin.displayName = 'EditorRefPlugin'\n","import {useEffect} from 'react'\nimport type {EditorEmittedEvent} from '../editor/relay-machine'\nimport {useEditor} from '../editor/use-editor'\n\n/**\n * @public\n * Listen for events emitted by the editor. Must be used inside `EditorProvider`. Events available include:\n * - 'blurred'\n * - 'done loading'\n * - 'editable'\n * - 'error'\n * - 'focused'\n * - 'invalid value'\n * - 'loading'\n * - 'mutation'\n * - 'patch'\n * - 'read only'\n * - 'ready'\n * - 'selection'\n * - 'value changed'\n *\n * @example\n * Listen and log events.\n * ```tsx\n * import {EditorProvider} from '@portabletext/editor'\n * import {EventListenerPlugin} from '@portabletext/editor/plugins'\n *\n * function MyComponent() {\n * return (\n * <EditorProvider>\n * <EventListenerPlugin\n * on={(event) => {\n * console.log(event)\n * }\n * } />\n * { ... }\n * </EditorProvider>\n * )\n * }\n * ```\n * @example\n * Handle events when there is a mutation.\n * ```tsx\n * <EventListenerPlugin\n * on={(event) => {\n * if (event.type === 'mutation') {\n * console.log('Value changed:', event.snapshot)\n * }\n * }}\n * />\n * ```\n * @group Components\n */\nexport function EventListenerPlugin(props: {\n on: (event: EditorEmittedEvent) => void\n}) {\n const editor = useEditor()\n\n useEffect(() => {\n const subscription = editor.on('*', props.on)\n\n return () => {\n subscription.unsubscribe()\n }\n }, [editor, props.on])\n\n return null\n}\n"],"names":["BehaviorPlugin","props","$","_c","editor","useEditor","t0","t1","behaviors","unregisterBehaviors","map","behavior","registerBehavior","forEach","_temp","useEffect","unregister","EditorRefPlugin","React","forwardRef","_","ref","portableTextEditorRef","useRef","Symbol","for","current","useImperativeHandle","displayName","EventListenerPlugin","on","subscription","unsubscribe"],"mappings":";;;AAOO,SAAAA,eAAAC,OAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GACLC,SAAeC,UAAAA;AAAW,MAAAC,IAAAC;AAAA,SAAAL,SAAAE,UAAAF,EAAA,CAAA,MAAAD,MAAAO,aAEhBF,KAAAA,MAAA;AACR,UAAAG,sBAA4BR,MAAKO,UAAUE,IAAKC,CAAAA,aAC9CP,OAAMQ,iBAAkB;AAAA,MAAAD;AAAAA,IAAAA,CAAU,CACpC;AAAC,WAEM,MAAA;AACLF,0BAAmBI,QAASC,KAE3B;AAAA,IAAC;AAAA,EACH,GACAP,MAACH,QAAQH,MAAKO,SAAU,GAACN,OAAAE,QAAAF,EAAA,CAAA,IAAAD,MAAAO,WAAAN,OAAAI,IAAAJ,OAAAK,OAAAD,KAAAJ,EAAA,CAAA,GAAAK,KAAAL,EAAA,CAAA,IAV5Ba,UAAUT,IAUPC,EAAyB,GAErB;AAAI;AAfN,SAAAO,MAAAE,YAAA;AAUCA,aAAAA;AAAY;ACVb,MAAMC,kBAAkBC,MAAMC,WAA0B,CAAAC,GAAAC,QAAA;AAAA,QAAAnB,IAAAC,EAAA,CAAA,GAC7DC,SAAeC,aAEfiB,wBAA8BJ,MAAKK,OAAQnB,MAAM;AAAC,MAAAE,IAAAC;AAAA,SAAAL,EAAA,CAAA,MAAAsB,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/plugins/plugin.behavior.tsx","../../src/plugins/plugin.editor-ref.tsx","../../src/plugins/plugin.event-listener.tsx"],"sourcesContent":["import {useEffect} from 'react'\nimport type {Behavior} from '../behaviors/behavior.types.behavior'\nimport {useEditor} from '../editor/use-editor'\n\n/**\n * @beta\n */\nexport function BehaviorPlugin(props: {behaviors: Array<Behavior>}) {\n const editor = useEditor()\n\n useEffect(() => {\n const unregisterBehaviors = props.behaviors.map((behavior) =>\n editor.registerBehavior({behavior}),\n )\n\n return () => {\n unregisterBehaviors.forEach((unregister) => {\n unregister()\n })\n }\n }, [editor, props.behaviors])\n\n return null\n}\n","import React from 'react'\nimport type {Editor} from '../editor'\nimport {useEditor} from '../editor/use-editor'\n\n/**\n * @beta\n */\nexport const EditorRefPlugin = React.forwardRef<Editor | null>((_, ref) => {\n const editor = useEditor()\n\n const portableTextEditorRef = React.useRef(editor)\n\n React.useImperativeHandle(ref, () => portableTextEditorRef.current, [])\n\n return null\n})\nEditorRefPlugin.displayName = 'EditorRefPlugin'\n","import {useEffect} from 'react'\nimport type {EditorEmittedEvent} from '../editor/relay-machine'\nimport {useEditor} from '../editor/use-editor'\n\n/**\n * @public\n * Listen for events emitted by the editor. Must be used inside `EditorProvider`. Events available include:\n * - 'blurred'\n * - 'done loading'\n * - 'editable'\n * - 'error'\n * - 'focused'\n * - 'invalid value'\n * - 'loading'\n * - 'mutation'\n * - 'patch'\n * - 'read only'\n * - 'ready'\n * - 'selection'\n * - 'value changed'\n *\n * @example\n * Listen and log events.\n * ```tsx\n * import {EditorProvider} from '@portabletext/editor'\n * import {EventListenerPlugin} from '@portabletext/editor/plugins'\n *\n * function MyComponent() {\n * return (\n * <EditorProvider>\n * <EventListenerPlugin\n * on={(event) => {\n * console.log(event)\n * }\n * } />\n * { ... }\n * </EditorProvider>\n * )\n * }\n * ```\n * @example\n * Handle events when there is a mutation.\n * ```tsx\n * <EventListenerPlugin\n * on={(event) => {\n * if (event.type === 'mutation') {\n * console.log('Value changed:', event.snapshot)\n * }\n * }}\n * />\n * ```\n * @group Components\n */\nexport function EventListenerPlugin(props: {\n on: (event: EditorEmittedEvent) => void\n}) {\n const editor = useEditor()\n\n useEffect(() => {\n const subscription = editor.on('*', props.on)\n\n return () => {\n subscription.unsubscribe()\n }\n }, [editor, props.on])\n\n return null\n}\n"],"names":["BehaviorPlugin","props","$","_c","editor","useEditor","t0","t1","behaviors","unregisterBehaviors","map","behavior","registerBehavior","forEach","_temp","useEffect","unregister","EditorRefPlugin","React","forwardRef","_","ref","portableTextEditorRef","useRef","Symbol","for","current","useImperativeHandle","displayName","EventListenerPlugin","on","subscription","unsubscribe"],"mappings":";;;AAOO,SAAAA,eAAAC,OAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GACLC,SAAeC,UAAAA;AAAW,MAAAC,IAAAC;AAAA,SAAAL,SAAAE,UAAAF,EAAA,CAAA,MAAAD,MAAAO,aAEhBF,KAAAA,MAAA;AACR,UAAAG,sBAA4BR,MAAKO,UAAUE,IAAKC,CAAAA,aAC9CP,OAAMQ,iBAAkB;AAAA,MAAAD;AAAAA,IAAAA,CAAU,CACpC;AAAC,WAEM,MAAA;AACLF,0BAAmBI,QAASC,KAE3B;AAAA,IAAC;AAAA,EACH,GACAP,MAACH,QAAQH,MAAKO,SAAU,GAACN,OAAAE,QAAAF,EAAA,CAAA,IAAAD,MAAAO,WAAAN,OAAAI,IAAAJ,OAAAK,OAAAD,KAAAJ,EAAA,CAAA,GAAAK,KAAAL,EAAA,CAAA,IAV5Ba,UAAUT,IAUPC,EAAyB,GAErB;AAAI;AAfN,SAAAO,MAAAE,YAAA;AAUCA,aAAAA;AAAY;ACVb,MAAMC,kBAAkBC,MAAMC,WAA0B,CAAAC,GAAAC,QAAA;AAAA,QAAAnB,IAAAC,EAAA,CAAA,GAC7DC,SAAeC,aAEfiB,wBAA8BJ,MAAKK,OAAQnB,MAAM;AAAC,MAAAE,IAAAC;AAAA,SAAAL,EAAA,CAAA,MAAAsB,uBAAAC,IAAA,2BAAA,KAEnBnB,KAAAA,MAAMgB,sBAAqBI,SAAUnB,KAAA,CAAA,GAAEL,OAAAI,IAAAJ,OAAAK,OAAAD,KAAAJ,EAAA,CAAA,GAAAK,KAAAL,EAAA,CAAA,IAAtEgB,MAAKS,oBAAqBN,KAAKf,IAAqCC,EAAE,GAE/D;AAAI,CACZ;AACDU,gBAAgBW,cAAc;ACqCvB,SAAAC,oBAAA5B,OAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAGLC,SAAeC,UAAAA;AAAW,MAAAC,IAAAC;AAAA,SAAAL,SAAAE,UAAAF,EAAA,CAAA,MAAAD,MAAA6B,MAEhBxB,KAAAA,MAAA;AACR,UAAAyB,eAAqB3B,OAAM0B,GAAI,KAAK7B,MAAK6B,EAAG;AAAC,WAEtC,MAAA;AACLC,mBAAYC,YAAAA;AAAAA,IAAc;AAAA,EAC3B,GACAzB,MAACH,QAAQH,MAAK6B,EAAG,GAAC5B,OAAAE,QAAAF,EAAA,CAAA,IAAAD,MAAA6B,IAAA5B,OAAAI,IAAAJ,OAAAK,OAAAD,KAAAJ,EAAA,CAAA,GAAAK,KAAAL,EAAA,CAAA,IANrBa,UAAUT,IAMPC,EAAkB,GAEd;AAAI;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portabletext/editor",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.7",
|
|
4
4
|
"description": "Portable Text Editor made in React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -61,34 +61,30 @@
|
|
|
61
61
|
"lib"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@portabletext/to-html": "^
|
|
64
|
+
"@portabletext/to-html": "^5.0.0",
|
|
65
65
|
"@sanity/schema": "^4.20.3",
|
|
66
66
|
"@sanity/types": "^4.20.3",
|
|
67
67
|
"@xstate/react": "^6.0.0",
|
|
68
68
|
"debug": "^4.4.3",
|
|
69
|
-
"lodash": "^4.17.21",
|
|
70
|
-
"lodash.startcase": "^4.4.0",
|
|
71
69
|
"react-compiler-runtime": "^1.0.0",
|
|
72
70
|
"slate": "^0.120.0",
|
|
73
71
|
"slate-dom": "^0.119.0",
|
|
74
72
|
"slate-react": "^0.120.0",
|
|
75
73
|
"xstate": "^5.24.0",
|
|
76
|
-
"@portabletext/block-tools": "^4.1.
|
|
74
|
+
"@portabletext/block-tools": "^4.1.10",
|
|
77
75
|
"@portabletext/keyboard-shortcuts": "^2.1.1",
|
|
78
|
-
"@portabletext/markdown": "^1.0.
|
|
79
|
-
"@portabletext/patches": "^2.0.
|
|
76
|
+
"@portabletext/markdown": "^1.0.5",
|
|
77
|
+
"@portabletext/patches": "^2.0.2",
|
|
80
78
|
"@portabletext/schema": "^2.0.1"
|
|
81
79
|
},
|
|
82
80
|
"devDependencies": {
|
|
83
81
|
"@sanity/diff-match-patch": "^3.2.0",
|
|
84
|
-
"@sanity/pkg-utils": "^10.1.
|
|
82
|
+
"@sanity/pkg-utils": "^10.1.2",
|
|
85
83
|
"@types/debug": "^4.1.12",
|
|
86
|
-
"@types/lodash": "^4.17.20",
|
|
87
|
-
"@types/lodash.startcase": "^4.4.9",
|
|
88
84
|
"@types/node": "^20",
|
|
89
85
|
"@types/react": "^19.2.7",
|
|
90
86
|
"@types/react-dom": "^19.2.3",
|
|
91
|
-
"@vitejs/plugin-react": "^5.
|
|
87
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
92
88
|
"@vitest/browser": "^4.0.14",
|
|
93
89
|
"@vitest/browser-playwright": "^4.0.14",
|
|
94
90
|
"@vitest/coverage-istanbul": "^4.0.14",
|
|
@@ -105,12 +101,12 @@
|
|
|
105
101
|
"vite": "^7.1.12",
|
|
106
102
|
"vitest": "^4.0.14",
|
|
107
103
|
"vitest-browser-react": "^2.0.2",
|
|
108
|
-
"@portabletext/sanity-bridge": "1.2.
|
|
104
|
+
"@portabletext/sanity-bridge": "1.2.13",
|
|
109
105
|
"@portabletext/test": "^1.0.2",
|
|
110
106
|
"racejar": "2.0.1"
|
|
111
107
|
},
|
|
112
108
|
"peerDependencies": {
|
|
113
|
-
"@portabletext/sanity-bridge": "^1.2.
|
|
109
|
+
"@portabletext/sanity-bridge": "^1.2.13",
|
|
114
110
|
"react": "^18.3 || ^19",
|
|
115
111
|
"rxjs": "^7.8.2"
|
|
116
112
|
},
|