@seed-hypermedia/client 0.0.23 → 0.0.25

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.
Files changed (2) hide show
  1. package/dist/index.mjs +24 -9
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -546,13 +546,18 @@ function annotationsToPublishable(annotations) {
546
546
  });
547
547
  }
548
548
  function blockToPublishable(blockNode) {
549
+ var _a;
549
550
  const block = blockNode.block;
550
551
  if (block.type === "Paragraph") {
551
- if (block.text === "" || block.text === void 0) return null;
552
+ const hasChildren = (blockNode.children || []).length > 0;
553
+ const isListContainer = ((_a = block.attributes) == null ? void 0 : _a.childrenType) !== void 0;
554
+ if ((block.text === "" || block.text === void 0) && !hasChildren && !isListContainer) {
555
+ return null;
556
+ }
552
557
  return {
553
558
  id: block.id,
554
559
  type: "Paragraph",
555
- text: block.text,
560
+ text: block.text || "",
556
561
  annotations: annotationsToPublishable(block.annotations || []),
557
562
  ...block.attributes,
558
563
  children: blocksToPublishable(blockNode.children || [])
@@ -2267,13 +2272,23 @@ function parseInlineFormatting(raw) {
2267
2272
  const inner = raw.slice(i + 1, end);
2268
2273
  if (/^[a-zA-Z][a-zA-Z0-9+.-]*:\S*$/.test(inner) && !/[\s<>]/.test(inner)) {
2269
2274
  const start = text.length;
2270
- text += "\uFFFC";
2271
- annotations.push({
2272
- type: "Embed",
2273
- starts: [start],
2274
- ends: [text.length],
2275
- link: inner
2276
- });
2275
+ if (inner.startsWith("hm://")) {
2276
+ text += "\uFFFC";
2277
+ annotations.push({
2278
+ type: "Embed",
2279
+ starts: [start],
2280
+ ends: [text.length],
2281
+ link: inner
2282
+ });
2283
+ } else {
2284
+ text += inner;
2285
+ annotations.push({
2286
+ type: "Link",
2287
+ starts: [start],
2288
+ ends: [text.length],
2289
+ link: inner
2290
+ });
2291
+ }
2277
2292
  i = end + 1;
2278
2293
  continue;
2279
2294
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-hypermedia/client",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/seed-hypermedia/seed",