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

@remirror/react-renderer

Package Overview
Dependencies
Maintainers
1
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remirror/react-renderer - npm Package Compare versions

Comparing version 0.0.0-pr862.2 to 0.0.0-pr877.1

dist/declarations/src/handlers/code-block.d.ts

4

dist/declarations/src/index.d.ts

@@ -1,1 +0,3 @@

export { RemirrorRenderer } from './renderer';
export * from './handlers';
export { Doc, RemirrorRenderer } from './renderer';
export type { MarkMap } from './types';

@@ -1,4 +0,5 @@

import { ComponentType, FC } from 'react';
import { FC } from 'react';
import { RemirrorJSON } from '@remirror/core';
declare type MarkMap = Partial<Record<string, string | ComponentType<any>>>;
import { MarkMap } from './types';
export declare const Doc: FC<SubRenderTreeProps>;
export interface BaseRenderTreeProps {

@@ -21,2 +22,1 @@ skipUnknownTypes: boolean;

export declare const RemirrorRenderer: FC<RenderTreeProps>;
export {};

@@ -5,7 +5,7 @@ 'use strict';

var _createForOfIteratorHelper = require('@babel/runtime/helpers/createForOfIteratorHelper');
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
var react = require('react');
var core = require('@remirror/core');
var _createForOfIteratorHelper = require('@babel/runtime/helpers/createForOfIteratorHelper');
var jsxRuntime = require('react/jsx-runtime');

@@ -73,3 +73,3 @@

content.map((node, ii) => {
var children = content.map((node, ii) => {
return /*#__PURE__*/jsxRuntime.jsx(TextHandler, _objectSpread({}, _objectSpread(_objectSpread({}, props), {}, {

@@ -81,3 +81,3 @@ node

children: /*#__PURE__*/jsxRuntime.jsx("code", {
children: content
children: children
})

@@ -87,7 +87,65 @@ });

var Doc = (_ref2) => {
var Heading = props => {
var _ref, _props$node$attrs;
var content = props.node.content;
if (!content) {
return null;
}
var children = content.map((node, ii) => {
return /*#__PURE__*/jsxRuntime.jsx(TextHandler, _objectSpread({}, _objectSpread(_objectSpread({}, props), {}, {
node
})), ii);
});
var level = (_ref = (_props$node$attrs = props.node.attrs) === null || _props$node$attrs === void 0 ? void 0 : _props$node$attrs.level) !== null && _ref !== void 0 ? _ref : 1;
return /*#__PURE__*/react.createElement("h".concat(level), null, children);
};
var createIFrameHandler = overwriteAttrs => {
var iframeHandler = props => {
var _props$node$attrs;
// Remove remirror-internal attributes
var _ref = (_props$node$attrs = props.node.attrs) !== null && _props$node$attrs !== void 0 ? _props$node$attrs : {},
allowFullScreen = _ref.allowFullScreen;
_ref.type;
var attrs = _objectWithoutProperties(_ref, ["allowFullScreen", "type"]);
var normalizedAttrs = _objectSpread(_objectSpread({}, attrs), {}, {
// Prevent React error that allowFullScreen must be boolean (but is string in remirror)
allowFullScreen: allowFullScreen !== 'false'
}, overwriteAttrs);
return /*#__PURE__*/jsxRuntime.jsx("iframe", _objectSpread({}, normalizedAttrs));
};
return iframeHandler;
};
var createLinkHandler = overwriteAttrs => {
var linkHandler = (_ref) => {
var href = _ref.href,
target = _ref.target,
children = _ref.children;
var normalizedAttrs = _objectSpread({
href,
target: target !== null && target !== void 0 ? target : undefined
}, overwriteAttrs);
return /*#__PURE__*/jsxRuntime.jsx("a", _objectSpread(_objectSpread({}, normalizedAttrs), {}, {
children: children
}));
};
return linkHandler;
};
var Doc = (_ref) => {
var _node$attrs;
var node = _ref2.node,
props = _objectWithoutProperties(_ref2, ["node"]);
var node = _ref.node,
props = _objectWithoutProperties(_ref, ["node"]);

@@ -111,9 +169,13 @@ var content = node.content;

};
var defaultTypeMap = {
blockquote: 'blockquote',
bulletList: 'ul',
doc: Doc,
heading: Heading,
paragraph: 'p',
iframe: createIFrameHandler(),
image: 'img',
hardBreak: 'br',
codeBlock: CodeBlock,
orderedList: 'ol',
text: TextHandler

@@ -125,3 +187,3 @@ };

code: 'code',
link: 'a',
link: createLinkHandler(),
underline: 'u'

@@ -187,2 +249,5 @@ };

exports.CodeBlock = CodeBlock;
exports.Doc = Doc;
exports.RemirrorRenderer = RemirrorRenderer;
exports.TextHandler = TextHandler;

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

import _createForOfIteratorHelper from '@babel/runtime/helpers/esm/createForOfIteratorHelper';
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
import { Fragment, createElement } from 'react';
import { isEmptyArray, isString, object } from '@remirror/core';
import { isString, isEmptyArray, object } from '@remirror/core';
import _createForOfIteratorHelper from '@babel/runtime/helpers/esm/createForOfIteratorHelper';
import { jsx } from 'react/jsx-runtime';

@@ -68,3 +68,3 @@

content.map((node, ii) => {
var children = content.map((node, ii) => {
return /*#__PURE__*/jsx(TextHandler, _objectSpread({}, _objectSpread(_objectSpread({}, props), {}, {

@@ -76,3 +76,3 @@ node

children: /*#__PURE__*/jsx("code", {
children: content
children: children
})

@@ -82,7 +82,65 @@ });

var Doc = (_ref2) => {
var Heading = props => {
var _ref, _props$node$attrs;
var content = props.node.content;
if (!content) {
return null;
}
var children = content.map((node, ii) => {
return /*#__PURE__*/jsx(TextHandler, _objectSpread({}, _objectSpread(_objectSpread({}, props), {}, {
node
})), ii);
});
var level = (_ref = (_props$node$attrs = props.node.attrs) === null || _props$node$attrs === void 0 ? void 0 : _props$node$attrs.level) !== null && _ref !== void 0 ? _ref : 1;
return /*#__PURE__*/createElement("h".concat(level), null, children);
};
var createIFrameHandler = overwriteAttrs => {
var iframeHandler = props => {
var _props$node$attrs;
// Remove remirror-internal attributes
var _ref = (_props$node$attrs = props.node.attrs) !== null && _props$node$attrs !== void 0 ? _props$node$attrs : {},
allowFullScreen = _ref.allowFullScreen;
_ref.type;
var attrs = _objectWithoutProperties(_ref, ["allowFullScreen", "type"]);
var normalizedAttrs = _objectSpread(_objectSpread({}, attrs), {}, {
// Prevent React error that allowFullScreen must be boolean (but is string in remirror)
allowFullScreen: allowFullScreen !== 'false'
}, overwriteAttrs);
return /*#__PURE__*/jsx("iframe", _objectSpread({}, normalizedAttrs));
};
return iframeHandler;
};
var createLinkHandler = overwriteAttrs => {
var linkHandler = (_ref) => {
var href = _ref.href,
target = _ref.target,
children = _ref.children;
var normalizedAttrs = _objectSpread({
href,
target: target !== null && target !== void 0 ? target : undefined
}, overwriteAttrs);
return /*#__PURE__*/jsx("a", _objectSpread(_objectSpread({}, normalizedAttrs), {}, {
children: children
}));
};
return linkHandler;
};
var Doc = (_ref) => {
var _node$attrs;
var node = _ref2.node,
props = _objectWithoutProperties(_ref2, ["node"]);
var node = _ref.node,
props = _objectWithoutProperties(_ref, ["node"]);

@@ -106,9 +164,13 @@ var content = node.content;

};
var defaultTypeMap = {
blockquote: 'blockquote',
bulletList: 'ul',
doc: Doc,
heading: Heading,
paragraph: 'p',
iframe: createIFrameHandler(),
image: 'img',
hardBreak: 'br',
codeBlock: CodeBlock,
orderedList: 'ol',
text: TextHandler

@@ -120,3 +182,3 @@ };

code: 'code',
link: 'a',
link: createLinkHandler(),
underline: 'u'

@@ -182,2 +244,2 @@ };

export { RemirrorRenderer };
export { CodeBlock, Doc, RemirrorRenderer, TextHandler };

@@ -5,7 +5,7 @@ 'use strict';

var _createForOfIteratorHelper = require('@babel/runtime/helpers/createForOfIteratorHelper');
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
var react = require('react');
var core = require('@remirror/core');
var _createForOfIteratorHelper = require('@babel/runtime/helpers/createForOfIteratorHelper');
var jsxRuntime = require('react/jsx-runtime');

@@ -73,3 +73,3 @@

content.map((node, ii) => {
var children = content.map((node, ii) => {
return /*#__PURE__*/jsxRuntime.jsx(TextHandler, _objectSpread({}, _objectSpread(_objectSpread({}, props), {}, {

@@ -81,3 +81,3 @@ node

children: /*#__PURE__*/jsxRuntime.jsx("code", {
children: content
children: children
})

@@ -87,7 +87,65 @@ });

var Doc = (_ref2) => {
var Heading = props => {
var _ref, _props$node$attrs;
var content = props.node.content;
if (!content) {
return null;
}
var children = content.map((node, ii) => {
return /*#__PURE__*/jsxRuntime.jsx(TextHandler, _objectSpread({}, _objectSpread(_objectSpread({}, props), {}, {
node
})), ii);
});
var level = (_ref = (_props$node$attrs = props.node.attrs) === null || _props$node$attrs === void 0 ? void 0 : _props$node$attrs.level) !== null && _ref !== void 0 ? _ref : 1;
return /*#__PURE__*/react.createElement("h".concat(level), null, children);
};
var createIFrameHandler = overwriteAttrs => {
var iframeHandler = props => {
var _props$node$attrs;
// Remove remirror-internal attributes
var _ref = (_props$node$attrs = props.node.attrs) !== null && _props$node$attrs !== void 0 ? _props$node$attrs : {},
allowFullScreen = _ref.allowFullScreen;
_ref.type;
var attrs = _objectWithoutProperties(_ref, ["allowFullScreen", "type"]);
var normalizedAttrs = _objectSpread(_objectSpread({}, attrs), {}, {
// Prevent React error that allowFullScreen must be boolean (but is string in remirror)
allowFullScreen: allowFullScreen !== 'false'
}, overwriteAttrs);
return /*#__PURE__*/jsxRuntime.jsx("iframe", _objectSpread({}, normalizedAttrs));
};
return iframeHandler;
};
var createLinkHandler = overwriteAttrs => {
var linkHandler = (_ref) => {
var href = _ref.href,
target = _ref.target,
children = _ref.children;
var normalizedAttrs = _objectSpread({
href,
target: target !== null && target !== void 0 ? target : undefined
}, overwriteAttrs);
return /*#__PURE__*/jsxRuntime.jsx("a", _objectSpread(_objectSpread({}, normalizedAttrs), {}, {
children: children
}));
};
return linkHandler;
};
var Doc = (_ref) => {
var _node$attrs;
var node = _ref2.node,
props = _objectWithoutProperties(_ref2, ["node"]);
var node = _ref.node,
props = _objectWithoutProperties(_ref, ["node"]);

@@ -111,9 +169,13 @@ var content = node.content;

};
var defaultTypeMap = {
blockquote: 'blockquote',
bulletList: 'ul',
doc: Doc,
heading: Heading,
paragraph: 'p',
iframe: createIFrameHandler(),
image: 'img',
hardBreak: 'br',
codeBlock: CodeBlock,
orderedList: 'ol',
text: TextHandler

@@ -125,3 +187,3 @@ };

code: 'code',
link: 'a',
link: createLinkHandler(),
underline: 'u'

@@ -187,2 +249,5 @@ };

exports.CodeBlock = CodeBlock;
exports.Doc = Doc;
exports.RemirrorRenderer = RemirrorRenderer;
exports.TextHandler = TextHandler;

@@ -5,7 +5,7 @@ 'use strict';

var _createForOfIteratorHelper = require('@babel/runtime/helpers/createForOfIteratorHelper');
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
var react = require('react');
var core = require('@remirror/core');
var _createForOfIteratorHelper = require('@babel/runtime/helpers/createForOfIteratorHelper');
var jsxRuntime = require('react/jsx-runtime');

@@ -73,3 +73,3 @@

content.map((node, ii) => {
var children = content.map((node, ii) => {
return /*#__PURE__*/jsxRuntime.jsx(TextHandler, _objectSpread({}, _objectSpread(_objectSpread({}, props), {}, {

@@ -81,3 +81,3 @@ node

children: /*#__PURE__*/jsxRuntime.jsx("code", {
children: content
children: children
})

@@ -87,7 +87,65 @@ });

var Doc = (_ref2) => {
var Heading = props => {
var _ref, _props$node$attrs;
var content = props.node.content;
if (!content) {
return null;
}
var children = content.map((node, ii) => {
return /*#__PURE__*/jsxRuntime.jsx(TextHandler, _objectSpread({}, _objectSpread(_objectSpread({}, props), {}, {
node
})), ii);
});
var level = (_ref = (_props$node$attrs = props.node.attrs) === null || _props$node$attrs === void 0 ? void 0 : _props$node$attrs.level) !== null && _ref !== void 0 ? _ref : 1;
return /*#__PURE__*/react.createElement("h".concat(level), null, children);
};
var createIFrameHandler = overwriteAttrs => {
var iframeHandler = props => {
var _props$node$attrs;
// Remove remirror-internal attributes
var _ref = (_props$node$attrs = props.node.attrs) !== null && _props$node$attrs !== void 0 ? _props$node$attrs : {},
allowFullScreen = _ref.allowFullScreen;
_ref.type;
var attrs = _objectWithoutProperties(_ref, ["allowFullScreen", "type"]);
var normalizedAttrs = _objectSpread(_objectSpread({}, attrs), {}, {
// Prevent React error that allowFullScreen must be boolean (but is string in remirror)
allowFullScreen: allowFullScreen !== 'false'
}, overwriteAttrs);
return /*#__PURE__*/jsxRuntime.jsx("iframe", _objectSpread({}, normalizedAttrs));
};
return iframeHandler;
};
var createLinkHandler = overwriteAttrs => {
var linkHandler = (_ref) => {
var href = _ref.href,
target = _ref.target,
children = _ref.children;
var normalizedAttrs = _objectSpread({
href,
target: target !== null && target !== void 0 ? target : undefined
}, overwriteAttrs);
return /*#__PURE__*/jsxRuntime.jsx("a", _objectSpread(_objectSpread({}, normalizedAttrs), {}, {
children: children
}));
};
return linkHandler;
};
var Doc = (_ref) => {
var _node$attrs;
var node = _ref2.node,
props = _objectWithoutProperties(_ref2, ["node"]);
var node = _ref.node,
props = _objectWithoutProperties(_ref, ["node"]);

@@ -111,9 +169,13 @@ var content = node.content;

};
var defaultTypeMap = {
blockquote: 'blockquote',
bulletList: 'ul',
doc: Doc,
heading: Heading,
paragraph: 'p',
iframe: createIFrameHandler(),
image: 'img',
hardBreak: 'br',
codeBlock: CodeBlock,
orderedList: 'ol',
text: TextHandler

@@ -125,3 +187,3 @@ };

code: 'code',
link: 'a',
link: createLinkHandler(),
underline: 'u'

@@ -187,2 +249,5 @@ };

exports.CodeBlock = CodeBlock;
exports.Doc = Doc;
exports.RemirrorRenderer = RemirrorRenderer;
exports.TextHandler = TextHandler;

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

import _createForOfIteratorHelper from '@babel/runtime/helpers/esm/createForOfIteratorHelper';
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
import { Fragment, createElement } from 'react';
import { isEmptyArray, isString, object } from '@remirror/core';
import { isString, isEmptyArray, object } from '@remirror/core';
import _createForOfIteratorHelper from '@babel/runtime/helpers/esm/createForOfIteratorHelper';
import { jsx } from 'react/jsx-runtime';

@@ -68,3 +68,3 @@

content.map((node, ii) => {
var children = content.map((node, ii) => {
return /*#__PURE__*/jsx(TextHandler, _objectSpread({}, _objectSpread(_objectSpread({}, props), {}, {

@@ -76,3 +76,3 @@ node

children: /*#__PURE__*/jsx("code", {
children: content
children: children
})

@@ -82,7 +82,65 @@ });

var Doc = (_ref2) => {
var Heading = props => {
var _ref, _props$node$attrs;
var content = props.node.content;
if (!content) {
return null;
}
var children = content.map((node, ii) => {
return /*#__PURE__*/jsx(TextHandler, _objectSpread({}, _objectSpread(_objectSpread({}, props), {}, {
node
})), ii);
});
var level = (_ref = (_props$node$attrs = props.node.attrs) === null || _props$node$attrs === void 0 ? void 0 : _props$node$attrs.level) !== null && _ref !== void 0 ? _ref : 1;
return /*#__PURE__*/createElement("h".concat(level), null, children);
};
var createIFrameHandler = overwriteAttrs => {
var iframeHandler = props => {
var _props$node$attrs;
// Remove remirror-internal attributes
var _ref = (_props$node$attrs = props.node.attrs) !== null && _props$node$attrs !== void 0 ? _props$node$attrs : {},
allowFullScreen = _ref.allowFullScreen;
_ref.type;
var attrs = _objectWithoutProperties(_ref, ["allowFullScreen", "type"]);
var normalizedAttrs = _objectSpread(_objectSpread({}, attrs), {}, {
// Prevent React error that allowFullScreen must be boolean (but is string in remirror)
allowFullScreen: allowFullScreen !== 'false'
}, overwriteAttrs);
return /*#__PURE__*/jsx("iframe", _objectSpread({}, normalizedAttrs));
};
return iframeHandler;
};
var createLinkHandler = overwriteAttrs => {
var linkHandler = (_ref) => {
var href = _ref.href,
target = _ref.target,
children = _ref.children;
var normalizedAttrs = _objectSpread({
href,
target: target !== null && target !== void 0 ? target : undefined
}, overwriteAttrs);
return /*#__PURE__*/jsx("a", _objectSpread(_objectSpread({}, normalizedAttrs), {}, {
children: children
}));
};
return linkHandler;
};
var Doc = (_ref) => {
var _node$attrs;
var node = _ref2.node,
props = _objectWithoutProperties(_ref2, ["node"]);
var node = _ref.node,
props = _objectWithoutProperties(_ref, ["node"]);

@@ -106,9 +164,13 @@ var content = node.content;

};
var defaultTypeMap = {
blockquote: 'blockquote',
bulletList: 'ul',
doc: Doc,
heading: Heading,
paragraph: 'p',
iframe: createIFrameHandler(),
image: 'img',
hardBreak: 'br',
codeBlock: CodeBlock,
orderedList: 'ol',
text: TextHandler

@@ -120,3 +182,3 @@ };

code: 'code',
link: 'a',
link: createLinkHandler(),
underline: 'u'

@@ -182,2 +244,2 @@ };

export { RemirrorRenderer };
export { CodeBlock, Doc, RemirrorRenderer, TextHandler };
{
"name": "@remirror/react-renderer",
"version": "0.0.0-pr862.2",
"version": "0.0.0-pr877.1",
"description": "Render the JSON output from your remirror editor as a react component",

@@ -37,4 +37,4 @@ "keywords": [

"dependencies": {
"@babel/runtime": "^7.12.13",
"@remirror/core": "0.0.0-pr862.2"
"@babel/runtime": "^7.13.7",
"@remirror/core": "0.0.0-pr877.1"
},

@@ -41,0 +41,0 @@ "devDependencies": {

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