Socket
Socket
Sign inDemoInstall

tiptap-utils

Package Overview
Dependencies
8
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.13.0 to 1.13.1

4

dist/utils.common.js
/*!
* tiptap-utils v1.12.0
* tiptap-utils v1.13.0
* (c) 2021 überdosis GbR (limited liability)

@@ -71,3 +71,3 @@ * @license MIT

function equalNodeType(nodeType, node) {
return Array.isArray(nodeType) && (nodeType.indexOf(node.type) > -1 || node.type === nodeType);
return Array.isArray(nodeType) && nodeType.indexOf(node.type) > -1 || node.type === nodeType;
}

@@ -74,0 +74,0 @@

/*!
* tiptap-utils v1.12.0
* tiptap-utils v1.13.0
* (c) 2021 überdosis GbR (limited liability)

@@ -67,3 +67,3 @@ * @license MIT

function equalNodeType(nodeType, node) {
return Array.isArray(nodeType) && (nodeType.indexOf(node.type) > -1 || node.type === nodeType);
return Array.isArray(nodeType) && nodeType.indexOf(node.type) > -1 || node.type === nodeType;
}

@@ -70,0 +70,0 @@

/*!
* tiptap-utils v1.12.0
* tiptap-utils v1.13.0
* (c) 2021 überdosis GbR (limited liability)

@@ -71,3 +71,3 @@ * @license MIT

function equalNodeType(nodeType, node) {
return Array.isArray(nodeType) && (nodeType.indexOf(node.type) > -1 || node.type === nodeType);
return Array.isArray(nodeType) && nodeType.indexOf(node.type) > -1 || node.type === nodeType;
}

@@ -74,0 +74,0 @@

/*!
* tiptap-utils v1.12.0
* tiptap-utils v1.13.0
* (c) 2021 überdosis GbR (limited liability)

@@ -10,6 +10,6 @@ * @license MIT

/*!
* tiptap-utils v1.12.0
* tiptap-utils v1.13.0
* (c) 2021 überdosis GbR (limited liability)
* @license MIT
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("prosemirror-state")):"function"==typeof define&&define.amd?define(["exports","prosemirror-state"],t):t((e=e||self).tiptapUtils={},e.prosemirrorState)}(this,(function(e,t){"use strict";function n(e,t){return t?e.createChecked(null,t):e.createAndFill()}function r(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(n=>{const r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function o(e,t){return Array.isArray(e)&&(e.indexOf(t.type)>-1||t.type===e)}function s(e){const t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)throw new Error('Invalid "node" parameter');const n=[];return e.descendants((e,r)=>{if(n.push({node:e,pos:r}),!t)return!1}),n}function i(e,t,n){if(!e)throw new Error('Invalid "node" parameter');if(!t)throw new Error('Invalid "predicate" parameter');return s(e,n).filter(e=>t(e.node))}function c(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function d(e){return t=>c(t.$from,e)}function a(e){return e instanceof t.NodeSelection}function f(e){return function(t){if(a(t)){const{node:n}=t,{$from:r}=t;if(o(e,n))return{node:n,pos:r.pos,depth:r.depth}}}}e.createCell=n,e.createTable=function(e,t,o,s,i){const c=r(e),d=[],a=[];for(let e=0;e<o;e+=1){const e=n(c.cell,i);if(e&&a.push(e),s){const e=n(c.header_cell,i);e&&d.push(e)}}const f=[];for(let e=0;e<t;e+=1)f.push(c.row.createChecked(null,s&&0===e?d:a));return c.table.createChecked(null,f)},e.equalNodeType=o,e.findBlockNodes=function(e,t){return i(e,e=>e.isBlock,t)},e.findChildren=i,e.findParentNode=d,e.findParentNodeClosestToPos=c,e.findSelectedNodeOfType=f,e.flatten=s,e.getMarkAttrs=function(e,t){const{from:n,to:r}=e.selection;let o=[];e.doc.nodesBetween(n,r,e=>{o=[...o,...e.marks]});const s=o.find(e=>e.type.name===t.name);return s?s.attrs:{}},e.getMarkRange=function(e=null,t=null){if(!e||!t)return!1;const n=e.parent.childAfter(e.parentOffset);if(!n.node)return!1;const r=n.node.marks.find(e=>e.type===t);if(!r)return!1;let o=e.index(),s=e.start()+n.offset,i=o+1,c=s+n.node.nodeSize;for(;o>0&&r.isInSet(e.parent.child(o-1).marks);)o-=1,s-=e.parent.child(o).nodeSize;for(;i<e.parent.childCount&&r.isInSet(e.parent.child(i).marks);)c+=e.parent.child(i).nodeSize,i+=1;return{from:s,to:c}},e.getNodeAttrs=function(e,t){const{from:n,to:r}=e.selection;let o=[];e.doc.nodesBetween(n,r,e=>{o=[...o,e]});const s=o.reverse().find(e=>e.type.name===t.name);return s?s.attrs:{}},e.getTableNodeTypes=r,e.isNodeSelection=a,e.markIsActive=function(e,t){const{from:n,$from:r,to:o,empty:s}=e.selection;return s?!!t.isInSet(e.storedMarks||r.marks()):!!e.doc.rangeHasMark(n,o,t)},e.nodeEqualsType=function({types:e,node:t}){return Array.isArray(e)&&e.includes(t.type)||t.type===e},e.nodeIsActive=function(e,t,n={}){const r=f(t)(e.selection)||d(e=>e.type===t)(e.selection);return Object.keys(n).length&&r?r.node.hasMarkup(t,{...r.node.attrs,...n}):!!r},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("prosemirror-state")):"function"==typeof define&&define.amd?define(["exports","prosemirror-state"],t):t((e=e||self).tiptapUtils={},e.prosemirrorState)}(this,(function(e,t){"use strict";function n(e,t){return t?e.createChecked(null,t):e.createAndFill()}function r(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(n=>{const r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function o(e,t){return Array.isArray(e)&&e.indexOf(t.type)>-1||t.type===e}function s(e){const t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)throw new Error('Invalid "node" parameter');const n=[];return e.descendants((e,r)=>{if(n.push({node:e,pos:r}),!t)return!1}),n}function i(e,t,n){if(!e)throw new Error('Invalid "node" parameter');if(!t)throw new Error('Invalid "predicate" parameter');return s(e,n).filter(e=>t(e.node))}function c(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function d(e){return t=>c(t.$from,e)}function a(e){return e instanceof t.NodeSelection}function f(e){return function(t){if(a(t)){const{node:n}=t,{$from:r}=t;if(o(e,n))return{node:n,pos:r.pos,depth:r.depth}}}}e.createCell=n,e.createTable=function(e,t,o,s,i){const c=r(e),d=[],a=[];for(let e=0;e<o;e+=1){const e=n(c.cell,i);if(e&&a.push(e),s){const e=n(c.header_cell,i);e&&d.push(e)}}const f=[];for(let e=0;e<t;e+=1)f.push(c.row.createChecked(null,s&&0===e?d:a));return c.table.createChecked(null,f)},e.equalNodeType=o,e.findBlockNodes=function(e,t){return i(e,e=>e.isBlock,t)},e.findChildren=i,e.findParentNode=d,e.findParentNodeClosestToPos=c,e.findSelectedNodeOfType=f,e.flatten=s,e.getMarkAttrs=function(e,t){const{from:n,to:r}=e.selection;let o=[];e.doc.nodesBetween(n,r,e=>{o=[...o,...e.marks]});const s=o.find(e=>e.type.name===t.name);return s?s.attrs:{}},e.getMarkRange=function(e=null,t=null){if(!e||!t)return!1;const n=e.parent.childAfter(e.parentOffset);if(!n.node)return!1;const r=n.node.marks.find(e=>e.type===t);if(!r)return!1;let o=e.index(),s=e.start()+n.offset,i=o+1,c=s+n.node.nodeSize;for(;o>0&&r.isInSet(e.parent.child(o-1).marks);)o-=1,s-=e.parent.child(o).nodeSize;for(;i<e.parent.childCount&&r.isInSet(e.parent.child(i).marks);)c+=e.parent.child(i).nodeSize,i+=1;return{from:s,to:c}},e.getNodeAttrs=function(e,t){const{from:n,to:r}=e.selection;let o=[];e.doc.nodesBetween(n,r,e=>{o=[...o,e]});const s=o.reverse().find(e=>e.type.name===t.name);return s?s.attrs:{}},e.getTableNodeTypes=r,e.isNodeSelection=a,e.markIsActive=function(e,t){const{from:n,$from:r,to:o,empty:s}=e.selection;return s?!!t.isInSet(e.storedMarks||r.marks()):!!e.doc.rangeHasMark(n,o,t)},e.nodeEqualsType=function({types:e,node:t}){return Array.isArray(e)&&e.includes(t.type)||t.type===e},e.nodeIsActive=function(e,t,n={}){const r=f(t)(e.selection)||d(e=>e.type===t)(e.selection);return Object.keys(n).length&&r?r.node.hasMarkup(t,{...r.node.attrs,...n}):!!r},Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "tiptap-utils",
"version": "1.13.0",
"version": "1.13.1",
"description": "Utility functions for tiptap",

@@ -27,3 +27,3 @@ "homepage": "https://tiptap.dev",

},
"gitHead": "79a217f96ca257d843d670447c1f794180133a67"
"gitHead": "b90a6a204cd81f038aaaa7b8dab3d3f651e2aa64"
}
export default function equalNodeType(nodeType, node) {
return Array.isArray(nodeType) && (nodeType.indexOf(node.type) > -1 || node.type === nodeType)
return (Array.isArray(nodeType) && nodeType.indexOf(node.type) > -1) || node.type === nodeType
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc