@supernova-studio/client 0.47.37 → 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 +9 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/yjs/docs-editor/prosemirror-to-blocks.ts +13 -1
package/dist/index.js
CHANGED
|
@@ -9221,7 +9221,7 @@ function parseAsCustomBlock(prosemirrorNode, definition) {
|
|
|
9221
9221
|
const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
|
|
9222
9222
|
const appearance = parseAppearance(prosemirrorNode);
|
|
9223
9223
|
const parsedItems = _nullishCoalesce(parseBlockItems(prosemirrorNode, definition), () => ( []));
|
|
9224
|
-
if (!parsedItems.length &&
|
|
9224
|
+
if (!parsedItems.length && definitionExpectsPlaceholderItem(definition)) {
|
|
9225
9225
|
parsedItems.push({
|
|
9226
9226
|
id,
|
|
9227
9227
|
props: {}
|
|
@@ -9239,6 +9239,13 @@ function parseAsCustomBlock(prosemirrorNode, definition) {
|
|
|
9239
9239
|
}
|
|
9240
9240
|
};
|
|
9241
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
|
+
}
|
|
9242
9249
|
function parseBlockItems(prosemirrorNode, definition) {
|
|
9243
9250
|
const itemsString = getProsemirrorAttribute(prosemirrorNode, "items", _zod.z.string());
|
|
9244
9251
|
if (!itemsString)
|
|
@@ -9365,7 +9372,7 @@ function getProsemirrorBlockVariantId(prosemirrorNode) {
|
|
|
9365
9372
|
return getProsemirrorAttribute(prosemirrorNode, "variantId", nullishToOptional(_zod.z.string()));
|
|
9366
9373
|
}
|
|
9367
9374
|
function getProsemirrorAttribute(prosemirrorNode, attributeName, validationSchema) {
|
|
9368
|
-
const parsedAttr = validationSchema.safeParse(_optionalChain([prosemirrorNode, 'access',
|
|
9375
|
+
const parsedAttr = validationSchema.safeParse(_optionalChain([prosemirrorNode, 'access', _76 => _76.attrs, 'optionalAccess', _77 => _77[attributeName]]));
|
|
9369
9376
|
if (parsedAttr.success) {
|
|
9370
9377
|
return parsedAttr.data;
|
|
9371
9378
|
} else {
|