@portabletext/editor 1.44.16 → 1.45.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-cjs/behavior.core.cjs +5 -5
- package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/behavior.markdown.cjs +29 -23
- package/lib/_chunks-cjs/behavior.markdown.cjs.map +1 -1
- package/lib/_chunks-cjs/editor-provider.cjs +62 -38
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-cjs/parse-blocks.cjs +74 -22
- package/lib/_chunks-cjs/parse-blocks.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js +5 -5
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/behavior.markdown.js +29 -23
- package/lib/_chunks-es/behavior.markdown.js.map +1 -1
- package/lib/_chunks-es/editor-provider.js +63 -39
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/_chunks-es/parse-blocks.js +75 -23
- package/lib/_chunks-es/parse-blocks.js.map +1 -1
- package/lib/behaviors/index.cjs +18 -14
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.d.cts +53 -41
- package/lib/behaviors/index.d.ts +53 -41
- package/lib/behaviors/index.js +18 -14
- package/lib/behaviors/index.js.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +28 -9
- package/lib/index.d.ts +28 -9
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +7 -7
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +8 -6
- package/lib/plugins/index.d.ts +8 -6
- package/lib/plugins/index.js +7 -7
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.d.cts +8 -6
- package/lib/selectors/index.d.ts +8 -6
- package/lib/utils/index.d.cts +8 -6
- package/lib/utils/index.d.ts +8 -6
- package/package.json +3 -3
- package/src/behavior-actions/behavior.action.annotation.add.ts +26 -5
- package/src/behavior-actions/behavior.action.decorator.add.ts +4 -4
- package/src/behavior-actions/behavior.action.delete.text.ts +1 -4
- package/src/behavior-actions/behavior.action.delete.ts +2 -2
- package/src/behavior-actions/behavior.action.insert-inline-object.ts +14 -13
- package/src/behavior-actions/behavior.action.select.ts +1 -1
- package/src/behaviors/behavior.abstract.decorator.ts +2 -2
- package/src/behaviors/behavior.abstract.select.ts +2 -2
- package/src/behaviors/behavior.core.annotations.ts +1 -1
- package/src/behaviors/behavior.core.block-objects.ts +4 -4
- package/src/behaviors/behavior.decorator-pair.ts +3 -3
- package/src/behaviors/behavior.default.ts +4 -4
- package/src/behaviors/behavior.emoji-picker.ts +18 -14
- package/src/behaviors/behavior.markdown.ts +29 -23
- package/src/behaviors/behavior.types.event.ts +11 -6
- package/src/converters/converter.portable-text.deserialize.test.ts +12 -3
- package/src/converters/converter.text-html.deserialize.test.ts +3 -1
- package/src/editor/Editable.tsx +1 -1
- package/src/editor/define-schema.ts +29 -5
- package/src/editor/plugins/__tests__/withEditableAPIInsert.test.tsx +2 -2
- package/src/editor/plugins/create-with-event-listeners.ts +1 -1
- package/src/internal-utils/parse-blocks.ts +109 -39
- package/src/plugins/plugin.decorator-shortcut.ts +3 -3
- package/src/plugins/plugin.one-line.tsx +1 -1
package/lib/index.d.cts
CHANGED
|
@@ -79,7 +79,7 @@ declare type AbstractBehaviorEvent =
|
|
|
79
79
|
| {
|
|
80
80
|
type: StrictExtract<AbstractBehaviorEventType, 'decorator.toggle'>
|
|
81
81
|
decorator: string
|
|
82
|
-
|
|
82
|
+
at?: {
|
|
83
83
|
anchor: BlockOffset
|
|
84
84
|
focus: BlockOffset
|
|
85
85
|
}
|
|
@@ -5088,6 +5088,11 @@ declare type ExternalEditorEvent =
|
|
|
5088
5088
|
declare type ExtractNamespace<TType extends string> =
|
|
5089
5089
|
TType extends `${infer Namespace}.${string}` ? Namespace : TType
|
|
5090
5090
|
|
|
5091
|
+
declare type FieldDefinition = {
|
|
5092
|
+
name: string
|
|
5093
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object'
|
|
5094
|
+
}
|
|
5095
|
+
|
|
5091
5096
|
/**
|
|
5092
5097
|
* The editor received focus
|
|
5093
5098
|
* @beta */
|
|
@@ -6113,9 +6118,21 @@ export declare type SchemaDefinition<
|
|
|
6113
6118
|
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
6114
6119
|
> = {
|
|
6115
6120
|
decorators?: ReadonlyArray<TBaseDefinition>
|
|
6116
|
-
blockObjects?: ReadonlyArray<
|
|
6117
|
-
|
|
6118
|
-
|
|
6121
|
+
blockObjects?: ReadonlyArray<
|
|
6122
|
+
TBaseDefinition & {
|
|
6123
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
6124
|
+
}
|
|
6125
|
+
>
|
|
6126
|
+
inlineObjects?: ReadonlyArray<
|
|
6127
|
+
TBaseDefinition & {
|
|
6128
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
6129
|
+
}
|
|
6130
|
+
>
|
|
6131
|
+
annotations?: ReadonlyArray<
|
|
6132
|
+
TBaseDefinition & {
|
|
6133
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
6134
|
+
}
|
|
6135
|
+
>
|
|
6119
6136
|
lists?: ReadonlyArray<TBaseDefinition>
|
|
6120
6137
|
styles?: ReadonlyArray<TBaseDefinition>
|
|
6121
6138
|
}
|
|
@@ -6188,7 +6205,7 @@ declare type SyntheticBehaviorEvent =
|
|
|
6188
6205
|
| {
|
|
6189
6206
|
type: StrictExtract<SyntheticBehaviorEventType, 'decorator.add'>
|
|
6190
6207
|
decorator: string
|
|
6191
|
-
|
|
6208
|
+
at?: {
|
|
6192
6209
|
anchor: BlockOffset
|
|
6193
6210
|
focus: BlockOffset
|
|
6194
6211
|
}
|
|
@@ -6199,7 +6216,7 @@ declare type SyntheticBehaviorEvent =
|
|
|
6199
6216
|
}
|
|
6200
6217
|
| {
|
|
6201
6218
|
type: StrictExtract<SyntheticBehaviorEventType, 'delete'>
|
|
6202
|
-
|
|
6219
|
+
at: NonNullable<EditorSelection>
|
|
6203
6220
|
}
|
|
6204
6221
|
| {
|
|
6205
6222
|
type: StrictExtract<SyntheticBehaviorEventType, 'delete.backward'>
|
|
@@ -6215,8 +6232,10 @@ declare type SyntheticBehaviorEvent =
|
|
|
6215
6232
|
}
|
|
6216
6233
|
| {
|
|
6217
6234
|
type: StrictExtract<SyntheticBehaviorEventType, 'delete.text'>
|
|
6218
|
-
|
|
6219
|
-
|
|
6235
|
+
at: {
|
|
6236
|
+
anchor: BlockOffset
|
|
6237
|
+
focus: BlockOffset
|
|
6238
|
+
}
|
|
6220
6239
|
}
|
|
6221
6240
|
| {
|
|
6222
6241
|
type: StrictExtract<SyntheticBehaviorEventType, 'focus'>
|
|
@@ -6264,7 +6283,7 @@ declare type SyntheticBehaviorEvent =
|
|
|
6264
6283
|
}
|
|
6265
6284
|
| {
|
|
6266
6285
|
type: StrictExtract<SyntheticBehaviorEventType, 'select'>
|
|
6267
|
-
|
|
6286
|
+
at: EditorSelection
|
|
6268
6287
|
}
|
|
6269
6288
|
| {
|
|
6270
6289
|
type: StrictExtract<SyntheticBehaviorEventType, 'split.block'>
|
package/lib/index.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ declare type AbstractBehaviorEvent =
|
|
|
79
79
|
| {
|
|
80
80
|
type: StrictExtract<AbstractBehaviorEventType, 'decorator.toggle'>
|
|
81
81
|
decorator: string
|
|
82
|
-
|
|
82
|
+
at?: {
|
|
83
83
|
anchor: BlockOffset
|
|
84
84
|
focus: BlockOffset
|
|
85
85
|
}
|
|
@@ -5088,6 +5088,11 @@ declare type ExternalEditorEvent =
|
|
|
5088
5088
|
declare type ExtractNamespace<TType extends string> =
|
|
5089
5089
|
TType extends `${infer Namespace}.${string}` ? Namespace : TType
|
|
5090
5090
|
|
|
5091
|
+
declare type FieldDefinition = {
|
|
5092
|
+
name: string
|
|
5093
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object'
|
|
5094
|
+
}
|
|
5095
|
+
|
|
5091
5096
|
/**
|
|
5092
5097
|
* The editor received focus
|
|
5093
5098
|
* @beta */
|
|
@@ -6113,9 +6118,21 @@ export declare type SchemaDefinition<
|
|
|
6113
6118
|
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
6114
6119
|
> = {
|
|
6115
6120
|
decorators?: ReadonlyArray<TBaseDefinition>
|
|
6116
|
-
blockObjects?: ReadonlyArray<
|
|
6117
|
-
|
|
6118
|
-
|
|
6121
|
+
blockObjects?: ReadonlyArray<
|
|
6122
|
+
TBaseDefinition & {
|
|
6123
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
6124
|
+
}
|
|
6125
|
+
>
|
|
6126
|
+
inlineObjects?: ReadonlyArray<
|
|
6127
|
+
TBaseDefinition & {
|
|
6128
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
6129
|
+
}
|
|
6130
|
+
>
|
|
6131
|
+
annotations?: ReadonlyArray<
|
|
6132
|
+
TBaseDefinition & {
|
|
6133
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
6134
|
+
}
|
|
6135
|
+
>
|
|
6119
6136
|
lists?: ReadonlyArray<TBaseDefinition>
|
|
6120
6137
|
styles?: ReadonlyArray<TBaseDefinition>
|
|
6121
6138
|
}
|
|
@@ -6188,7 +6205,7 @@ declare type SyntheticBehaviorEvent =
|
|
|
6188
6205
|
| {
|
|
6189
6206
|
type: StrictExtract<SyntheticBehaviorEventType, 'decorator.add'>
|
|
6190
6207
|
decorator: string
|
|
6191
|
-
|
|
6208
|
+
at?: {
|
|
6192
6209
|
anchor: BlockOffset
|
|
6193
6210
|
focus: BlockOffset
|
|
6194
6211
|
}
|
|
@@ -6199,7 +6216,7 @@ declare type SyntheticBehaviorEvent =
|
|
|
6199
6216
|
}
|
|
6200
6217
|
| {
|
|
6201
6218
|
type: StrictExtract<SyntheticBehaviorEventType, 'delete'>
|
|
6202
|
-
|
|
6219
|
+
at: NonNullable<EditorSelection>
|
|
6203
6220
|
}
|
|
6204
6221
|
| {
|
|
6205
6222
|
type: StrictExtract<SyntheticBehaviorEventType, 'delete.backward'>
|
|
@@ -6215,8 +6232,10 @@ declare type SyntheticBehaviorEvent =
|
|
|
6215
6232
|
}
|
|
6216
6233
|
| {
|
|
6217
6234
|
type: StrictExtract<SyntheticBehaviorEventType, 'delete.text'>
|
|
6218
|
-
|
|
6219
|
-
|
|
6235
|
+
at: {
|
|
6236
|
+
anchor: BlockOffset
|
|
6237
|
+
focus: BlockOffset
|
|
6238
|
+
}
|
|
6220
6239
|
}
|
|
6221
6240
|
| {
|
|
6222
6241
|
type: StrictExtract<SyntheticBehaviorEventType, 'focus'>
|
|
@@ -6264,7 +6283,7 @@ declare type SyntheticBehaviorEvent =
|
|
|
6264
6283
|
}
|
|
6265
6284
|
| {
|
|
6266
6285
|
type: StrictExtract<SyntheticBehaviorEventType, 'select'>
|
|
6267
|
-
|
|
6286
|
+
at: EditorSelection
|
|
6268
6287
|
}
|
|
6269
6288
|
| {
|
|
6270
6289
|
type: StrictExtract<SyntheticBehaviorEventType, 'split.block'>
|
package/lib/index.js
CHANGED
|
@@ -1443,7 +1443,7 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
1443
1443
|
type: "behavior event",
|
|
1444
1444
|
behaviorEvent: {
|
|
1445
1445
|
type: "select",
|
|
1446
|
-
|
|
1446
|
+
at: isSelectionCollapsed$1(dragSelection) ? dragSelection : {
|
|
1447
1447
|
anchor: getSelectionEndPoint(dragSelection),
|
|
1448
1448
|
focus: getSelectionEndPoint(dragSelection),
|
|
1449
1449
|
backward: !1
|