@portabletext/editor 3.3.15 → 3.3.17
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 +2069 -0
- package/lib/behaviors/index.d.ts +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +14 -8
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.ts +1 -1
- package/lib/selectors/index.d.ts +1 -1
- package/lib/utils/index.d.ts +3 -3
- package/package.json +8 -8
- package/lib/_chunks-dts/index.d.ts +0 -3520
package/lib/behaviors/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { J as defineBehavior, Y as BehaviorGuard, a as forward, c as CustomBehaviorEvent, d as SyntheticBehaviorEvent, i as execute, l as InsertPlacement, n as BehaviorActionSet, o as raise, q as Behavior, r as effect, s as BehaviorEvent, t as BehaviorAction, u as NativeBehaviorEvent } from "../_chunks-dts/
|
|
2
|
-
export { Behavior, BehaviorAction, BehaviorActionSet, BehaviorEvent, BehaviorGuard, CustomBehaviorEvent, InsertPlacement, NativeBehaviorEvent, SyntheticBehaviorEvent, defineBehavior, effect, execute, forward, raise };
|
|
1
|
+
import { J as defineBehavior, Y as BehaviorGuard, a as forward, c as CustomBehaviorEvent, d as SyntheticBehaviorEvent, i as execute, l as InsertPlacement, n as BehaviorActionSet, o as raise, q as Behavior, r as effect, s as BehaviorEvent, t as BehaviorAction, u as NativeBehaviorEvent } from "../_chunks-dts/behavior.types.action.js";
|
|
2
|
+
export { type Behavior, type BehaviorAction, type BehaviorActionSet, type BehaviorEvent, type BehaviorGuard, type CustomBehaviorEvent, type InsertPlacement, type NativeBehaviorEvent, type SyntheticBehaviorEvent, defineBehavior, effect, execute, forward, raise };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as BlockAnnotationRenderProps, $t as AnnotationPath, A as PortableTextTextBlock, At as ReadyChange, B as EditorSelector, Bt as ScrollSelectionIntoViewFunction, C as ListDefinition, Ct as OnPasteResultOrPromise, D as PortableTextChild, Dt as PortableTextMemberSchemaTypes, E as PortableTextBlock, Et as PatchObservable, F as BlockOffset, Ft as RenderDecoratorFunction, G as EditorConfig, Gt as PortableTextEditable, H as EditorProvider, Ht as UndoChange, I as useEditor, It as RenderEditableFunction, Jt as PortableTextEditor, K as EditorEvent, Kt as PortableTextEditableProps, L as defaultKeyGenerator, Lt as RenderListItemFunction, M as StyleDefinition, Mt as RenderAnnotationFunction, N as StyleSchemaType, Nt as RenderBlockFunction, O as PortableTextObject, Ot as RangeDecoration, P as defineSchema, Pt as RenderChildFunction, Q as AddedAnnotationPaths, Qt as EditorSchema, R as usePortableTextEditorSelection, Rt as RenderPlaceholderFunction, S as InlineObjectSchemaType, St as OnPasteResult, T as Patch, Tt as PatchChange, U as EditorProviderProps, Ut as UnsetChange, V as useEditorSelector, Vt as SelectionChange, W as Editor, Wt as ValueChange, X as EditorContext, Xt as EditorEmittedEvent, Yt as PortableTextEditorProps, Z as EditorSnapshot, Zt as MutationEvent, _ as BlockObjectSchemaType, _t as LoadingChange, at as BlurChange, b as FieldDefinition, bt as OnCopyFn, ct as EditableAPIDeleteOptions, dt as EditorSelection, en as BlockPath, et as BlockChildRenderProps, f as PatchesEvent, ft as EditorSelectionPoint, g as BlockObjectDefinition, gt as InvalidValueResolution, h as BaseDefinition, ht as InvalidValue, it as BlockStyleRenderProps, j as SchemaDefinition, jt as RedoChange, k as PortableTextSpan, kt as RangeDecorationOnMovedDetails, lt as EditorChange, m as AnnotationSchemaType, mt as FocusChange, nt as BlockListItemRenderProps, ot as ConnectionChange, p as AnnotationDefinition, pt as ErrorChange, qt as HotkeyOptions, rt as BlockRenderProps, st as EditableAPI, tn as ChildPath, tt as BlockDecoratorRenderProps, ut as EditorChanges, v as DecoratorDefinition, vt as MutationChange, w as ListSchemaType, wt as PasteData, x as InlineObjectDefinition, xt as OnPasteFn, y as DecoratorSchemaType, yt as OnBeforeInputFn, z as usePortableTextEditor, zt as RenderStyleFunction } from "./_chunks-dts/
|
|
1
|
+
import { $ as BlockAnnotationRenderProps, $t as AnnotationPath, A as PortableTextTextBlock, At as ReadyChange, B as EditorSelector, Bt as ScrollSelectionIntoViewFunction, C as ListDefinition, Ct as OnPasteResultOrPromise, D as PortableTextChild, Dt as PortableTextMemberSchemaTypes, E as PortableTextBlock, Et as PatchObservable, F as BlockOffset, Ft as RenderDecoratorFunction, G as EditorConfig, Gt as PortableTextEditable, H as EditorProvider, Ht as UndoChange, I as useEditor, It as RenderEditableFunction, Jt as PortableTextEditor, K as EditorEvent, Kt as PortableTextEditableProps, L as defaultKeyGenerator, Lt as RenderListItemFunction, M as StyleDefinition, Mt as RenderAnnotationFunction, N as StyleSchemaType, Nt as RenderBlockFunction, O as PortableTextObject, Ot as RangeDecoration, P as defineSchema, Pt as RenderChildFunction, Q as AddedAnnotationPaths, Qt as EditorSchema, R as usePortableTextEditorSelection, Rt as RenderPlaceholderFunction, S as InlineObjectSchemaType, St as OnPasteResult, T as Patch, Tt as PatchChange, U as EditorProviderProps, Ut as UnsetChange, V as useEditorSelector, Vt as SelectionChange, W as Editor, Wt as ValueChange, X as EditorContext, Xt as EditorEmittedEvent, Yt as PortableTextEditorProps, Z as EditorSnapshot, Zt as MutationEvent, _ as BlockObjectSchemaType, _t as LoadingChange, at as BlurChange, b as FieldDefinition, bt as OnCopyFn, ct as EditableAPIDeleteOptions, dt as EditorSelection, en as BlockPath, et as BlockChildRenderProps, f as PatchesEvent, ft as EditorSelectionPoint, g as BlockObjectDefinition, gt as InvalidValueResolution, h as BaseDefinition, ht as InvalidValue, it as BlockStyleRenderProps, j as SchemaDefinition, jt as RedoChange, k as PortableTextSpan, kt as RangeDecorationOnMovedDetails, lt as EditorChange, m as AnnotationSchemaType, mt as FocusChange, nt as BlockListItemRenderProps, ot as ConnectionChange, p as AnnotationDefinition, pt as ErrorChange, qt as HotkeyOptions, rt as BlockRenderProps, st as EditableAPI, tn as ChildPath, tt as BlockDecoratorRenderProps, ut as EditorChanges, v as DecoratorDefinition, vt as MutationChange, w as ListSchemaType, wt as PasteData, x as InlineObjectDefinition, xt as OnPasteFn, y as DecoratorSchemaType, yt as OnBeforeInputFn, z as usePortableTextEditor, zt as RenderStyleFunction } from "./_chunks-dts/behavior.types.action.js";
|
|
2
2
|
export { AddedAnnotationPaths, AnnotationDefinition, AnnotationPath, AnnotationSchemaType, BaseDefinition, BlockAnnotationRenderProps, BlockChildRenderProps, BlockDecoratorRenderProps, BlockListItemRenderProps, BlockObjectDefinition, BlockObjectSchemaType, BlockOffset, BlockPath, BlockRenderProps, BlockStyleRenderProps, BlurChange, ChildPath, ConnectionChange, DecoratorDefinition, DecoratorSchemaType, EditableAPI, EditableAPIDeleteOptions, Editor, EditorChange, EditorChanges, EditorConfig, EditorContext, EditorEmittedEvent, EditorEvent, EditorProvider, EditorProviderProps, EditorSchema, EditorSelection, EditorSelectionPoint, EditorSelector, EditorSnapshot, ErrorChange, FieldDefinition, FocusChange, HotkeyOptions, InlineObjectDefinition, InlineObjectSchemaType, InvalidValue, InvalidValueResolution, ListDefinition, ListSchemaType, LoadingChange, MutationChange, MutationEvent, OnBeforeInputFn, OnCopyFn, OnPasteFn, OnPasteResult, OnPasteResultOrPromise, PasteData, Patch, PatchChange, PatchObservable, PatchesEvent, PortableTextBlock, PortableTextChild, PortableTextEditable, PortableTextEditableProps, PortableTextEditor, PortableTextEditorProps, PortableTextMemberSchemaTypes, PortableTextObject, PortableTextSpan, PortableTextTextBlock, RangeDecoration, RangeDecorationOnMovedDetails, ReadyChange, RedoChange, RenderAnnotationFunction, RenderBlockFunction, RenderChildFunction, RenderDecoratorFunction, RenderEditableFunction, RenderListItemFunction, RenderPlaceholderFunction, RenderStyleFunction, SchemaDefinition, ScrollSelectionIntoViewFunction, SelectionChange, StyleDefinition, StyleSchemaType, UndoChange, UnsetChange, ValueChange, defineSchema, defaultKeyGenerator as keyGenerator, useEditor, useEditorSelector, usePortableTextEditor, usePortableTextEditorSelection };
|
package/lib/index.js
CHANGED
|
@@ -6611,11 +6611,13 @@ function insertNodePatch(schema, children, operation, beforeValue) {
|
|
|
6611
6611
|
_key: block._key
|
|
6612
6612
|
}, "children", {
|
|
6613
6613
|
_key: block.children[operation.path[1] - 1]._key
|
|
6614
|
-
}]
|
|
6614
|
+
}], setIfMissingPatch = setIfMissing([], [{
|
|
6615
|
+
_key: block._key
|
|
6616
|
+
}, "children"]);
|
|
6615
6617
|
if (Text.isText(operation.node))
|
|
6616
|
-
return [insert([operation.node], position, path)];
|
|
6618
|
+
return [setIfMissingPatch, insert([operation.node], position, path)];
|
|
6617
6619
|
const _type = operation.node._type, _key = operation.node._key, value = "value" in operation.node && typeof operation.node.value == "object" ? operation.node.value : {};
|
|
6618
|
-
return [insert([{
|
|
6620
|
+
return [setIfMissingPatch, insert([{
|
|
6619
6621
|
_type,
|
|
6620
6622
|
_key,
|
|
6621
6623
|
...value
|
|
@@ -6657,7 +6659,9 @@ function splitNodePatch(schema, children, operation, beforeValue) {
|
|
|
6657
6659
|
...splitBlock,
|
|
6658
6660
|
children: splitBlock.children.slice(operation.path[1] + 1, operation.path[1] + 2)
|
|
6659
6661
|
}, schema.block.name).children;
|
|
6660
|
-
patches.push(
|
|
6662
|
+
patches.push(setIfMissing([], [{
|
|
6663
|
+
_key: splitBlock._key
|
|
6664
|
+
}, "children"])), patches.push(insert(targetSpans, "after", [{
|
|
6661
6665
|
_key: splitBlock._key
|
|
6662
6666
|
}, "children", {
|
|
6663
6667
|
_key: splitSpan._key
|
|
@@ -6746,7 +6750,9 @@ function moveNodePatch(schema, beforeValue, operation) {
|
|
|
6746
6750
|
_key: block._key
|
|
6747
6751
|
}, "children", {
|
|
6748
6752
|
_key: child._key
|
|
6749
|
-
}])), patches.push(
|
|
6753
|
+
}])), patches.push(setIfMissing([], [{
|
|
6754
|
+
_key: targetBlock._key
|
|
6755
|
+
}, "children"])), patches.push(insert([childToInsert], position, [{
|
|
6750
6756
|
_key: targetBlock._key
|
|
6751
6757
|
}, "children", {
|
|
6752
6758
|
_key: targetChild._key
|
|
@@ -12296,7 +12302,7 @@ function syncBlock({
|
|
|
12296
12302
|
type: "patch",
|
|
12297
12303
|
patch
|
|
12298
12304
|
});
|
|
12299
|
-
})), validation.valid || validation.resolution?.autoResolve ? (oldBlock._key === block._key ? (debug$2.enabled && debug$2("Updating block", oldBlock, block), Editor.withoutNormalizing(slateEditor, () => {
|
|
12305
|
+
})), validation.valid || validation.resolution?.autoResolve ? (oldBlock._key === block._key && oldBlock._type === block._type ? (debug$2.enabled && debug$2("Updating block", oldBlock, block), Editor.withoutNormalizing(slateEditor, () => {
|
|
12300
12306
|
withRemoteChanges(slateEditor, () => {
|
|
12301
12307
|
withoutPatching(slateEditor, () => {
|
|
12302
12308
|
updateBlock({
|
|
@@ -12366,9 +12372,9 @@ function updateBlock({
|
|
|
12366
12372
|
at: [index2, childIndex]
|
|
12367
12373
|
}));
|
|
12368
12374
|
}), slateBlock.children.forEach((currentBlockChild, currentBlockChildIndex) => {
|
|
12369
|
-
const oldBlockChild = oldBlock.children.at(currentBlockChildIndex), isChildChanged = oldBlockChild
|
|
12375
|
+
const oldBlockChild = oldBlock.children.at(currentBlockChildIndex), isChildChanged = !oldBlockChild || !isEqualChild(currentBlockChild, oldBlockChild), isTextChanged = oldBlockChild && Text.isText(oldBlockChild) && currentBlockChild.text !== oldBlockChild.text, path = [index, currentBlockChildIndex];
|
|
12370
12376
|
if (isChildChanged)
|
|
12371
|
-
if (currentBlockChild._key === oldBlockChild?._key) {
|
|
12377
|
+
if (currentBlockChild._key === oldBlockChild?._key && currentBlockChild._type === oldBlockChild?._type) {
|
|
12372
12378
|
debug$2("Updating changed child", currentBlockChild, oldBlockChild), Transforms.setNodes(slateEditor, currentBlockChild, {
|
|
12373
12379
|
at: path
|
|
12374
12380
|
});
|