@portabletext/editor 1.55.13 → 1.55.15
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/{selector.is-selection-expanded.cjs → selector.get-focus-span.cjs} +27 -27
- package/lib/_chunks-cjs/selector.get-focus-span.cjs.map +1 -0
- package/lib/_chunks-cjs/selector.get-text-before.cjs +3 -3
- package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs +291 -168
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs +1 -1
- package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs.map +1 -1
- package/lib/_chunks-cjs/{util.is-equal-selection-points.cjs → util.is-selection-collapsed.cjs} +7 -3
- package/lib/_chunks-cjs/util.is-selection-collapsed.cjs.map +1 -0
- package/lib/_chunks-cjs/util.slice-blocks.cjs +2 -2
- package/lib/_chunks-cjs/util.slice-text-block.cjs +2 -6
- package/lib/_chunks-cjs/util.slice-text-block.cjs.map +1 -1
- package/lib/_chunks-es/{selector.is-selection-expanded.js → selector.get-focus-span.js} +27 -27
- package/lib/_chunks-es/selector.get-focus-span.js.map +1 -0
- package/lib/_chunks-es/selector.get-text-before.js +1 -1
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +266 -143
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
- package/lib/_chunks-es/util.child-selection-point-to-block-offset.js +1 -1
- package/lib/_chunks-es/{util.is-equal-selection-points.js → util.is-selection-collapsed.js} +7 -3
- package/lib/_chunks-es/util.is-selection-collapsed.js.map +1 -0
- package/lib/_chunks-es/util.slice-blocks.js +2 -2
- package/lib/_chunks-es/util.slice-text-block.js +1 -5
- package/lib/_chunks-es/util.slice-text-block.js.map +1 -1
- package/lib/behaviors/index.d.cts +3 -6
- package/lib/behaviors/index.d.ts +3 -6
- package/lib/index.cjs +357 -322
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +11 -20
- package/lib/index.d.ts +11 -20
- package/lib/index.js +296 -261
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +16 -16
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +3 -6
- package/lib/plugins/index.d.ts +3 -6
- package/lib/plugins/index.js +1 -1
- package/lib/selectors/index.cjs +14 -14
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.d.cts +3 -6
- package/lib/selectors/index.d.ts +3 -6
- package/lib/selectors/index.js +2 -2
- package/lib/utils/index.cjs +9 -9
- package/lib/utils/index.cjs.map +1 -1
- package/lib/utils/index.d.cts +3 -6
- package/lib/utils/index.d.ts +3 -6
- package/lib/utils/index.js +5 -5
- package/package.json +3 -3
- package/src/behaviors/behavior.abstract.ts +2 -1
- package/src/behaviors/behavior.core.dnd.ts +4 -4
- package/src/editor/Editable.tsx +8 -1
- package/src/editor/create-slate-editor.tsx +0 -1
- package/src/editor/editor-dom.ts +3 -3
- package/src/editor/editor-selector.ts +1 -13
- package/src/editor/editor-snapshot.ts +4 -19
- package/src/editor/plugins/createWithEditableAPI.ts +52 -13
- package/src/editor/plugins/createWithPortableTextMarkModel.ts +13 -4
- package/src/editor/plugins/with-plugins.ts +4 -8
- package/src/editor/range-decorations-machine.ts +24 -12
- package/src/internal-utils/create-test-snapshot.ts +2 -5
- package/src/internal-utils/paths.ts +65 -17
- package/src/internal-utils/ranges.test.ts +179 -0
- package/src/internal-utils/ranges.ts +39 -22
- package/src/internal-utils/test-editor.tsx +16 -1
- package/src/operations/behavior.operation.block.set.ts +10 -6
- package/src/operations/behavior.operation.block.unset.ts +10 -6
- package/src/operations/behavior.operation.child.set.ts +10 -6
- package/src/operations/behavior.operation.child.unset.ts +10 -6
- package/src/operations/behavior.operation.decorator.add.ts +17 -6
- package/src/operations/behavior.operation.delete.ts +8 -1
- package/src/operations/behavior.operation.insert.text.ts +34 -20
- package/src/operations/behavior.operation.move.block.ts +25 -3
- package/src/operations/behavior.operation.select.ts +9 -2
- package/src/selectors/selector.get-active-annotation-marks.ts +12 -0
- package/src/selectors/selector.get-active-annotations.ts +8 -20
- package/src/{editor/get-active-decorators.ts → selectors/selector.get-active-decorators.ts} +6 -11
- package/src/{internal-utils/mark-state.ts → selectors/selector.get-mark-state.ts} +41 -67
- package/src/selectors/selector.get-next-span.ts +56 -0
- package/src/selectors/selector.get-previous-span.ts +53 -0
- package/src/selectors/selector.is-active-annotation.ts +3 -1
- package/src/selectors/selector.is-active-decorator.ts +4 -1
- package/src/types/editor.ts +0 -2
- package/src/utils/util.is-selection-expanded.ts +13 -0
- package/lib/_chunks-cjs/selector.is-selection-expanded.cjs.map +0 -1
- package/lib/_chunks-cjs/util.is-equal-selection-points.cjs.map +0 -1
- package/lib/_chunks-es/selector.is-selection-expanded.js.map +0 -1
- package/lib/_chunks-es/util.is-equal-selection-points.js.map +0 -1
- package/src/editor/get-active-annotations.ts +0 -15
- package/src/editor/plugins/slate-plugin.update-mark-state.ts +0 -21
package/lib/index.d.cts
CHANGED
|
@@ -1215,10 +1215,10 @@ declare const editorMachine: StateMachine<
|
|
|
1215
1215
|
'edit mode':
|
|
1216
1216
|
| {
|
|
1217
1217
|
editable:
|
|
1218
|
-
| 'dragging internally'
|
|
1219
1218
|
| 'idle'
|
|
1219
|
+
| 'dragging internally'
|
|
1220
1220
|
| {
|
|
1221
|
-
focusing: '
|
|
1221
|
+
focusing: 'busy' | 'checking if busy'
|
|
1222
1222
|
}
|
|
1223
1223
|
}
|
|
1224
1224
|
| {
|
|
@@ -1228,11 +1228,11 @@ declare const editorMachine: StateMachine<
|
|
|
1228
1228
|
| 'setting up'
|
|
1229
1229
|
| {
|
|
1230
1230
|
'set up': {
|
|
1231
|
-
'value sync': '
|
|
1231
|
+
'value sync': 'idle' | 'syncing value'
|
|
1232
1232
|
'writing':
|
|
1233
1233
|
| 'dirty'
|
|
1234
1234
|
| {
|
|
1235
|
-
pristine: '
|
|
1235
|
+
pristine: 'idle' | 'normalizing'
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
@@ -1557,6 +1557,7 @@ declare const editorMachine: StateMachine<
|
|
|
1557
1557
|
| 'keyboard.keyup'
|
|
1558
1558
|
| 'mouse.click'
|
|
1559
1559
|
| '*'
|
|
1560
|
+
| `custom.${string}`
|
|
1560
1561
|
| 'deserialize.*'
|
|
1561
1562
|
| 'serialize.*'
|
|
1562
1563
|
| 'split.*'
|
|
@@ -1564,20 +1565,19 @@ declare const editorMachine: StateMachine<
|
|
|
1564
1565
|
| 'select.*'
|
|
1565
1566
|
| 'style.*'
|
|
1566
1567
|
| 'block.*'
|
|
1568
|
+
| 'history.*'
|
|
1569
|
+
| 'insert.*'
|
|
1567
1570
|
| 'annotation.*'
|
|
1568
1571
|
| 'decorator.*'
|
|
1569
1572
|
| 'child.*'
|
|
1570
1573
|
| 'deserialization.*'
|
|
1571
|
-
| 'insert.*'
|
|
1572
1574
|
| 'list item.*'
|
|
1573
1575
|
| 'move.*'
|
|
1574
1576
|
| 'serialization.*'
|
|
1575
|
-
| 'history.*'
|
|
1576
1577
|
| 'clipboard.*'
|
|
1577
1578
|
| 'drag.*'
|
|
1578
1579
|
| 'keyboard.*'
|
|
1579
|
-
| 'mouse.*'
|
|
1580
|
-
| `custom.${string}`,
|
|
1580
|
+
| 'mouse.*',
|
|
1581
1581
|
true,
|
|
1582
1582
|
| {
|
|
1583
1583
|
type: StrictExtract_2<
|
|
@@ -6156,15 +6156,12 @@ export declare type EditorSelector<TSelected> = (
|
|
|
6156
6156
|
*/
|
|
6157
6157
|
export declare type EditorSnapshot = {
|
|
6158
6158
|
context: EditorContext
|
|
6159
|
+
blockIndexMap: Map<string, number>
|
|
6159
6160
|
/**
|
|
6160
6161
|
* @beta
|
|
6161
|
-
*
|
|
6162
|
+
* Subject to change
|
|
6162
6163
|
*/
|
|
6163
|
-
|
|
6164
|
-
activeAnnotations: Array<string>
|
|
6165
|
-
activeDecorators: Array<string>
|
|
6166
|
-
}
|
|
6167
|
-
blockIndexMap: Map<string, number>
|
|
6164
|
+
decoratorState: Record<string, boolean | undefined>
|
|
6168
6165
|
}
|
|
6169
6166
|
|
|
6170
6167
|
/**
|
|
@@ -6417,11 +6414,6 @@ export declare type LoadingChange = {
|
|
|
6417
6414
|
isLoading: boolean
|
|
6418
6415
|
}
|
|
6419
6416
|
|
|
6420
|
-
declare type MarkState = {
|
|
6421
|
-
state: 'changed' | 'unchanged'
|
|
6422
|
-
marks: Array<string>
|
|
6423
|
-
}
|
|
6424
|
-
|
|
6425
6417
|
declare type MIMEType = `${string}/${string}`
|
|
6426
6418
|
|
|
6427
6419
|
declare type MouseBehaviorEvent = {
|
|
@@ -7178,7 +7170,6 @@ declare interface PortableTextSlateEditor extends ReactEditor {
|
|
|
7178
7170
|
value: Array<PortableTextBlock>
|
|
7179
7171
|
decoratedRanges: Array<DecoratedRange>
|
|
7180
7172
|
decoratorState: Record<string, boolean | undefined>
|
|
7181
|
-
markState: MarkState | undefined
|
|
7182
7173
|
blockIndexMap: Map<string, number>
|
|
7183
7174
|
listIndexMap: Map<string, number>
|
|
7184
7175
|
/**
|
package/lib/index.d.ts
CHANGED
|
@@ -1215,10 +1215,10 @@ declare const editorMachine: StateMachine<
|
|
|
1215
1215
|
'edit mode':
|
|
1216
1216
|
| {
|
|
1217
1217
|
editable:
|
|
1218
|
-
| 'dragging internally'
|
|
1219
1218
|
| 'idle'
|
|
1219
|
+
| 'dragging internally'
|
|
1220
1220
|
| {
|
|
1221
|
-
focusing: '
|
|
1221
|
+
focusing: 'busy' | 'checking if busy'
|
|
1222
1222
|
}
|
|
1223
1223
|
}
|
|
1224
1224
|
| {
|
|
@@ -1228,11 +1228,11 @@ declare const editorMachine: StateMachine<
|
|
|
1228
1228
|
| 'setting up'
|
|
1229
1229
|
| {
|
|
1230
1230
|
'set up': {
|
|
1231
|
-
'value sync': '
|
|
1231
|
+
'value sync': 'idle' | 'syncing value'
|
|
1232
1232
|
'writing':
|
|
1233
1233
|
| 'dirty'
|
|
1234
1234
|
| {
|
|
1235
|
-
pristine: '
|
|
1235
|
+
pristine: 'idle' | 'normalizing'
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
@@ -1557,6 +1557,7 @@ declare const editorMachine: StateMachine<
|
|
|
1557
1557
|
| 'keyboard.keyup'
|
|
1558
1558
|
| 'mouse.click'
|
|
1559
1559
|
| '*'
|
|
1560
|
+
| `custom.${string}`
|
|
1560
1561
|
| 'deserialize.*'
|
|
1561
1562
|
| 'serialize.*'
|
|
1562
1563
|
| 'split.*'
|
|
@@ -1564,20 +1565,19 @@ declare const editorMachine: StateMachine<
|
|
|
1564
1565
|
| 'select.*'
|
|
1565
1566
|
| 'style.*'
|
|
1566
1567
|
| 'block.*'
|
|
1568
|
+
| 'history.*'
|
|
1569
|
+
| 'insert.*'
|
|
1567
1570
|
| 'annotation.*'
|
|
1568
1571
|
| 'decorator.*'
|
|
1569
1572
|
| 'child.*'
|
|
1570
1573
|
| 'deserialization.*'
|
|
1571
|
-
| 'insert.*'
|
|
1572
1574
|
| 'list item.*'
|
|
1573
1575
|
| 'move.*'
|
|
1574
1576
|
| 'serialization.*'
|
|
1575
|
-
| 'history.*'
|
|
1576
1577
|
| 'clipboard.*'
|
|
1577
1578
|
| 'drag.*'
|
|
1578
1579
|
| 'keyboard.*'
|
|
1579
|
-
| 'mouse.*'
|
|
1580
|
-
| `custom.${string}`,
|
|
1580
|
+
| 'mouse.*',
|
|
1581
1581
|
true,
|
|
1582
1582
|
| {
|
|
1583
1583
|
type: StrictExtract_2<
|
|
@@ -6156,15 +6156,12 @@ export declare type EditorSelector<TSelected> = (
|
|
|
6156
6156
|
*/
|
|
6157
6157
|
export declare type EditorSnapshot = {
|
|
6158
6158
|
context: EditorContext
|
|
6159
|
+
blockIndexMap: Map<string, number>
|
|
6159
6160
|
/**
|
|
6160
6161
|
* @beta
|
|
6161
|
-
*
|
|
6162
|
+
* Subject to change
|
|
6162
6163
|
*/
|
|
6163
|
-
|
|
6164
|
-
activeAnnotations: Array<string>
|
|
6165
|
-
activeDecorators: Array<string>
|
|
6166
|
-
}
|
|
6167
|
-
blockIndexMap: Map<string, number>
|
|
6164
|
+
decoratorState: Record<string, boolean | undefined>
|
|
6168
6165
|
}
|
|
6169
6166
|
|
|
6170
6167
|
/**
|
|
@@ -6417,11 +6414,6 @@ export declare type LoadingChange = {
|
|
|
6417
6414
|
isLoading: boolean
|
|
6418
6415
|
}
|
|
6419
6416
|
|
|
6420
|
-
declare type MarkState = {
|
|
6421
|
-
state: 'changed' | 'unchanged'
|
|
6422
|
-
marks: Array<string>
|
|
6423
|
-
}
|
|
6424
|
-
|
|
6425
6417
|
declare type MIMEType = `${string}/${string}`
|
|
6426
6418
|
|
|
6427
6419
|
declare type MouseBehaviorEvent = {
|
|
@@ -7178,7 +7170,6 @@ declare interface PortableTextSlateEditor extends ReactEditor {
|
|
|
7178
7170
|
value: Array<PortableTextBlock>
|
|
7179
7171
|
decoratedRanges: Array<DecoratedRange>
|
|
7180
7172
|
decoratorState: Record<string, boolean | undefined>
|
|
7181
|
-
markState: MarkState | undefined
|
|
7182
7173
|
blockIndexMap: Map<string, number>
|
|
7183
7174
|
listIndexMap: Map<string, number>
|
|
7184
7175
|
/**
|