Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contember/react-richtext-renderer

Package Overview
Dependencies
Maintainers
5
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/react-richtext-renderer - npm Package Compare versions

Comparing version 1.3.0-alpha.15 to 1.3.0-alpha.16

16

dist/development/components/RichText.js

@@ -1,2 +0,2 @@

import { jsx, Fragment } from "react/jsx-runtime";
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { createElement } from "react";

@@ -8,3 +8,7 @@ import { renderChildren } from "../internal/renderChildren.js";

renderLeaf,
renderBlock = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
renderBlock = ({ children }) => /* @__PURE__ */ jsxDEV(Fragment, { children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/components/RichText.tsx",
lineNumber: 28,
columnNumber: 34
}, void 0),
attributeNamePrefix,

@@ -14,3 +18,3 @@ referenceRenderers,

}) => {
return /* @__PURE__ */ jsx(Fragment, { children: blocks.map((block, i) => createElement(
return /* @__PURE__ */ jsxDEV(Fragment, { children: blocks.map((block, i) => createElement(
renderBlock,

@@ -29,3 +33,7 @@ {

}, block)
)) });
)) }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/components/RichText.tsx",
lineNumber: 34,
columnNumber: 3
}, void 0);
};

@@ -32,0 +40,0 @@ export {

@@ -1,2 +0,2 @@

import { jsx, Fragment } from "react/jsx-runtime";
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { RichText } from "./RichText.js";

@@ -7,3 +7,7 @@ import { useRichTextBlocksSource } from "../hooks/useRichTextBlocksSource.js";

renderLeaf,
renderBlock = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
renderBlock = ({ children }) => /* @__PURE__ */ jsxDEV(Fragment, { children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/components/RichTextBlocksRenderer.tsx",
lineNumber: 22,
columnNumber: 34
}, void 0),
attributeNamePrefix,

@@ -15,3 +19,3 @@ referenceRenderers,

const blocks = useRichTextBlocksSource(props);
return /* @__PURE__ */ jsx(
return /* @__PURE__ */ jsxDEV(
RichText,

@@ -26,3 +30,11 @@ {

attributeNamePrefix
}
},
void 0,
false,
{
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/components/RichTextBlocksRenderer.tsx",
lineNumber: 30,
columnNumber: 3
},
void 0
);

@@ -29,0 +41,0 @@ };

@@ -1,2 +0,2 @@

import { jsx } from "react/jsx-runtime";
import { jsxDEV } from "react/jsx-dev-runtime";
import { RichText } from "./RichText.js";

@@ -13,3 +13,3 @@ import { useRichTextFieldSource } from "../hooks/useRichTextFieldSource.js";

const blocks = useRichTextFieldSource(source);
return /* @__PURE__ */ jsx(
return /* @__PURE__ */ jsxDEV(
RichText,

@@ -23,3 +23,11 @@ {

undefinedReferenceHandler
}
},
void 0,
false,
{
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/components/RichTextFieldRenderer.tsx",
lineNumber: 33,
columnNumber: 3
},
void 0
);

@@ -26,0 +34,0 @@ };

@@ -1,2 +0,2 @@

import { jsx } from "react/jsx-runtime";
import { jsxDEV } from "react/jsx-dev-runtime";
import { memo } from "react";

@@ -7,5 +7,13 @@ import { RichTextFieldRenderer } from "./RichTextFieldRenderer.js";

if ("source" in props) {
return /* @__PURE__ */ jsx(RichTextFieldRenderer, { ...props });
return /* @__PURE__ */ jsxDEV(RichTextFieldRenderer, { ...props }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/components/RichTextRenderer.tsx",
lineNumber: 25,
columnNumber: 10
}, this);
}
return /* @__PURE__ */ jsx(RichTextBlocksRenderer, { ...props });
return /* @__PURE__ */ jsxDEV(RichTextBlocksRenderer, { ...props }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/components/RichTextRenderer.tsx",
lineNumber: 28,
columnNumber: 9
}, this);
});

@@ -12,0 +20,0 @@ export {

@@ -1,2 +0,2 @@

import { jsx } from "react/jsx-runtime";
import { jsxDEV } from "react/jsx-dev-runtime";
import { createElement } from "react";

@@ -8,3 +8,7 @@ import { renderChildren } from "../renderChildren.js";

const referenceMetadata = useReferenceMetadata(element, options, block);
const fallback = /* @__PURE__ */ jsx(RenderElementFallback, { element, options, block, children });
const fallback = /* @__PURE__ */ jsxDEV(RenderElementFallback, { element, options, block, children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/ElementRenderer.tsx",
lineNumber: 30,
columnNumber: 3
}, this);
return options.renderElement ? createElement(options.renderElement, {

@@ -11,0 +15,0 @@ ...referenceMetadata,

@@ -1,2 +0,2 @@

import { jsx } from "react/jsx-runtime";
import { jsxDEV } from "react/jsx-dev-runtime";
import { createElement } from "react";

@@ -9,3 +9,7 @@ import { RenderLeafFallback } from "./RenderLeafFallback.js";

}) {
const fallback = /* @__PURE__ */ jsx(RenderLeafFallback, { leaf });
const fallback = /* @__PURE__ */ jsxDEV(RenderLeafFallback, { leaf }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/LeafRenderer.tsx",
lineNumber: 23,
columnNumber: 19
}, this);
return renderLeaf ? createElement(

@@ -12,0 +16,0 @@ renderLeaf,

@@ -1,5 +0,6 @@

import { jsx, jsxs, Fragment } from "react/jsx-runtime";
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { createElement } from "react";
import { renderChildren } from "../renderChildren.js";
import { useReferenceMetadata } from "../useReferenceMetadata.js";
import { RichTextRendererError } from "../../RichTextRendererError.js";
const getElementDataAttributes = (element, attributeNamePrefix = "contember-") => {

@@ -18,41 +19,107 @@ const { children, referenceId, ...extendedSpecifics } = element;

case "anchor":
return /* @__PURE__ */ jsx("a", { ...attributes, href: element.href, children });
return /* @__PURE__ */ jsxDEV("a", { ...attributes, href: element.href, children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 51,
columnNumber: 5
}, this);
case "heading":
return createElement(`h${element.level}`, attributes, children);
case "horizontalRule":
return /* @__PURE__ */ jsx("hr", { ...attributes });
return /* @__PURE__ */ jsxDEV("hr", { ...attributes }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 58,
columnNumber: 11
}, this);
case "listItem":
return /* @__PURE__ */ jsx("li", { ...attributes, children });
return /* @__PURE__ */ jsxDEV("li", { ...attributes, children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 60,
columnNumber: 11
}, this);
case "orderedList":
return /* @__PURE__ */ jsx("ol", { ...attributes, children });
return /* @__PURE__ */ jsxDEV("ol", { ...attributes, children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 62,
columnNumber: 11
}, this);
case "paragraph":
return /* @__PURE__ */ jsx("p", { ...attributes, children });
return /* @__PURE__ */ jsxDEV("p", { ...attributes, children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 64,
columnNumber: 11
}, this);
case "reference": {
return /* @__PURE__ */ jsx(ReferenceElementFallback, { element, children, options, block });
return /* @__PURE__ */ jsxDEV(ReferenceElementFallback, { element, children, options, block }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 66,
columnNumber: 11
}, this);
}
case "scrollTarget":
return /* @__PURE__ */ jsx("span", { ...attributes, id: element.identifier, children });
return /* @__PURE__ */ jsxDEV("span", { ...attributes, id: element.identifier, children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 70,
columnNumber: 5
}, this);
case "table": {
const firstRow = element.children[0];
if (!firstRow || firstRow.headerScope !== "table") {
return /* @__PURE__ */ jsx("table", { ...attributes, children: /* @__PURE__ */ jsx("tbody", { children }) });
return /* @__PURE__ */ jsxDEV("table", { ...attributes, children: /* @__PURE__ */ jsxDEV("tbody", { children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 79,
columnNumber: 7
}, this) }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 78,
columnNumber: 6
}, this);
}
return /* @__PURE__ */ jsxs("table", { ...attributes, children: [
/* @__PURE__ */ jsx("thead", { children: renderChildren([firstRow], options, block) }),
/* @__PURE__ */ jsx("tbody", { children: renderChildren(element.children.slice(1), options, block) })
] });
return /* @__PURE__ */ jsxDEV("table", { ...attributes, children: [
/* @__PURE__ */ jsxDEV("thead", { children: renderChildren([firstRow], options, block) }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 85,
columnNumber: 6
}, this),
/* @__PURE__ */ jsxDEV("tbody", { children: renderChildren(element.children.slice(1), options, block) }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 86,
columnNumber: 6
}, this)
] }, void 0, true, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 84,
columnNumber: 5
}, this);
}
case "tableRow":
return /* @__PURE__ */ jsx("tr", { ...attributes, children });
return /* @__PURE__ */ jsxDEV("tr", { ...attributes, children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 91,
columnNumber: 11
}, this);
case "tableCell": {
if (element.headerScope) {
return /* @__PURE__ */ jsx("th", { ...attributes, scope: element.headerScope, children });
return /* @__PURE__ */ jsxDEV("th", { ...attributes, scope: element.headerScope, children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 95,
columnNumber: 6
}, this);
}
return /* @__PURE__ */ jsx("td", { ...attributes, children });
return /* @__PURE__ */ jsxDEV("td", { ...attributes, children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 100,
columnNumber: 11
}, this);
}
case "unorderedList":
return /* @__PURE__ */ jsx("ul", { ...attributes, children });
return /* @__PURE__ */ jsxDEV("ul", { ...attributes, children }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 103,
columnNumber: 11
}, this);
default: {
{
return children;
throw new RichTextRendererError(
`RichTextRenderer: unknown element of type '${element.type}'.`
);
}

@@ -68,3 +135,3 @@ }

let Renderer = elementMetadata.referenceRenderer;
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
return /* @__PURE__ */ jsxDEV(Fragment, { children: /* @__PURE__ */ jsxDEV(
Renderer,

@@ -80,4 +147,16 @@ {

children
}
) });
},
void 0,
false,
{
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 140,
columnNumber: 4
},
this
) }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx",
lineNumber: 139,
columnNumber: 3
}, this);
}

@@ -84,0 +163,0 @@ export {

@@ -1,2 +0,2 @@

import { jsx, Fragment, jsxs } from "react/jsx-runtime";
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { Fragment as Fragment$1 } from "react";

@@ -8,6 +8,14 @@ function jsxN2br(text) {

}
return lines.map((line, i) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
!!i && /* @__PURE__ */ jsx("br", {}),
return lines.map((line, i) => /* @__PURE__ */ jsxDEV(Fragment$1, { children: [
!!i && /* @__PURE__ */ jsxDEV("br", {}, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx",
lineNumber: 15,
columnNumber: 12
}, this),
line
] }, i));
] }, i, true, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx",
lineNumber: 14,
columnNumber: 3
}, this));
}

@@ -17,20 +25,48 @@ function RenderLeafFallback({ leaf }) {

if ("isCode" in leaf && leaf.isCode === true) {
element = /* @__PURE__ */ jsx("code", { children: element });
element = /* @__PURE__ */ jsxDEV("code", { children: element }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx",
lineNumber: 25,
columnNumber: 13
}, this);
}
if ("isStruckThrough" in leaf && leaf.isStruckThrough === true) {
element = /* @__PURE__ */ jsx("s", { children: element });
element = /* @__PURE__ */ jsxDEV("s", { children: element }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx",
lineNumber: 28,
columnNumber: 13
}, this);
}
if ("isHighlighted" in leaf && leaf.isHighlighted === true) {
element = /* @__PURE__ */ jsx("em", { children: element });
element = /* @__PURE__ */ jsxDEV("em", { children: element }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx",
lineNumber: 31,
columnNumber: 13
}, this);
}
if ("isUnderlined" in leaf && leaf.isUnderlined === true) {
element = /* @__PURE__ */ jsx("u", { children: element });
element = /* @__PURE__ */ jsxDEV("u", { children: element }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx",
lineNumber: 34,
columnNumber: 13
}, this);
}
if ("isItalic" in leaf && leaf.isItalic === true) {
element = /* @__PURE__ */ jsx("i", { children: element });
element = /* @__PURE__ */ jsxDEV("i", { children: element }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx",
lineNumber: 37,
columnNumber: 13
}, this);
}
if ("isBold" in leaf && leaf.isBold === true) {
element = /* @__PURE__ */ jsx("b", { children: element });
element = /* @__PURE__ */ jsxDEV("b", { children: element }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx",
lineNumber: 40,
columnNumber: 13
}, this);
}
return /* @__PURE__ */ jsx(Fragment, { children: element });
return /* @__PURE__ */ jsxDEV(Fragment, { children: element }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx",
lineNumber: 42,
columnNumber: 9
}, this);
}

@@ -37,0 +73,0 @@ export {

@@ -1,14 +0,26 @@

import { jsx, Fragment } from "react/jsx-runtime";
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { ElementRenderer } from "./components/ElementRenderer.js";
import { LeafRenderer } from "./components/LeafRenderer.js";
const renderChildren = (children, options, block) => {
return /* @__PURE__ */ jsx(Fragment, { children: (Array.isArray(children) ? children : [children]).map((child, i) => {
return /* @__PURE__ */ jsxDEV(Fragment, { children: (Array.isArray(children) ? children : [children]).map((child, i) => {
if ("text" in child) {
return /* @__PURE__ */ jsx(LeafRenderer, { leaf: child, options, block }, i);
return /* @__PURE__ */ jsxDEV(LeafRenderer, { leaf: child, options, block }, i, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/renderChildren.tsx",
lineNumber: 24,
columnNumber: 13
}, void 0);
}
if ("children" in child) {
return /* @__PURE__ */ jsx(ElementRenderer, { element: child, options, block, children: renderChildren(child.children, options, block) }, i);
return /* @__PURE__ */ jsxDEV(ElementRenderer, { element: child, options, block, children: renderChildren(child.children, options, block) }, i, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/renderChildren.tsx",
lineNumber: 28,
columnNumber: 7
}, void 0);
}
return null;
}) });
}) }, void 0, false, {
fileName: "/__w/interface/interface/packages/react-richtext-renderer/src/internal/renderChildren.tsx",
lineNumber: 21,
columnNumber: 3
}, void 0);
};

@@ -15,0 +27,0 @@ export {

@@ -14,2 +14,7 @@ import { RichTextRendererError } from "../RichTextRendererError.js";

if (typeof id !== "string") {
if (expectReference) {
throw new RichTextRendererError(
`RichTextRenderer: Expected element to have a referenceId.`
);
}
return emptyReference;

@@ -16,0 +21,0 @@ }

{
"name": "@contember/react-richtext-renderer",
"license": "Apache-2.0",
"version": "1.3.0-alpha.15",
"version": "1.3.0-alpha.16",
"type": "module",

@@ -31,3 +31,3 @@ "sideEffects": false,

"build": "yarn build:js:dev && yarn build:js:prod",
"build:js:dev": "vite build --mode development",
"build:js:dev": "NODE_ENV=development vite build --mode development",
"build:js:prod": "vite build --mode production",

@@ -34,0 +34,0 @@ "ae:build": "api-extractor run --local",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc