@lofcz/platejs-markdown 53.2.1 → 53.3.5

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.js +14 -5
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1561,17 +1561,26 @@ const defaultRules = {
1561
1561
  },
1562
1562
  callout: {
1563
1563
  deserialize: (mdastNode, deco, options) => {
1564
- const props = parseAttributes(mdastNode.attributes);
1564
+ const { type: calloutType, variant, ...rest } = parseAttributes(mdastNode.attributes);
1565
+ const normalize = (value) => {
1566
+ if (typeof value !== "string") return;
1567
+ const trimmed = value.trim().toLowerCase();
1568
+ return trimmed.length > 0 ? trimmed : void 0;
1569
+ };
1570
+ const resolvedVariant = normalize(calloutType) ?? normalize(variant);
1565
1571
  return {
1566
1572
  children: convertChildrenDeserialize(mdastNode.children, deco, options),
1567
1573
  type: getPluginType(options.editor, KEYS.callout),
1568
- ...props
1574
+ ...resolvedVariant ? { variant: resolvedVariant } : {},
1575
+ ...rest
1569
1576
  };
1570
1577
  },
1571
1578
  serialize(slateNode, options) {
1572
- const { children, type, ...rest } = slateNode;
1579
+ const { children, type: _type, variant, ...rest } = slateNode;
1580
+ const attrs = { ...rest };
1581
+ if (typeof variant === "string" && variant.length > 0) attrs.type = variant;
1573
1582
  return {
1574
- attributes: propsToAttributes(rest),
1583
+ attributes: propsToAttributes(attrs),
1575
1584
  children: convertNodesSerialize(children, options),
1576
1585
  name: "callout",
1577
1586
  type: "mdxJsxFlowElement"
@@ -2084,7 +2093,7 @@ const defaultRules = {
2084
2093
  const cellChildren = convertChildrenDeserialize(cell.children, deco, options);
2085
2094
  const groupedChildren = [];
2086
2095
  let currentParagraphChildren = [];
2087
- for (const child of cellChildren) if (!child.type || child.type === KEYS.inlineEquation) currentParagraphChildren.push(child);
2096
+ for (const child of cellChildren) if (!child.type || child.type === KEYS.inlineEquation || options.editor.api.isInline(child)) currentParagraphChildren.push(child);
2088
2097
  else {
2089
2098
  if (currentParagraphChildren.length > 0) {
2090
2099
  groupedChildren.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lofcz/platejs-markdown",
3
- "version": "53.2.1",
3
+ "version": "53.3.5",
4
4
  "description": "Markdown serializer plugin for Plate",
5
5
  "keywords": [
6
6
  "markdown",
@@ -54,10 +54,10 @@
54
54
  "@plate/scripts": "1.0.0",
55
55
  "@platejs/footnote": "npm:@lofcz/platejs-footnote@53.0.0",
56
56
  "@platejs/table": "npm:@lofcz/platejs-table@53.1.8",
57
- "platejs": "npm:@lofcz/platejs@53.1.1"
57
+ "platejs": "npm:@lofcz/platejs@53.3.4"
58
58
  },
59
59
  "peerDependencies": {
60
- "platejs": ">=53.0.0",
60
+ "platejs": ">=53.3.3",
61
61
  "react": ">=18.0.0",
62
62
  "react-dom": ">=18.0.0"
63
63
  },