@portabletext/editor 2.6.3 → 2.6.5
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-selecting-entire-blocks.cjs +29 -29
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-selection-expanded.cjs +5 -5
- package/lib/_chunks-cjs/selector.is-selection-expanded.cjs.map +1 -1
- package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs +3 -3
- package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs.map +1 -1
- package/lib/_chunks-cjs/util.is-selection-collapsed.cjs +5 -5
- package/lib/_chunks-cjs/util.is-selection-collapsed.cjs.map +1 -1
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs +2 -6
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/util.slice-blocks.cjs +106 -117
- package/lib/_chunks-cjs/util.slice-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/util.slice-text-block.cjs +3 -3
- package/lib/_chunks-cjs/util.slice-text-block.cjs.map +1 -1
- package/lib/_chunks-dts/behavior.types.action.d.ts +115 -115
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +3 -2
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
- package/lib/_chunks-es/selector.is-selection-expanded.js +3 -2
- package/lib/_chunks-es/selector.is-selection-expanded.js.map +1 -1
- package/lib/_chunks-es/util.child-selection-point-to-block-offset.js +2 -1
- package/lib/_chunks-es/util.child-selection-point-to-block-offset.js.map +1 -1
- package/lib/_chunks-es/util.is-selection-collapsed.js +2 -1
- package/lib/_chunks-es/util.is-selection-collapsed.js.map +1 -1
- package/lib/_chunks-es/util.merge-text-blocks.js +2 -5
- package/lib/_chunks-es/util.merge-text-blocks.js.map +1 -1
- package/lib/_chunks-es/util.slice-blocks.js +101 -112
- package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
- package/lib/_chunks-es/util.slice-text-block.js +2 -1
- package/lib/_chunks-es/util.slice-text-block.js.map +1 -1
- package/lib/index.cjs +133 -96
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +43 -6
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +5 -5
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +3 -3
- package/lib/plugins/index.d.ts +3 -3
- package/lib/plugins/index.js +6 -5
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.cjs +3 -3
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.js +2 -1
- package/lib/selectors/index.js.map +1 -1
- package/lib/utils/index.cjs +14 -4
- package/lib/utils/index.cjs.map +1 -1
- package/lib/utils/index.d.cts +2 -9
- package/lib/utils/index.d.ts +4 -11
- package/lib/utils/index.js +4 -3
- package/lib/utils/index.js.map +1 -1
- package/package.json +14 -13
- package/src/behaviors/behavior.abstract.delete.ts +1 -1
- package/src/behaviors/behavior.abstract.deserialize.ts +1 -1
- package/src/behaviors/behavior.abstract.split.ts +2 -1
- package/src/behaviors/behavior.core.block-objects.ts +1 -1
- package/src/behaviors/behavior.core.lists.ts +2 -1
- package/src/behaviors/behavior.markdown.ts +1 -1
- package/src/converters/converter.text-plain.ts +2 -1
- package/src/editor/__tests__/PortableTextEditor.test.tsx +1 -1
- package/src/editor/__tests__/RangeDecorations.test.tsx +1 -1
- package/src/editor/__tests__/self-solving.test.tsx +1 -1
- package/src/editor/components/render-element.tsx +1 -1
- package/src/editor/plugins/__tests__/withEditableAPIDelete.test.tsx +1 -1
- package/src/editor/plugins/__tests__/withEditableAPIGetFragment.test.tsx +2 -3
- package/src/editor/plugins/__tests__/withEditableAPIInsert.test.tsx +1 -1
- package/src/editor/plugins/__tests__/withEditableAPISelectionsOverlapping.test.tsx +1 -1
- package/src/editor/plugins/__tests__/withPortableTextLists.test.tsx +1 -1
- package/src/editor/plugins/__tests__/withPortableTextMarkModel.test.tsx +1 -1
- package/src/editor/plugins/__tests__/withPortableTextSelections.test.tsx +1 -1
- package/src/editor/plugins/__tests__/withUndoRedo.test.tsx +1 -1
- package/src/editor/plugins/createWithObjectKeys.ts +1 -1
- package/src/editor/plugins/createWithPortableTextMarkModel.ts +1 -1
- package/src/editor/plugins/createWithSchemaTypes.ts +2 -5
- package/src/internal-utils/__tests__/valueNormalization.test.tsx +1 -1
- package/src/internal-utils/apply-operation-to-portable-text.test.ts +1 -1
- package/src/internal-utils/build-index-maps.ts +1 -1
- package/src/internal-utils/create-test-snapshot.ts +1 -1
- package/src/internal-utils/drag-selection.test.ts +1 -1
- package/src/internal-utils/editor-selection.ts +1 -1
- package/src/internal-utils/operation-to-patches.ts +1 -1
- package/src/internal-utils/parse-blocks.test.ts +1 -1
- package/src/internal-utils/parse-blocks.ts +1 -38
- package/src/internal-utils/selection-focus-text.ts +1 -1
- package/src/internal-utils/selection-text.ts +1 -1
- package/src/internal-utils/test-editor.tsx +1 -1
- package/src/internal-utils/text-block-key.ts +1 -1
- package/src/internal-utils/text-marks.ts +1 -1
- package/src/internal-utils/text-selection.ts +1 -1
- package/src/internal-utils/to-slate-range.test.ts +1 -1
- package/src/internal-utils/to-slate-range.ts +1 -1
- package/src/internal-utils/validateValue.ts +1 -1
- package/src/internal-utils/value-annotations.ts +1 -1
- package/src/operations/behavior.operation.block.unset.ts +2 -1
- package/src/operations/behavior.operation.delete.ts +98 -2
- package/src/operations/behavior.operation.insert.block.ts +2 -1
- package/src/operations/behavior.operation.select.ts +5 -0
- package/src/plugins/plugin.behavior.tsx +3 -1
- package/src/plugins/plugin.internal.auto-close-brackets.test.tsx +1 -2
- package/src/plugins/plugin.markdown.test.tsx +1 -2
- package/src/selectors/selector.get-active-annotations.ts +1 -1
- package/src/selectors/selector.get-active-list-item.ts +1 -1
- package/src/selectors/selector.get-active-style.ts +1 -1
- package/src/selectors/selector.get-anchor-text-block.ts +1 -1
- package/src/selectors/selector.get-caret-word-selection.test.ts +1 -1
- package/src/selectors/selector.get-focus-block-object.ts +1 -1
- package/src/selectors/selector.get-focus-span.ts +1 -1
- package/src/selectors/selector.get-focus-text-block.ts +1 -1
- package/src/selectors/selector.get-list-state.ts +1 -1
- package/src/selectors/selector.get-next-span.ts +1 -1
- package/src/selectors/selector.get-previous-span.ts +1 -1
- package/src/selectors/selector.get-selected-spans.ts +1 -1
- package/src/selectors/selector.get-selected-text-blocks.ts +1 -1
- package/src/selectors/selector.get-selection-text.ts +1 -1
- package/src/selectors/selector.get-trimmed-selection.test.ts +1 -1
- package/src/selectors/selector.get-trimmed-selection.ts +1 -1
- package/src/selectors/selector.is-active-annotation.ts +1 -1
- package/src/selectors/selector.is-point-after-selection.ts +1 -1
- package/src/selectors/selector.is-point-before-selection.ts +1 -1
- package/src/utils/index.ts +1 -2
- package/src/utils/util.at-the-beginning-of-block.ts +1 -1
- package/src/utils/util.block-offset.ts +1 -1
- package/src/utils/util.child-selection-point-to-block-offset.ts +1 -1
- package/src/utils/util.get-block-end-point.ts +1 -1
- package/src/utils/util.get-block-start-point.ts +1 -1
- package/src/utils/util.is-empty-text-block.ts +1 -1
- package/src/utils/util.merge-text-blocks.ts +1 -1
- package/src/utils/util.slice-blocks.ts +2 -2
- package/src/utils/util.slice-text-block.ts +2 -2
- package/src/utils/util.split-text-block.ts +1 -1
- package/src/internal-utils/terse-pt.test.ts +0 -175
- package/src/internal-utils/terse-pt.ts +0 -150
- package/src/internal-utils/test-key-generator.ts +0 -9
- package/src/utils/util.is-span.ts +0 -12
- package/src/utils/util.is-text-block.ts +0 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var util_sliceBlocks = require("./util.slice-blocks.cjs"), util_isSelectionCollapsed = require("./util.is-selection-collapsed.cjs"), selector_isSelectionExpanded = require("./selector.is-selection-expanded.cjs"), types = require("@sanity/types");
|
|
2
|
+
var schema = require("@portabletext/schema"), util_sliceBlocks = require("./util.slice-blocks.cjs"), util_isSelectionCollapsed = require("./util.is-selection-collapsed.cjs"), selector_isSelectionExpanded = require("./selector.is-selection-expanded.cjs"), types = require("@sanity/types");
|
|
3
3
|
function isSelectionExpanded(selection) {
|
|
4
4
|
return selection ? !util_isSelectionCollapsed.isSelectionCollapsed(selection) : !1;
|
|
5
5
|
}
|
|
@@ -21,7 +21,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
21
21
|
return snapshot.context.selection.backward ? snapshot.context.selection.anchor : snapshot.context.selection.focus;
|
|
22
22
|
}, getNextSpan = (snapshot) => {
|
|
23
23
|
const selectionEndBlock = getSelectionEndBlock(snapshot), selectionEndPoint = getSelectionEndPoint(snapshot);
|
|
24
|
-
if (!selectionEndBlock || !selectionEndPoint || !
|
|
24
|
+
if (!selectionEndBlock || !selectionEndPoint || !schema.isTextBlock(snapshot.context, selectionEndBlock.node))
|
|
25
25
|
return;
|
|
26
26
|
const selectionEndPointChildKey = util_sliceBlocks.getChildKeyFromSelectionPoint(selectionEndPoint);
|
|
27
27
|
let endPointChildFound = !1, nextSpan;
|
|
@@ -30,7 +30,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
30
30
|
endPointChildFound = !0;
|
|
31
31
|
continue;
|
|
32
32
|
}
|
|
33
|
-
if (
|
|
33
|
+
if (schema.isSpan(snapshot.context, child) && endPointChildFound) {
|
|
34
34
|
nextSpan = {
|
|
35
35
|
node: child,
|
|
36
36
|
path: [...selectionEndBlock.path, "children", {
|
|
@@ -56,14 +56,14 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
56
56
|
});
|
|
57
57
|
}, getPreviousSpan = (snapshot) => {
|
|
58
58
|
const selectionStartBlock = getSelectionStartBlock(snapshot), selectionStartPoint = selector_isSelectionExpanded.getSelectionStartPoint(snapshot);
|
|
59
|
-
if (!selectionStartBlock || !selectionStartPoint || !
|
|
59
|
+
if (!selectionStartBlock || !selectionStartPoint || !schema.isTextBlock(snapshot.context, selectionStartBlock.node))
|
|
60
60
|
return;
|
|
61
61
|
const selectionStartPointChildKey = util_sliceBlocks.getChildKeyFromSelectionPoint(selectionStartPoint);
|
|
62
62
|
let previousSpan;
|
|
63
63
|
for (const child of selectionStartBlock.node.children) {
|
|
64
64
|
if (child._key === selectionStartPointChildKey)
|
|
65
65
|
break;
|
|
66
|
-
|
|
66
|
+
schema.isSpan(snapshot.context, child) && (previousSpan = {
|
|
67
67
|
node: child,
|
|
68
68
|
path: [...selectionStartBlock.path, "children", {
|
|
69
69
|
_key: child._key
|
|
@@ -86,10 +86,10 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
86
86
|
const slicedValue = snapshot.context.value.slice(startBlockIndex, endBlockIndex + 1);
|
|
87
87
|
let startBlockFound = !1;
|
|
88
88
|
for (const block of slicedValue)
|
|
89
|
-
if (block._key === startBlockKey && (startBlockFound = !0), !!
|
|
89
|
+
if (block._key === startBlockKey && (startBlockFound = !0), !!schema.isTextBlock(snapshot.context, block)) {
|
|
90
90
|
if (block._key === startBlockKey) {
|
|
91
91
|
for (const child of block.children)
|
|
92
|
-
if (
|
|
92
|
+
if (schema.isSpan(snapshot.context, child)) {
|
|
93
93
|
if (startSpanKey && child._key === startSpanKey) {
|
|
94
94
|
if (startPoint.offset < child.text.length && selectedSpans.push({
|
|
95
95
|
node: child,
|
|
@@ -128,7 +128,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
128
128
|
}
|
|
129
129
|
if (block._key === endBlockKey) {
|
|
130
130
|
for (const child of block.children)
|
|
131
|
-
if (
|
|
131
|
+
if (schema.isSpan(snapshot.context, child)) {
|
|
132
132
|
if (endSpanKey && child._key === endSpanKey) {
|
|
133
133
|
endPoint.offset > 0 && selectedSpans.push({
|
|
134
134
|
node: child,
|
|
@@ -153,7 +153,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
153
153
|
}
|
|
154
154
|
if (startBlockFound)
|
|
155
155
|
for (const child of block.children)
|
|
156
|
-
|
|
156
|
+
schema.isSpan(snapshot.context, child) && selectedSpans.push({
|
|
157
157
|
node: child,
|
|
158
158
|
path: [{
|
|
159
159
|
_key: block._key
|
|
@@ -278,11 +278,11 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
278
278
|
if (!snapshot.context.selection)
|
|
279
279
|
return [];
|
|
280
280
|
const selectedBlocks = getSelectedBlocks(snapshot), activeAnnotations = (getMarkState(snapshot)?.marks ?? []).filter((mark) => !snapshot.context.schema.decorators.map((decorator) => decorator.name).includes(mark));
|
|
281
|
-
return selectedBlocks.flatMap((block) =>
|
|
281
|
+
return selectedBlocks.flatMap((block) => schema.isTextBlock(snapshot.context, block.node) ? block.node.markDefs ?? [] : []).filter((markDef) => activeAnnotations.includes(markDef._key));
|
|
282
282
|
}, getActiveListItem = (snapshot) => {
|
|
283
283
|
if (!snapshot.context.selection)
|
|
284
284
|
return;
|
|
285
|
-
const selectedTextBlocks = getSelectedBlocks(snapshot).map((block) => block.node).filter((block) =>
|
|
285
|
+
const selectedTextBlocks = getSelectedBlocks(snapshot).map((block) => block.node).filter((block) => schema.isTextBlock(snapshot.context, block)), firstTextBlock = selectedTextBlocks.at(0);
|
|
286
286
|
if (!firstTextBlock)
|
|
287
287
|
return;
|
|
288
288
|
const firstListItem = firstTextBlock.listItem;
|
|
@@ -291,7 +291,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
291
291
|
}, getActiveStyle = (snapshot) => {
|
|
292
292
|
if (!snapshot.context.selection)
|
|
293
293
|
return;
|
|
294
|
-
const selectedTextBlocks = getSelectedBlocks(snapshot).map((block) => block.node).filter((block) =>
|
|
294
|
+
const selectedTextBlocks = getSelectedBlocks(snapshot).map((block) => block.node).filter((block) => schema.isTextBlock(snapshot.context, block)), firstTextBlock = selectedTextBlocks.at(0);
|
|
295
295
|
if (!firstTextBlock)
|
|
296
296
|
return;
|
|
297
297
|
const firstStyle = firstTextBlock.style;
|
|
@@ -307,7 +307,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
307
307
|
endPointChildFound = !0;
|
|
308
308
|
continue;
|
|
309
309
|
}
|
|
310
|
-
if (!
|
|
310
|
+
if (!schema.isSpan(snapshot.context, child) && endPointChildFound) {
|
|
311
311
|
inlineObject = {
|
|
312
312
|
node: child,
|
|
313
313
|
path: [...focusTextBlock.path, "children", {
|
|
@@ -397,7 +397,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
397
397
|
} : void 0;
|
|
398
398
|
}, getFocusBlockObject = (snapshot) => {
|
|
399
399
|
const focusBlock = selector_isSelectionExpanded.getFocusBlock(snapshot);
|
|
400
|
-
return focusBlock && !
|
|
400
|
+
return focusBlock && !schema.isTextBlock(snapshot.context, focusBlock.node) ? {
|
|
401
401
|
node: focusBlock.node,
|
|
402
402
|
path: focusBlock.path
|
|
403
403
|
} : void 0;
|
|
@@ -461,7 +461,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
461
461
|
const slicedValue = snapshot.context.value.slice(startBlockIndex, endBlockIndex + 1);
|
|
462
462
|
for (const block of slicedValue) {
|
|
463
463
|
if (block._key === startBlockKey) {
|
|
464
|
-
if (
|
|
464
|
+
if (schema.isTextBlock(snapshot.context, block) && selectedTextBlocks.push({
|
|
465
465
|
node: block,
|
|
466
466
|
path: [{
|
|
467
467
|
_key: block._key
|
|
@@ -471,7 +471,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
471
471
|
continue;
|
|
472
472
|
}
|
|
473
473
|
if (block._key === endBlockKey) {
|
|
474
|
-
|
|
474
|
+
schema.isTextBlock(snapshot.context, block) && selectedTextBlocks.push({
|
|
475
475
|
node: block,
|
|
476
476
|
path: [{
|
|
477
477
|
_key: block._key
|
|
@@ -479,7 +479,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
479
479
|
});
|
|
480
480
|
break;
|
|
481
481
|
}
|
|
482
|
-
selectedTextBlocks.length > 0 &&
|
|
482
|
+
selectedTextBlocks.length > 0 && schema.isTextBlock(snapshot.context, block) && selectedTextBlocks.push({
|
|
483
483
|
node: block,
|
|
484
484
|
path: [{
|
|
485
485
|
_key: block._key
|
|
@@ -499,11 +499,11 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
499
499
|
const slicedValue = snapshot.context.value.slice(startBlockIndex, endBlockIndex + 1);
|
|
500
500
|
let startBlockFound = !1, adjustedStartPoint, trimStartPoint = !1, adjustedEndPoint, trimEndPoint = !1, previousPotentialEndpoint;
|
|
501
501
|
for (const block of slicedValue)
|
|
502
|
-
if (!(block._key === startBlockKey && (startBlockFound = !0,
|
|
502
|
+
if (!(block._key === startBlockKey && (startBlockFound = !0, schema.isTextBlock(snapshot.context, block) && util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, block))) && startBlockFound && schema.isTextBlock(snapshot.context, block)) {
|
|
503
503
|
if (block._key === endBlockKey && util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, block))
|
|
504
504
|
break;
|
|
505
505
|
for (const child of block.children) {
|
|
506
|
-
if (child._key === endChildKey && (!
|
|
506
|
+
if (child._key === endChildKey && (!schema.isSpan(snapshot.context, child) || endPoint.offset === 0)) {
|
|
507
507
|
adjustedEndPoint = previousPotentialEndpoint ? {
|
|
508
508
|
path: [{
|
|
509
509
|
_key: previousPotentialEndpoint.blockKey
|
|
@@ -515,8 +515,8 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
515
515
|
break;
|
|
516
516
|
}
|
|
517
517
|
if (trimStartPoint) {
|
|
518
|
-
const lonelySpan =
|
|
519
|
-
(
|
|
518
|
+
const lonelySpan = schema.isSpan(snapshot.context, child) && block.children.length === 1;
|
|
519
|
+
(schema.isSpan(snapshot.context, child) && child.text.length > 0 || lonelySpan) && (adjustedStartPoint = {
|
|
520
520
|
path: [{
|
|
521
521
|
_key: block._key
|
|
522
522
|
}, "children", {
|
|
@@ -530,7 +530,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
530
530
|
continue;
|
|
531
531
|
}
|
|
532
532
|
if (child._key === startChildKey) {
|
|
533
|
-
if (!
|
|
533
|
+
if (!schema.isSpan(snapshot.context, child)) {
|
|
534
534
|
trimStartPoint = !0;
|
|
535
535
|
continue;
|
|
536
536
|
}
|
|
@@ -542,7 +542,7 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
542
542
|
continue;
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
|
-
previousPotentialEndpoint =
|
|
545
|
+
previousPotentialEndpoint = schema.isSpan(snapshot.context, child) && child.text.length > 0 ? {
|
|
546
546
|
blockKey: block._key,
|
|
547
547
|
span: child
|
|
548
548
|
} : previousPotentialEndpoint;
|
|
@@ -577,17 +577,17 @@ const getSelectionEndBlock = (snapshot) => {
|
|
|
577
577
|
return trimmedSelection;
|
|
578
578
|
};
|
|
579
579
|
function getActiveAnnotationsMarks(snapshot) {
|
|
580
|
-
const
|
|
581
|
-
return (getMarkState(snapshot)?.marks ?? []).filter((mark) => !
|
|
580
|
+
const schema2 = snapshot.context.schema;
|
|
581
|
+
return (getMarkState(snapshot)?.marks ?? []).filter((mark) => !schema2.decorators.map((decorator) => decorator.name).includes(mark));
|
|
582
582
|
}
|
|
583
583
|
function isActiveAnnotation(annotation) {
|
|
584
584
|
return (snapshot) => {
|
|
585
|
-
const selectionMarkDefs = getSelectedBlocks(snapshot).flatMap((block) =>
|
|
585
|
+
const selectionMarkDefs = getSelectedBlocks(snapshot).flatMap((block) => schema.isTextBlock(snapshot.context, block.node) ? block.node.markDefs ?? [] : []), activeAnnotations = getActiveAnnotationsMarks(snapshot);
|
|
586
586
|
return selectionMarkDefs.filter((markDef) => markDef._type === annotation && activeAnnotations.includes(markDef._key)).length > 0;
|
|
587
587
|
};
|
|
588
588
|
}
|
|
589
589
|
function getActiveDecorators(snapshot) {
|
|
590
|
-
const
|
|
590
|
+
const schema2 = snapshot.context.schema, decoratorState = snapshot.decoratorState, markState = getMarkState(snapshot), decorators = schema2.decorators.map((decorator) => decorator.name);
|
|
591
591
|
let activeDecorators = (markState?.marks ?? []).filter((mark) => decorators.includes(mark));
|
|
592
592
|
for (const decorator in decoratorState)
|
|
593
593
|
decoratorState[decorator] === !1 ? activeDecorators = activeDecorators.filter((activeDecorator) => activeDecorator !== decorator) : decoratorState[decorator] === !0 && (activeDecorators.includes(decorator) || activeDecorators.push(decorator));
|
|
@@ -645,7 +645,7 @@ function isPointAfterSelection(point) {
|
|
|
645
645
|
if (pointBlockIndex < endBlockIndex)
|
|
646
646
|
return !1;
|
|
647
647
|
const pointBlock = snapshot.context.value.at(pointBlockIndex);
|
|
648
|
-
if (!pointBlock || !
|
|
648
|
+
if (!pointBlock || !schema.isTextBlock(snapshot.context, pointBlock))
|
|
649
649
|
return !1;
|
|
650
650
|
let pointChildIndex, endChildIndex, childIndex = -1;
|
|
651
651
|
for (const child of pointBlock.children) {
|
|
@@ -672,7 +672,7 @@ function isPointBeforeSelection(point) {
|
|
|
672
672
|
if (pointBlockIndex > startBlockIndex)
|
|
673
673
|
return !1;
|
|
674
674
|
const pointBlock = snapshot.context.value.at(pointBlockIndex);
|
|
675
|
-
if (!pointBlock || !
|
|
675
|
+
if (!pointBlock || !schema.isTextBlock(snapshot.context, pointBlock))
|
|
676
676
|
return !1;
|
|
677
677
|
let pointChildIndex, startChildIndex, childIndex = -1;
|
|
678
678
|
for (const child of pointBlock.children) {
|