@portabletext/editor 7.10.14 → 7.10.16
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 +10 -0
- package/lib/_chunks-dts/behavior.types.action.d.ts.map +1 -1
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js +2 -2
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js.map +1 -1
- package/lib/index.js +10 -13
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2487,7 +2487,7 @@ function getTextDecorations(node, decorations) {
|
|
|
2487
2487
|
}
|
|
2488
2488
|
function isEqualValues(context, a, b) {
|
|
2489
2489
|
if (!a || !b)
|
|
2490
|
-
return a === b;
|
|
2490
|
+
return (a?.length ?? 0) === (b?.length ?? 0);
|
|
2491
2491
|
if (a.length !== b.length)
|
|
2492
2492
|
return !1;
|
|
2493
2493
|
for (let index = 0; index < a.length; index++) {
|
|
@@ -8978,9 +8978,6 @@ function createSpanNode(context) {
|
|
|
8978
8978
|
marks: []
|
|
8979
8979
|
};
|
|
8980
8980
|
}
|
|
8981
|
-
function isCosmeticNormalizationSkipped(editor) {
|
|
8982
|
-
return editor.isProcessingRemoteChanges;
|
|
8983
|
-
}
|
|
8984
8981
|
const normalizeNode = (editor, entry) => {
|
|
8985
8982
|
const [node, path2] = entry, nodeRecord = node;
|
|
8986
8983
|
if (isEditor(node) && node.snapshot.context.value.length === 0) {
|
|
@@ -8989,7 +8986,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
8989
8986
|
});
|
|
8990
8987
|
return;
|
|
8991
8988
|
}
|
|
8992
|
-
if (!
|
|
8989
|
+
if (!editor.isProcessingRemoteChanges && isTextBlock({
|
|
8993
8990
|
schema: editor.snapshot.context.schema
|
|
8994
8991
|
}, node)) {
|
|
8995
8992
|
const children = getChildren(editor.snapshot, path2);
|
|
@@ -9104,7 +9101,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
9104
9101
|
}
|
|
9105
9102
|
}
|
|
9106
9103
|
}
|
|
9107
|
-
if (isTextBlockNode({
|
|
9104
|
+
if (!editor.isProcessingRemoteChanges && isTextBlockNode({
|
|
9108
9105
|
schema: editor.snapshot.context.schema
|
|
9109
9106
|
}, node) && !Array.isArray(node.markDefs)) {
|
|
9110
9107
|
debug.normalization("adding .markDefs to block node"), setNodeProperties(editor, {
|
|
@@ -9112,7 +9109,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
9112
9109
|
}, path2);
|
|
9113
9110
|
return;
|
|
9114
9111
|
}
|
|
9115
|
-
if (isTextBlockNode({
|
|
9112
|
+
if (!editor.isProcessingRemoteChanges && isTextBlockNode({
|
|
9116
9113
|
schema: editor.snapshot.context.schema
|
|
9117
9114
|
}, node) && typeof node.style > "u") {
|
|
9118
9115
|
const defaultStyle = getPathSubSchema(editor.snapshot, path2).styles.at(0)?.name;
|
|
@@ -9135,7 +9132,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
9135
9132
|
});
|
|
9136
9133
|
return;
|
|
9137
9134
|
}
|
|
9138
|
-
if (isSpan({
|
|
9135
|
+
if (!editor.isProcessingRemoteChanges && isSpan({
|
|
9139
9136
|
schema: editor.snapshot.context.schema
|
|
9140
9137
|
}, node) && !Array.isArray(node.marks)) {
|
|
9141
9138
|
debug.normalization("Adding .marks to span node"), setNodeProperties(editor, {
|
|
@@ -9143,7 +9140,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
9143
9140
|
}, path2);
|
|
9144
9141
|
return;
|
|
9145
9142
|
}
|
|
9146
|
-
if (isSpan({
|
|
9143
|
+
if (!editor.isProcessingRemoteChanges && isSpan({
|
|
9147
9144
|
schema: editor.snapshot.context.schema
|
|
9148
9145
|
}, node)) {
|
|
9149
9146
|
const blockPath = parentPath(path2), blockEntry = getTextBlock(editor.snapshot, blockPath);
|
|
@@ -9157,7 +9154,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
9157
9154
|
return;
|
|
9158
9155
|
}
|
|
9159
9156
|
}
|
|
9160
|
-
if (isTextBlock({
|
|
9157
|
+
if (!editor.isProcessingRemoteChanges && isTextBlock({
|
|
9161
9158
|
schema: editor.snapshot.context.schema
|
|
9162
9159
|
}, node)) {
|
|
9163
9160
|
const markDefs = node.markDefs ?? [], markDefKeys = /* @__PURE__ */ new Set(), newMarkDefs = [];
|
|
@@ -9170,7 +9167,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
9170
9167
|
return;
|
|
9171
9168
|
}
|
|
9172
9169
|
}
|
|
9173
|
-
if (isTextBlock({
|
|
9170
|
+
if (!editor.isProcessingRemoteChanges && isTextBlock({
|
|
9174
9171
|
schema: editor.snapshot.context.schema
|
|
9175
9172
|
}, node)) {
|
|
9176
9173
|
const newMarkDefs = (node.markDefs || []).filter((def) => node.children.find((child) => isSpan({
|
|
@@ -9305,9 +9302,9 @@ const normalizeNode = (editor, entry) => {
|
|
|
9305
9302
|
}, child)) {
|
|
9306
9303
|
if (prev != null && isSpan({
|
|
9307
9304
|
schema: editor.snapshot.context.schema
|
|
9308
|
-
}, prev) && // Only this merge/empty-drop arm
|
|
9305
|
+
}, prev) && // Only this merge/empty-drop arm defers; the inline-object
|
|
9309
9306
|
// bracketing below is a repair and keeps running.
|
|
9310
|
-
!
|
|
9307
|
+
!editor.isProcessingRemoteChanges) {
|
|
9311
9308
|
if (child.text === "") {
|
|
9312
9309
|
editor.apply({
|
|
9313
9310
|
type: "unset",
|