@portabletext/editor 1.50.6 → 1.50.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-cjs/util.selection-point-to-block-offset.cjs +1 -1
- package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +1 -1
- package/lib/_chunks-es/util.selection-point-to-block-offset.js +1 -1
- package/lib/_chunks-es/util.selection-point-to-block-offset.js.map +1 -1
- package/lib/behaviors/index.d.cts +24 -16
- package/lib/behaviors/index.d.ts +24 -16
- package/lib/index.cjs +320 -252
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +24 -16
- package/lib/index.d.ts +24 -16
- package/lib/index.js +322 -254
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.cts +24 -16
- package/lib/plugins/index.d.ts +24 -16
- package/lib/selectors/index.d.cts +24 -16
- package/lib/selectors/index.d.ts +24 -16
- package/lib/utils/index.d.cts +24 -16
- package/lib/utils/index.d.ts +24 -16
- package/package.json +4 -4
- package/src/behaviors/behavior.abstract.delete.ts +60 -0
- package/src/behaviors/behavior.abstract.split.ts +23 -13
- package/src/behaviors/behavior.types.event.ts +23 -16
- package/src/editor/plugins/create-with-event-listeners.ts +41 -1
- package/src/editor/sync-machine.ts +26 -20
- package/src/internal-utils/applyPatch.ts +298 -207
- package/src/internal-utils/slate-utils.ts +23 -0
- package/src/internal-utils/test-editor.tsx +45 -0
- package/src/operations/behavior.operation.delete.ts +36 -22
- package/src/operations/behavior.operations.ts +0 -27
- package/src/utils/util.is-selection-collapsed.ts +2 -1
- package/src/internal-utils/__tests__/dmpToOperations.test.ts +0 -207
- package/src/operations/behavior.operation.delete.backward.ts +0 -8
- package/src/operations/behavior.operation.delete.block.ts +0 -24
- package/src/operations/behavior.operation.delete.forward.ts +0 -8
package/lib/index.d.cts
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
} from 'react'
|
|
39
39
|
import type {Observable, Subject} from 'rxjs'
|
|
40
40
|
import {Descendant} from 'slate'
|
|
41
|
-
import type {Operation
|
|
41
|
+
import type {Operation} from 'slate'
|
|
42
42
|
import type {DOMNode} from 'slate-dom'
|
|
43
43
|
import type {ReactEditor} from 'slate-react'
|
|
44
44
|
import {
|
|
@@ -86,6 +86,18 @@ declare type AbstractBehaviorEvent =
|
|
|
86
86
|
focus: BlockOffset
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
| {
|
|
90
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'delete.backward'>
|
|
91
|
+
unit: 'character' | 'word' | 'line' | 'block'
|
|
92
|
+
}
|
|
93
|
+
| {
|
|
94
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'delete.block'>
|
|
95
|
+
at: [KeyedSegment]
|
|
96
|
+
}
|
|
97
|
+
| {
|
|
98
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'delete.forward'>
|
|
99
|
+
unit: 'character' | 'word' | 'line' | 'block'
|
|
100
|
+
}
|
|
89
101
|
| {
|
|
90
102
|
type: StrictExtract<SyntheticBehaviorEventType, 'delete.text'>
|
|
91
103
|
at: {
|
|
@@ -216,6 +228,9 @@ declare type AbstractBehaviorEvent =
|
|
|
216
228
|
declare const abstractBehaviorEventTypes: readonly [
|
|
217
229
|
'annotation.toggle',
|
|
218
230
|
'decorator.toggle',
|
|
231
|
+
'delete.backward',
|
|
232
|
+
'delete.block',
|
|
233
|
+
'delete.forward',
|
|
219
234
|
'delete.text',
|
|
220
235
|
'deserialize',
|
|
221
236
|
'deserialization.success',
|
|
@@ -4002,18 +4017,14 @@ declare type SyntheticBehaviorEvent =
|
|
|
4002
4017
|
| {
|
|
4003
4018
|
type: StrictExtract<SyntheticBehaviorEventType, 'delete'>
|
|
4004
4019
|
at: NonNullable<EditorSelection>
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
}
|
|
4014
|
-
| {
|
|
4015
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'delete.forward'>
|
|
4016
|
-
unit: TextUnit
|
|
4020
|
+
/**
|
|
4021
|
+
* Defaults to forward deletion.
|
|
4022
|
+
*/
|
|
4023
|
+
direction?: 'backward' | 'forward'
|
|
4024
|
+
/**
|
|
4025
|
+
* Defaults to character deletion.
|
|
4026
|
+
*/
|
|
4027
|
+
unit?: 'character' | 'word' | 'line' | 'block'
|
|
4017
4028
|
}
|
|
4018
4029
|
| {
|
|
4019
4030
|
type: StrictExtract<SyntheticBehaviorEventType, 'history.redo'>
|
|
@@ -4088,9 +4099,6 @@ declare const syntheticBehaviorEventTypes: readonly [
|
|
|
4088
4099
|
'decorator.add',
|
|
4089
4100
|
'decorator.remove',
|
|
4090
4101
|
'delete',
|
|
4091
|
-
'delete.backward',
|
|
4092
|
-
'delete.block',
|
|
4093
|
-
'delete.forward',
|
|
4094
4102
|
'history.redo',
|
|
4095
4103
|
'history.undo',
|
|
4096
4104
|
'insert.inline object',
|
package/lib/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
} from 'react'
|
|
39
39
|
import type {Observable, Subject} from 'rxjs'
|
|
40
40
|
import {Descendant} from 'slate'
|
|
41
|
-
import type {Operation
|
|
41
|
+
import type {Operation} from 'slate'
|
|
42
42
|
import type {DOMNode} from 'slate-dom'
|
|
43
43
|
import type {ReactEditor} from 'slate-react'
|
|
44
44
|
import {
|
|
@@ -86,6 +86,18 @@ declare type AbstractBehaviorEvent =
|
|
|
86
86
|
focus: BlockOffset
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
| {
|
|
90
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'delete.backward'>
|
|
91
|
+
unit: 'character' | 'word' | 'line' | 'block'
|
|
92
|
+
}
|
|
93
|
+
| {
|
|
94
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'delete.block'>
|
|
95
|
+
at: [KeyedSegment]
|
|
96
|
+
}
|
|
97
|
+
| {
|
|
98
|
+
type: StrictExtract<SyntheticBehaviorEventType, 'delete.forward'>
|
|
99
|
+
unit: 'character' | 'word' | 'line' | 'block'
|
|
100
|
+
}
|
|
89
101
|
| {
|
|
90
102
|
type: StrictExtract<SyntheticBehaviorEventType, 'delete.text'>
|
|
91
103
|
at: {
|
|
@@ -216,6 +228,9 @@ declare type AbstractBehaviorEvent =
|
|
|
216
228
|
declare const abstractBehaviorEventTypes: readonly [
|
|
217
229
|
'annotation.toggle',
|
|
218
230
|
'decorator.toggle',
|
|
231
|
+
'delete.backward',
|
|
232
|
+
'delete.block',
|
|
233
|
+
'delete.forward',
|
|
219
234
|
'delete.text',
|
|
220
235
|
'deserialize',
|
|
221
236
|
'deserialization.success',
|
|
@@ -4002,18 +4017,14 @@ declare type SyntheticBehaviorEvent =
|
|
|
4002
4017
|
| {
|
|
4003
4018
|
type: StrictExtract<SyntheticBehaviorEventType, 'delete'>
|
|
4004
4019
|
at: NonNullable<EditorSelection>
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
}
|
|
4014
|
-
| {
|
|
4015
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'delete.forward'>
|
|
4016
|
-
unit: TextUnit
|
|
4020
|
+
/**
|
|
4021
|
+
* Defaults to forward deletion.
|
|
4022
|
+
*/
|
|
4023
|
+
direction?: 'backward' | 'forward'
|
|
4024
|
+
/**
|
|
4025
|
+
* Defaults to character deletion.
|
|
4026
|
+
*/
|
|
4027
|
+
unit?: 'character' | 'word' | 'line' | 'block'
|
|
4017
4028
|
}
|
|
4018
4029
|
| {
|
|
4019
4030
|
type: StrictExtract<SyntheticBehaviorEventType, 'history.redo'>
|
|
@@ -4088,9 +4099,6 @@ declare const syntheticBehaviorEventTypes: readonly [
|
|
|
4088
4099
|
'decorator.add',
|
|
4089
4100
|
'decorator.remove',
|
|
4090
4101
|
'delete',
|
|
4091
|
-
'delete.backward',
|
|
4092
|
-
'delete.block',
|
|
4093
|
-
'delete.forward',
|
|
4094
4102
|
'history.redo',
|
|
4095
4103
|
'history.undo',
|
|
4096
4104
|
'insert.inline object',
|