Skip to content

Commit 5323169

Browse files
committed
quickfixes
1 parent 011985b commit 5323169

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/core/src/api/getBlockInfoFromPos.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export function getBlockInfoWithManualOffset(
158158
let foundBlockContent = false;
159159

160160
bnBlockNode.forEach((node, offset) => {
161-
if (node.type.spec.group === "blockContent") {
161+
if (node.type.isInGroup("blockContent")) {
162162
// console.log(beforePos, offset);
163163
const blockContentNode = node;
164164
const blockContentBeforePos = bnBlockBeforePos + offset + 1;
@@ -170,7 +170,7 @@ export function getBlockInfoWithManualOffset(
170170
afterPos: blockContentAfterPos,
171171
};
172172
foundBlockContent = true;
173-
} else if (node.type.name === "blockGroup") {
173+
} else if (node.type.isInGroup("blockGroupChild")) {
174174
const blockGroupNode = node;
175175
const blockGroupBeforePos = bnBlockBeforePos + offset + 1;
176176
const blockGroupAfterPos = blockGroupBeforePos + node.nodeSize;
@@ -180,7 +180,7 @@ export function getBlockInfoWithManualOffset(
180180
beforePos: blockGroupBeforePos,
181181
afterPos: blockGroupAfterPos,
182182
};
183-
} else if (node.type.spec.group === "suggestionBlockContent") {
183+
} else if (node.type.isInGroup("suggestionBlockContent")) {
184184
const suggestionNode = node;
185185
const suggestionBeforePos = bnBlockBeforePos + offset + 1;
186186
const suggestionAfterPos = suggestionBeforePos + node.nodeSize;
@@ -199,6 +199,9 @@ export function getBlockInfoWithManualOffset(
199199
}
200200
});
201201

202+
if (!blockContent) {
203+
blockContent = suggestionBefore || suggestionAfter;
204+
}
202205
if (!blockContent) {
203206
throw new Error(
204207
`blockContainer node does not contain a blockContent node in its children: ${bnBlockNode}`,
@@ -210,7 +213,7 @@ export function getBlockInfoWithManualOffset(
210213
bnBlock,
211214
blockContent,
212215
childContainer: blockGroup,
213-
blockNoteType: blockContent.node.type.name,
216+
blockNoteType: blockContent.node.type.name.replace("--attributed", ""),
214217
suggestionBefore,
215218
suggestionAfter,
216219
};

0 commit comments

Comments
 (0)