🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

prosemirror-trailing-node

Package Overview
Dependencies
Maintainers
1
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-trailing-node - npm Package Compare versions

Comparing version

to
3.0.0-beta.4

40

dist/prosemirror-trailing-node.js
// src/trailing-node-plugin.ts
import { Plugin, PluginKey } from "prosemirror-state";
import { includes, uniqueArray } from "@remirror/core-helpers";
var trailingNodePluginKey = new PluginKey("trailingNode");
function trailingNode(options) {
var _ref = options !== null && options !== void 0 ? options : {},
_ref$ignoredNodes = _ref.ignoredNodes,
ignoredNodes = _ref$ignoredNodes === void 0 ? [] : _ref$ignoredNodes,
_ref$nodeName = _ref.nodeName,
nodeName = _ref$nodeName === void 0 ? "paragraph" : _ref$nodeName;
var ignoredNodeNames = uniqueArray([...ignoredNodes, nodeName]);
var type;
var types;
const { ignoredNodes = [], nodeName = "paragraph" } = options != null ? options : {};
const ignoredNodeNames = /* @__PURE__ */ new Set([...ignoredNodes, nodeName]);
let type;
let types;
return new Plugin({
key: trailingNodePluginKey,
appendTransaction(_, __, state) {
var doc = state.doc,
tr = state.tr;
var shouldInsertNodeAtEnd = trailingNodePluginKey.getState(state);
var endPosition = doc.content.size;
const { doc, tr } = state;
const shouldInsertNodeAtEnd = trailingNodePluginKey.getState(state);
const endPosition = doc.content.size;
if (!shouldInsertNodeAtEnd) {

@@ -27,7 +21,5 @@ return;

state: {
init: (_, _ref2) => {
var _doc$lastChild;
var doc = _ref2.doc,
schema = _ref2.schema;
var nodeType = schema.nodes[nodeName];
init: (_, { doc, schema }) => {
var _a;
const nodeType = schema.nodes[nodeName];
if (!nodeType) {

@@ -37,11 +29,11 @@ throw new Error("Invalid node being used for trailing node extension: '".concat(nodeName, "'"));

type = nodeType;
types = Object.values(schema.nodes).map(node => node).filter(node => !ignoredNodeNames.includes(node.name));
return includes(types, (_doc$lastChild = doc.lastChild) === null || _doc$lastChild === void 0 ? void 0 : _doc$lastChild.type);
types = Object.values(schema.nodes).map((node) => node).filter((node) => !ignoredNodeNames.has(node.name));
return types.includes((_a = doc.lastChild) == null ? void 0 : _a.type);
},
apply: (tr, value) => {
var _tr$doc$lastChild;
var _a;
if (!tr.docChanged) {
return value;
}
return includes(types, (_tr$doc$lastChild = tr.doc.lastChild) === null || _tr$doc$lastChild === void 0 ? void 0 : _tr$doc$lastChild.type);
return types.includes((_a = tr.doc.lastChild) == null ? void 0 : _a.type);
}

@@ -51,2 +43,4 @@ }

}
export { trailingNode };
export {
trailingNode
};
{
"name": "prosemirror-trailing-node",
"version": "3.0.0-beta.3",
"version": "3.0.0-beta.4",
"description": "A trailing node plugin for the prosemirror editor.",

@@ -33,16 +33,15 @@ "homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/prosemirror-trailing-node",

"dependencies": {
"@remirror/core-constants": "3.0.0-beta.2",
"@remirror/core-helpers": "4.0.0-beta.2",
"@remirror/core-constants": "3.0.0-beta.3",
"escape-string-regexp": "^4.0.0"
},
"devDependencies": {
"@remirror/cli": "1.0.1",
"prosemirror-model": "^1.19.3",
"@remirror/cli": "1.1.0-beta.0",
"prosemirror-model": "^1.22.1",
"prosemirror-state": "^1.4.3",
"prosemirror-view": "^1.32.3"
"prosemirror-view": "^1.33.8"
},
"peerDependencies": {
"prosemirror-model": "^1.19.0",
"prosemirror-model": "^1.22.1",
"prosemirror-state": "^1.4.2",
"prosemirror-view": "^1.32.3"
"prosemirror-view": "^1.33.8"
},

@@ -49,0 +48,0 @@ "peerDependenciesMeta": {},

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