New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

prosemirror-paste-rules

Package Overview
Dependencies
Maintainers
1
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-paste-rules - npm Package Compare versions

Comparing version 0.0.0-pr960.1 to 0.0.0-pr963.1

8

dist/declarations/src/paste-rules-plugin.d.ts

@@ -75,2 +75,8 @@ import { Fragment, MarkType, Node as ProsemirrorNode, NodeType } from 'prosemirror-model';

replaceSelection?: boolean | ((replacedText: string) => boolean);
/**
* A function that transforms the match into the desired text value.
*
* Return an empty string to delete all content.
*/
transformMatch?: (match: RegExpExecArray) => string | null | undefined;
}

@@ -92,3 +98,3 @@ export interface NodePasteRule extends BaseContentPasteRule {

*
* If this function is undefined, then the text node cutted from the match
* If this function is undefined, then the text node that is cut from the match
* will be used as the content.

@@ -95,0 +101,0 @@ */

58

dist/prosemirror-paste-rules.browser.cjs.js

@@ -361,27 +361,22 @@ 'use strict';

function markRuleTransformer(props) {
var _ref;
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
match = props.match,
schema = props.schema;
var transformMatch = rule.transformMatch,
getAttributes = rule.getAttributes,
markType = rule.markType;
var attributes = coreHelpers.isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
nodes.push(textNode.mark([markType.create(attributes), ...textNode.marks]));
}
/**
* Support for pasting node content into the editor.
*/
var transformedCapturedValue = transformMatch === null || transformMatch === void 0 ? void 0 : transformMatch(match); // remove the text if transformMatch return
if (transformedCapturedValue === '') {
return;
}
function nodeRuleTransformer(props) {
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
nodeType = rule.nodeType,
getContent = rule.getContent;
var attributes = coreHelpers.isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
var content = (getContent ? getContent(match) : textNode) || undefined;
nodes.push(nodeType.createChecked(attributes, content));
var text = (_ref = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref !== void 0 ? _ref : '';
var marks = [markType.create(attributes), ...textNode.marks];
nodes.push(schema.text(text, marks));
}

@@ -394,3 +389,3 @@ /**

function textRuleTransformer(props) {
var _ref;
var _ref2;

@@ -409,6 +404,23 @@ var nodes = props.nodes,

var text = (_ref = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref !== void 0 ? _ref : '';
var text = (_ref2 = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref2 !== void 0 ? _ref2 : '';
nodes.push(schema.text(text, textNode.marks));
}
/**
* Support for pasting node content into the editor.
*/
function nodeRuleTransformer(props) {
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
nodeType = rule.nodeType,
getContent = rule.getContent;
var attributes = coreHelpers.isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
var content = (getContent ? getContent(match) : textNode) || undefined;
nodes.push(nodeType.createChecked(attributes, content));
}
/**
* The run the handlers for the regex paste rules on the content which has been transformed by prosemirror.

@@ -458,5 +470,5 @@ */

function isInCode(selection) {
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref2$contained = _ref2.contained,
contained = _ref2$contained === void 0 ? true : _ref2$contained;
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref3$contained = _ref3.contained,
contained = _ref3$contained === void 0 ? true : _ref3$contained;

@@ -463,0 +475,0 @@ if (selection.empty) {

@@ -357,27 +357,22 @@ import _createForOfIteratorHelper from '@babel/runtime/helpers/esm/createForOfIteratorHelper';

function markRuleTransformer(props) {
var _ref;
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
match = props.match,
schema = props.schema;
var transformMatch = rule.transformMatch,
getAttributes = rule.getAttributes,
markType = rule.markType;
var attributes = isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
nodes.push(textNode.mark([markType.create(attributes), ...textNode.marks]));
}
/**
* Support for pasting node content into the editor.
*/
var transformedCapturedValue = transformMatch === null || transformMatch === void 0 ? void 0 : transformMatch(match); // remove the text if transformMatch return
if (transformedCapturedValue === '') {
return;
}
function nodeRuleTransformer(props) {
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
nodeType = rule.nodeType,
getContent = rule.getContent;
var attributes = isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
var content = (getContent ? getContent(match) : textNode) || undefined;
nodes.push(nodeType.createChecked(attributes, content));
var text = (_ref = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref !== void 0 ? _ref : '';
var marks = [markType.create(attributes), ...textNode.marks];
nodes.push(schema.text(text, marks));
}

@@ -390,3 +385,3 @@ /**

function textRuleTransformer(props) {
var _ref;
var _ref2;

@@ -405,6 +400,23 @@ var nodes = props.nodes,

var text = (_ref = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref !== void 0 ? _ref : '';
var text = (_ref2 = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref2 !== void 0 ? _ref2 : '';
nodes.push(schema.text(text, textNode.marks));
}
/**
* Support for pasting node content into the editor.
*/
function nodeRuleTransformer(props) {
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
nodeType = rule.nodeType,
getContent = rule.getContent;
var attributes = isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
var content = (getContent ? getContent(match) : textNode) || undefined;
nodes.push(nodeType.createChecked(attributes, content));
}
/**
* The run the handlers for the regex paste rules on the content which has been transformed by prosemirror.

@@ -454,5 +466,5 @@ */

function isInCode(selection) {
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref2$contained = _ref2.contained,
contained = _ref2$contained === void 0 ? true : _ref2$contained;
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref3$contained = _ref3.contained,
contained = _ref3$contained === void 0 ? true : _ref3$contained;

@@ -459,0 +471,0 @@ if (selection.empty) {

@@ -361,27 +361,22 @@ 'use strict';

function markRuleTransformer(props) {
var _ref;
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
match = props.match,
schema = props.schema;
var transformMatch = rule.transformMatch,
getAttributes = rule.getAttributes,
markType = rule.markType;
var attributes = coreHelpers.isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
nodes.push(textNode.mark([markType.create(attributes), ...textNode.marks]));
}
/**
* Support for pasting node content into the editor.
*/
var transformedCapturedValue = transformMatch === null || transformMatch === void 0 ? void 0 : transformMatch(match); // remove the text if transformMatch return
if (transformedCapturedValue === '') {
return;
}
function nodeRuleTransformer(props) {
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
nodeType = rule.nodeType,
getContent = rule.getContent;
var attributes = coreHelpers.isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
var content = (getContent ? getContent(match) : textNode) || undefined;
nodes.push(nodeType.createChecked(attributes, content));
var text = (_ref = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref !== void 0 ? _ref : '';
var marks = [markType.create(attributes), ...textNode.marks];
nodes.push(schema.text(text, marks));
}

@@ -394,3 +389,3 @@ /**

function textRuleTransformer(props) {
var _ref;
var _ref2;

@@ -409,6 +404,23 @@ var nodes = props.nodes,

var text = (_ref = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref !== void 0 ? _ref : '';
var text = (_ref2 = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref2 !== void 0 ? _ref2 : '';
nodes.push(schema.text(text, textNode.marks));
}
/**
* Support for pasting node content into the editor.
*/
function nodeRuleTransformer(props) {
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
nodeType = rule.nodeType,
getContent = rule.getContent;
var attributes = coreHelpers.isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
var content = (getContent ? getContent(match) : textNode) || undefined;
nodes.push(nodeType.createChecked(attributes, content));
}
/**
* The run the handlers for the regex paste rules on the content which has been transformed by prosemirror.

@@ -458,5 +470,5 @@ */

function isInCode(selection) {
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref2$contained = _ref2.contained,
contained = _ref2$contained === void 0 ? true : _ref2$contained;
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref3$contained = _ref3.contained,
contained = _ref3$contained === void 0 ? true : _ref3$contained;

@@ -463,0 +475,0 @@ if (selection.empty) {

@@ -361,27 +361,22 @@ 'use strict';

function markRuleTransformer(props) {
var _ref;
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
match = props.match,
schema = props.schema;
var transformMatch = rule.transformMatch,
getAttributes = rule.getAttributes,
markType = rule.markType;
var attributes = coreHelpers.isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
nodes.push(textNode.mark([markType.create(attributes), ...textNode.marks]));
}
/**
* Support for pasting node content into the editor.
*/
var transformedCapturedValue = transformMatch === null || transformMatch === void 0 ? void 0 : transformMatch(match); // remove the text if transformMatch return
if (transformedCapturedValue === '') {
return;
}
function nodeRuleTransformer(props) {
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
nodeType = rule.nodeType,
getContent = rule.getContent;
var attributes = coreHelpers.isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
var content = (getContent ? getContent(match) : textNode) || undefined;
nodes.push(nodeType.createChecked(attributes, content));
var text = (_ref = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref !== void 0 ? _ref : '';
var marks = [markType.create(attributes), ...textNode.marks];
nodes.push(schema.text(text, marks));
}

@@ -394,3 +389,3 @@ /**

function textRuleTransformer(props) {
var _ref;
var _ref2;

@@ -409,6 +404,23 @@ var nodes = props.nodes,

var text = (_ref = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref !== void 0 ? _ref : '';
var text = (_ref2 = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref2 !== void 0 ? _ref2 : '';
nodes.push(schema.text(text, textNode.marks));
}
/**
* Support for pasting node content into the editor.
*/
function nodeRuleTransformer(props) {
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
nodeType = rule.nodeType,
getContent = rule.getContent;
var attributes = coreHelpers.isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
var content = (getContent ? getContent(match) : textNode) || undefined;
nodes.push(nodeType.createChecked(attributes, content));
}
/**
* The run the handlers for the regex paste rules on the content which has been transformed by prosemirror.

@@ -458,5 +470,5 @@ */

function isInCode(selection) {
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref2$contained = _ref2.contained,
contained = _ref2$contained === void 0 ? true : _ref2$contained;
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref3$contained = _ref3.contained,
contained = _ref3$contained === void 0 ? true : _ref3$contained;

@@ -463,0 +475,0 @@ if (selection.empty) {

@@ -357,27 +357,22 @@ import _createForOfIteratorHelper from '@babel/runtime/helpers/esm/createForOfIteratorHelper';

function markRuleTransformer(props) {
var _ref;
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
match = props.match,
schema = props.schema;
var transformMatch = rule.transformMatch,
getAttributes = rule.getAttributes,
markType = rule.markType;
var attributes = isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
nodes.push(textNode.mark([markType.create(attributes), ...textNode.marks]));
}
/**
* Support for pasting node content into the editor.
*/
var transformedCapturedValue = transformMatch === null || transformMatch === void 0 ? void 0 : transformMatch(match); // remove the text if transformMatch return
if (transformedCapturedValue === '') {
return;
}
function nodeRuleTransformer(props) {
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
nodeType = rule.nodeType,
getContent = rule.getContent;
var attributes = isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
var content = (getContent ? getContent(match) : textNode) || undefined;
nodes.push(nodeType.createChecked(attributes, content));
var text = (_ref = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref !== void 0 ? _ref : '';
var marks = [markType.create(attributes), ...textNode.marks];
nodes.push(schema.text(text, marks));
}

@@ -390,3 +385,3 @@ /**

function textRuleTransformer(props) {
var _ref;
var _ref2;

@@ -405,6 +400,23 @@ var nodes = props.nodes,

var text = (_ref = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref !== void 0 ? _ref : '';
var text = (_ref2 = transformedCapturedValue !== null && transformedCapturedValue !== void 0 ? transformedCapturedValue : textNode.text) !== null && _ref2 !== void 0 ? _ref2 : '';
nodes.push(schema.text(text, textNode.marks));
}
/**
* Support for pasting node content into the editor.
*/
function nodeRuleTransformer(props) {
var nodes = props.nodes,
rule = props.rule,
textNode = props.textNode,
match = props.match;
var getAttributes = rule.getAttributes,
nodeType = rule.nodeType,
getContent = rule.getContent;
var attributes = isFunction(getAttributes) ? getAttributes(match, false) : getAttributes;
var content = (getContent ? getContent(match) : textNode) || undefined;
nodes.push(nodeType.createChecked(attributes, content));
}
/**
* The run the handlers for the regex paste rules on the content which has been transformed by prosemirror.

@@ -454,5 +466,5 @@ */

function isInCode(selection) {
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref2$contained = _ref2.contained,
contained = _ref2$contained === void 0 ? true : _ref2$contained;
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref3$contained = _ref3.contained,
contained = _ref3$contained === void 0 ? true : _ref3$contained;

@@ -459,0 +471,0 @@ if (selection.empty) {

{
"name": "prosemirror-paste-rules",
"version": "0.0.0-pr960.1",
"version": "0.0.0-pr963.1",
"description": "Better handling of pasted content in your prosemirror editor.",

@@ -35,4 +35,4 @@ "homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/prosemirror-paste-rules",

"@babel/runtime": "^7.13.10",
"@remirror/core-constants": "0.0.0-pr960.1",
"@remirror/core-helpers": "0.0.0-pr960.1",
"@remirror/core-constants": "0.0.0-pr963.1",
"@remirror/core-helpers": "0.0.0-pr963.1",
"escape-string-regexp": "^4.0.0"

@@ -39,0 +39,0 @@ },

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