@uniformdev/richtext 19.17.0 → 19.19.0

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.esm.js CHANGED
@@ -1,7 +1,8 @@
1
1
  // src/elements.ts
2
2
  var rendererTypeTagMap = /* @__PURE__ */ new Map([
3
- ["linebreak", "br"],
4
- ["quote", "blockquote"]
3
+ ["linebreak", ["br"]],
4
+ ["quote", ["blockquote"]],
5
+ ["code", ["pre", "code"]]
5
6
  ]);
6
7
  function purifyText(text) {
7
8
  return text.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -94,8 +95,8 @@ var listHtmlRenderer = ({ context, renderChildren }) => {
94
95
  var listitemHtmlRenderer = ({ context, renderChildren }) => {
95
96
  const node = context.currentNode;
96
97
  const attributes = /* @__PURE__ */ new Map();
97
- if (Number.isFinite(node.value)) {
98
- attributes.set("value", (node.value + 1).toString());
98
+ if (Number.isFinite(node.value) && node.value > 0) {
99
+ attributes.set("value", node.value.toString());
99
100
  }
100
101
  return renderHtmlElement("li", attributes, renderChildren(context.currentNode.children));
101
102
  };
@@ -198,13 +199,17 @@ var resolveDefaultRenderer = (context) => {
198
199
  if (renderer) {
199
200
  return renderer;
200
201
  }
201
- const tag = rendererTypeTagMap.get(context.currentNode.type);
202
- if (tag) {
203
- return ({ renderChildren }) => renderHtmlElement(
204
- tag,
205
- null,
206
- hasChildren(context.currentNode) ? renderChildren(context.currentNode.children) : void 0
207
- );
202
+ const tags = rendererTypeTagMap.get(context.currentNode.type);
203
+ if (tags) {
204
+ return ({ renderChildren }) => {
205
+ var _a;
206
+ return (_a = tags.reduceRight(
207
+ (children, tag) => {
208
+ return renderHtmlElement(tag, null, children);
209
+ },
210
+ hasChildren(context.currentNode) ? renderChildren(context.currentNode.children) : void 0
211
+ )) != null ? _a : "";
212
+ };
208
213
  }
209
214
  return () => `<!-- WARNING: No renderer for type ${context.currentNode.type} -->`;
210
215
  };
package/dist/index.js CHANGED
@@ -49,8 +49,9 @@ module.exports = __toCommonJS(src_exports);
49
49
 
50
50
  // src/elements.ts
51
51
  var rendererTypeTagMap = /* @__PURE__ */ new Map([
52
- ["linebreak", "br"],
53
- ["quote", "blockquote"]
52
+ ["linebreak", ["br"]],
53
+ ["quote", ["blockquote"]],
54
+ ["code", ["pre", "code"]]
54
55
  ]);
55
56
  function purifyText(text) {
56
57
  return text.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -143,8 +144,8 @@ var listHtmlRenderer = ({ context, renderChildren }) => {
143
144
  var listitemHtmlRenderer = ({ context, renderChildren }) => {
144
145
  const node = context.currentNode;
145
146
  const attributes = /* @__PURE__ */ new Map();
146
- if (Number.isFinite(node.value)) {
147
- attributes.set("value", (node.value + 1).toString());
147
+ if (Number.isFinite(node.value) && node.value > 0) {
148
+ attributes.set("value", node.value.toString());
148
149
  }
149
150
  return renderHtmlElement("li", attributes, renderChildren(context.currentNode.children));
150
151
  };
@@ -247,13 +248,17 @@ var resolveDefaultRenderer = (context) => {
247
248
  if (renderer) {
248
249
  return renderer;
249
250
  }
250
- const tag = rendererTypeTagMap.get(context.currentNode.type);
251
- if (tag) {
252
- return ({ renderChildren }) => renderHtmlElement(
253
- tag,
254
- null,
255
- hasChildren(context.currentNode) ? renderChildren(context.currentNode.children) : void 0
256
- );
251
+ const tags = rendererTypeTagMap.get(context.currentNode.type);
252
+ if (tags) {
253
+ return ({ renderChildren }) => {
254
+ var _a;
255
+ return (_a = tags.reduceRight(
256
+ (children, tag) => {
257
+ return renderHtmlElement(tag, null, children);
258
+ },
259
+ hasChildren(context.currentNode) ? renderChildren(context.currentNode.children) : void 0
260
+ )) != null ? _a : "";
261
+ };
257
262
  }
258
263
  return () => `<!-- WARNING: No renderer for type ${context.currentNode.type} -->`;
259
264
  };
package/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  // src/elements.ts
2
2
  var rendererTypeTagMap = /* @__PURE__ */ new Map([
3
- ["linebreak", "br"],
4
- ["quote", "blockquote"]
3
+ ["linebreak", ["br"]],
4
+ ["quote", ["blockquote"]],
5
+ ["code", ["pre", "code"]]
5
6
  ]);
6
7
  function purifyText(text) {
7
8
  return text.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -94,8 +95,8 @@ var listHtmlRenderer = ({ context, renderChildren }) => {
94
95
  var listitemHtmlRenderer = ({ context, renderChildren }) => {
95
96
  const node = context.currentNode;
96
97
  const attributes = /* @__PURE__ */ new Map();
97
- if (Number.isFinite(node.value)) {
98
- attributes.set("value", (node.value + 1).toString());
98
+ if (Number.isFinite(node.value) && node.value > 0) {
99
+ attributes.set("value", node.value.toString());
99
100
  }
100
101
  return renderHtmlElement("li", attributes, renderChildren(context.currentNode.children));
101
102
  };
@@ -198,13 +199,17 @@ var resolveDefaultRenderer = (context) => {
198
199
  if (renderer) {
199
200
  return renderer;
200
201
  }
201
- const tag = rendererTypeTagMap.get(context.currentNode.type);
202
- if (tag) {
203
- return ({ renderChildren }) => renderHtmlElement(
204
- tag,
205
- null,
206
- hasChildren(context.currentNode) ? renderChildren(context.currentNode.children) : void 0
207
- );
202
+ const tags = rendererTypeTagMap.get(context.currentNode.type);
203
+ if (tags) {
204
+ return ({ renderChildren }) => {
205
+ var _a;
206
+ return (_a = tags.reduceRight(
207
+ (children, tag) => {
208
+ return renderHtmlElement(tag, null, children);
209
+ },
210
+ hasChildren(context.currentNode) ? renderChildren(context.currentNode.children) : void 0
211
+ )) != null ? _a : "";
212
+ };
208
213
  }
209
214
  return () => `<!-- WARNING: No renderer for type ${context.currentNode.type} -->`;
210
215
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/richtext",
3
- "version": "19.17.0",
3
+ "version": "19.19.0",
4
4
  "description": "Common functionality and types for Uniform Rich Text parameters",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "@lexical/link": "^0.11.0",
46
46
  "@lexical/list": "^0.11.0",
47
47
  "@lexical/rich-text": "^0.11.0",
48
- "@uniformdev/canvas": "^19.17.0",
48
+ "@uniformdev/canvas": "^19.19.0",
49
49
  "lexical": "^0.11.0"
50
50
  },
51
51
  "files": [
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "ed86997d97cefd0d6849abdeb3bdf3737812ea01"
57
+ "gitHead": "631d1e21b1303220d80bea12611ea6c98d5fe354"
58
58
  }