prosemirror-utils
Advanced tools
Comparing version 0.2.15 to 0.2.16
@@ -12,3 +12,2 @@ 'use strict'; | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -91,3 +90,2 @@ // if (isNodeSelection(tr.selection)) { | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -120,3 +118,2 @@ // const { selection: { $from } } = state; | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -145,3 +142,2 @@ // const predicate = node => node.type === schema.nodes.blockquote; | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -164,3 +160,2 @@ // const domAtPos = view.domAtPos.bind(view); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -180,3 +175,2 @@ // if (hasParentNode(node => node.type === schema.nodes.table)(selection)) { | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -196,3 +190,2 @@ // const parent = findParentNodeOfType(schema.nodes.paragraph)(selection); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -214,3 +207,2 @@ // if (hasParentNodeOfType(schema.nodes.table)(selection)) { | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -231,3 +223,2 @@ // const domAtPos = view.domAtPos.bind(view); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -257,3 +248,2 @@ // const { extension, inlineExtension, bodiedExtension } = schema.nodes; | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -268,6 +258,2 @@ // const pos = findPositionOfNodeBefore(tr.selection); | ||
// leaf node | ||
if (maybeSelection.$from.depth === 0) { | ||
return maybeSelection.$from.pos + 1; | ||
} | ||
var parent = findParentNodeOfType(nodeBefore.type)(maybeSelection); | ||
@@ -277,2 +263,3 @@ if (parent) { | ||
} | ||
return maybeSelection.$from.pos + 1; | ||
} | ||
@@ -285,3 +272,2 @@ }; | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -302,3 +288,2 @@ // const domAtPos = view.domAtPos.bind(view); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -326,3 +311,2 @@ // const children = flatten(node); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -345,3 +329,2 @@ // const textNodes = findChildren(node, child => child.isText, false); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -359,3 +342,2 @@ // const textNodes = findTextNodes(node); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -373,3 +355,2 @@ // const inlineNodes = findInlineNodes(node); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -387,3 +368,2 @@ // const blockNodes = findBlockNodes(node); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -401,3 +381,2 @@ // const mergedCells = findChildrenByAttr(table, attrs => attrs.colspan === 2); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -415,3 +394,2 @@ // const cells = findChildrenByType(table, schema.nodes.tableCell); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -429,3 +407,2 @@ // const nodes = findChildrenByMark(state.doc, schema.marks.strong); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -443,3 +420,2 @@ // if (contains(panel, schema.nodes.listItem)) { | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -457,3 +433,2 @@ // const table = findTable(selection); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -471,3 +446,2 @@ // if (isCellSelection(selection)) { | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -497,3 +471,2 @@ // const className = isColumnSelected(i)(selection) ? 'selected' : ''; | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -521,3 +494,2 @@ // const className = isRowSelected(i)(selection) ? 'selected' : ''; | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -537,3 +509,2 @@ // const className = isTableSelected(selection) ? 'selected' : ''; | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -566,3 +537,2 @@ // const cells = getCellsInColumn(i)(selection); // [{node, pos}, {node, pos}] | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -595,3 +565,2 @@ // const cells = getCellsInRow(i)(selection); // [{node, pos}, {node, pos}] | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -620,3 +589,2 @@ // const cells = getCellsInTable(selection); // [{node, pos}, {node, pos}] | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -642,3 +610,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -664,3 +631,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -684,3 +650,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -711,3 +676,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -738,3 +702,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -765,3 +728,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -793,3 +755,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -821,3 +782,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -843,3 +803,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -874,3 +833,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -905,3 +863,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -925,3 +882,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -947,3 +903,2 @@ // const node = schema.nodes.paragraph.createChecked({}, schema.text('new')); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -967,3 +922,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -995,3 +949,2 @@ // const node = schema.nodes.paragraph.createChecked({}, schema.text('new')); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -1018,3 +971,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -1065,3 +1017,2 @@ // const node = schema.nodes.extension.createChecked({}); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -1086,3 +1037,2 @@ // const node = schema.nodes.extension.createChecked({}); | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -1108,3 +1058,2 @@ // dispatch( | ||
// | ||
// Example | ||
// ```javascript | ||
@@ -1111,0 +1060,0 @@ // dispatch( |
{ | ||
"name": "prosemirror-utils", | ||
"version": "0.2.15", | ||
"version": "0.2.16", | ||
"description": "Utils library for ProseMirror", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -26,3 +26,2 @@ # Utils library for ProseMirror | ||
Example | ||
```javascript | ||
@@ -37,3 +36,2 @@ const predicate = node => node.type === schema.nodes.blockquote; | ||
Example | ||
```javascript | ||
@@ -49,3 +47,2 @@ const domAtPos = view.domAtPos.bind(view); | ||
Example | ||
```javascript | ||
@@ -61,3 +58,2 @@ if (hasParentNode(node => node.type === schema.nodes.table)(selection)) { | ||
Example | ||
```javascript | ||
@@ -71,3 +67,2 @@ const parent = findParentNodeOfType(schema.nodes.paragraph)(selection); | ||
Example | ||
```javascript | ||
@@ -83,3 +78,2 @@ if (hasParentNodeOfType(schema.nodes.table)(selection)) { | ||
Example | ||
```javascript | ||
@@ -94,3 +88,2 @@ const domAtPos = view.domAtPos.bind(view); | ||
Example | ||
```javascript | ||
@@ -109,3 +102,2 @@ const { extension, inlineExtension, bodiedExtension } = schema.nodes; | ||
Example | ||
```javascript | ||
@@ -121,3 +113,2 @@ if (isNodeSelection(tr.selection)) { | ||
Example | ||
```javascript | ||
@@ -132,3 +123,2 @@ const pos = findPositionOfNodeBefore(tr.selection); | ||
Example | ||
```javascript | ||
@@ -145,3 +135,2 @@ const domAtPos = view.domAtPos.bind(view); | ||
Example | ||
```javascript | ||
@@ -155,3 +144,2 @@ const children = flatten(node); | ||
Example | ||
```javascript | ||
@@ -165,3 +153,2 @@ const textNodes = findChildren(node, child => child.isText, false); | ||
Example | ||
```javascript | ||
@@ -175,3 +162,2 @@ const textNodes = findTextNodes(node); | ||
Example | ||
```javascript | ||
@@ -185,3 +171,2 @@ const inlineNodes = findInlineNodes(node); | ||
Example | ||
```javascript | ||
@@ -195,3 +180,2 @@ const blockNodes = findBlockNodes(node); | ||
Example | ||
```javascript | ||
@@ -205,3 +189,2 @@ const mergedCells = findChildrenByAttr(table, attrs => attrs.colspan === 2); | ||
Example | ||
```javascript | ||
@@ -215,3 +198,2 @@ const cells = findChildrenByType(table, schema.nodes.tableCell); | ||
Example | ||
```javascript | ||
@@ -225,3 +207,2 @@ const nodes = findChildrenByMark(state.doc, schema.marks.strong); | ||
Example | ||
```javascript | ||
@@ -239,3 +220,2 @@ if (contains(panel, schema.nodes.listItem)) { | ||
Example | ||
```javascript | ||
@@ -249,3 +229,2 @@ const table = findTable(selection); | ||
Example | ||
```javascript | ||
@@ -261,3 +240,2 @@ if (isCellSelection(selection)) { | ||
Example | ||
```javascript | ||
@@ -271,3 +249,2 @@ const className = isColumnSelected(i)(selection) ? 'selected' : ''; | ||
Example | ||
```javascript | ||
@@ -281,3 +258,2 @@ const className = isRowSelected(i)(selection) ? 'selected' : ''; | ||
Example | ||
```javascript | ||
@@ -291,3 +267,2 @@ const className = isTableSelected(selection) ? 'selected' : ''; | ||
Example | ||
```javascript | ||
@@ -301,3 +276,2 @@ const cells = getCellsInColumn(i)(selection); // [{node, pos}, {node, pos}] | ||
Example | ||
```javascript | ||
@@ -311,3 +285,2 @@ const cells = getCellsInRow(i)(selection); // [{node, pos}, {node, pos}] | ||
Example | ||
```javascript | ||
@@ -321,3 +294,2 @@ const cells = getCellsInTable(selection); // [{node, pos}, {node, pos}] | ||
Example | ||
```javascript | ||
@@ -333,3 +305,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -345,3 +316,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -357,3 +327,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -369,3 +338,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -381,3 +349,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -393,3 +360,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -405,3 +371,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -417,3 +382,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -429,3 +393,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -441,3 +404,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -455,3 +417,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -467,3 +428,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -481,3 +441,2 @@ const node = schema.nodes.paragraph.createChecked({}, schema.text('new')); | ||
Example | ||
```javascript | ||
@@ -494,3 +453,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -507,3 +465,2 @@ const node = schema.nodes.paragraph.createChecked({}, schema.text('new')); | ||
Example | ||
```javascript | ||
@@ -523,3 +480,2 @@ const { selection: { $from } } = state; | ||
Example | ||
```javascript | ||
@@ -536,3 +492,2 @@ const node = schema.nodes.extension.createChecked({}); | ||
Example | ||
```javascript | ||
@@ -549,3 +504,2 @@ const node = schema.nodes.extension.createChecked({}); | ||
Example | ||
```javascript | ||
@@ -561,3 +515,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -575,3 +528,2 @@ dispatch( | ||
Example | ||
```javascript | ||
@@ -578,0 +530,0 @@ dispatch( |
Sorry, the diff of this file is not supported yet
112556
1048
492