@supernova-studio/client 0.47.36 → 0.47.38
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/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/yjs/docs-editor/prosemirror-to-blocks.ts +21 -3
package/dist/index.js
CHANGED
|
@@ -9220,9 +9220,13 @@ function parseAsCustomBlock(prosemirrorNode, definition) {
|
|
|
9220
9220
|
return null;
|
|
9221
9221
|
const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
|
|
9222
9222
|
const appearance = parseAppearance(prosemirrorNode);
|
|
9223
|
-
const parsedItems = parseBlockItems(prosemirrorNode, definition);
|
|
9224
|
-
if (!parsedItems)
|
|
9225
|
-
|
|
9223
|
+
const parsedItems = _nullishCoalesce(parseBlockItems(prosemirrorNode, definition), () => ( []));
|
|
9224
|
+
if (!parsedItems.length && definitionExpectsPlaceholderItem(definition)) {
|
|
9225
|
+
parsedItems.push({
|
|
9226
|
+
id,
|
|
9227
|
+
props: {}
|
|
9228
|
+
});
|
|
9229
|
+
}
|
|
9226
9230
|
return {
|
|
9227
9231
|
id,
|
|
9228
9232
|
type: "Block",
|
|
@@ -9235,6 +9239,13 @@ function parseAsCustomBlock(prosemirrorNode, definition) {
|
|
|
9235
9239
|
}
|
|
9236
9240
|
};
|
|
9237
9241
|
}
|
|
9242
|
+
function definitionExpectsPlaceholderItem(definition) {
|
|
9243
|
+
return (
|
|
9244
|
+
// Block needs an item when it's a data block (tokens, components, etc)
|
|
9245
|
+
!definition.behavior.items || // Block needs an item when number of items is expected to be 1
|
|
9246
|
+
definition.behavior.items.numberOfItems === 1
|
|
9247
|
+
);
|
|
9248
|
+
}
|
|
9238
9249
|
function parseBlockItems(prosemirrorNode, definition) {
|
|
9239
9250
|
const itemsString = getProsemirrorAttribute(prosemirrorNode, "items", _zod.z.string());
|
|
9240
9251
|
if (!itemsString)
|