@udecode/slate
Advanced tools
Comparing version 21.4.1 to 22.0.2
@@ -158,13 +158,11 @@ import { createEditor, Editor, Element, Range, Text, Transforms, Path, Point, Node } from 'slate'; | ||
if (!predicate) return true; | ||
if (typeof predicate === 'object') { | ||
return Object.entries(predicate).every(([key, value]) => { | ||
const values = castArray_1(value); | ||
return values.includes(obj[key]); | ||
}); | ||
} | ||
return predicate(obj, path); | ||
}; | ||
/** | ||
@@ -175,3 +173,2 @@ * Extended query options for slate queries: | ||
*/ | ||
const getQueryOptions = (editor, options = {}) => { | ||
@@ -182,3 +179,4 @@ const { | ||
} = options; | ||
return { ...options, | ||
return { | ||
...options, | ||
match: _match || block ? (n, path) => match(n, path, _match) && (!block || isBlock(editor, n)) : undefined | ||
@@ -203,3 +201,2 @@ }; | ||
} = options; | ||
if (Range.isRange(range) && unhang) { | ||
@@ -227,3 +224,3 @@ return Editor.unhangRange(editor, range, { | ||
return Editor.parent(editor, at, options); | ||
} catch (err) {} | ||
} catch (error) {} | ||
}; | ||
@@ -262,3 +259,2 @@ | ||
} | ||
return node.children.length === 1 && hasSingleChild(node.children[0]); | ||
@@ -308,11 +304,8 @@ }; | ||
} = options; | ||
if (!at) { | ||
return; | ||
} | ||
if (match == null) { | ||
if (Path.isPath(at)) { | ||
const [parent] = getParentNode(editor, at); | ||
match = n => parent.children.includes(n); | ||
@@ -323,7 +316,5 @@ } else { | ||
} | ||
if (!hanging && Range.isRange(at)) { | ||
at = Editor.unhangRange(editor, at); | ||
} | ||
if (Range.isRange(at)) { | ||
@@ -339,3 +330,2 @@ if (Range.isCollapsed(at)) { | ||
at = pointRef.unref(); | ||
if (options.at == null) { | ||
@@ -346,3 +336,2 @@ select(editor, at); | ||
} | ||
const _nodes = getNodeEntries(editor, { | ||
@@ -354,3 +343,2 @@ at, | ||
}); | ||
const [current] = Array.from(_nodes); | ||
@@ -363,35 +351,31 @@ const prev = getPreviousNode(editor, { | ||
}); | ||
if (!current || !prev) { | ||
return; | ||
} | ||
const [node, path] = current; | ||
const [prevNode, prevPath] = prev; | ||
if (path.length === 0 || prevPath.length === 0) { | ||
return; | ||
} | ||
const newPath = Path.next(prevPath); | ||
const commonPath = Path.common(path, prevPath); | ||
const isPreviousSibling = Path.isSibling(path, prevPath); | ||
const _levels = Editor.levels(editor, { | ||
at: path | ||
}); | ||
const levels = new Set(Array.from(_levels, ([n]) => n).slice(commonPath.length).slice(0, -1)); | ||
const levels = Array.from(_levels, ([n]) => n).slice(commonPath.length).slice(0, -1); // Determine if the merge will leave an ancestor of the path empty as a | ||
// Determine if the merge will leave an ancestor of the path empty as a | ||
// result, in which case we'll want to remove it after merging. | ||
const emptyAncestor = getAboveNode(editor, { | ||
at: path, | ||
mode: 'highest', | ||
match: n => levels.includes(n) && isElement(n) && hasSingleChild(n) | ||
match: n => levels.has(n) && isElement(n) && hasSingleChild(n) | ||
}); | ||
const emptyRef = emptyAncestor && createPathRef(editor, emptyAncestor[1]); | ||
let properties; | ||
let position; // Ensure that the nodes are equivalent, and figure out what the position | ||
let position; | ||
// Ensure that the nodes are equivalent, and figure out what the position | ||
// and extra properties of the merge will be. | ||
if (isText(node) && isText(prevNode)) { | ||
@@ -413,22 +397,26 @@ const { | ||
throw new Error(`Cannot merge the node at path [${path}] with the previous sibling because it is not the same kind: ${JSON.stringify(node)} ${JSON.stringify(prevNode)}`); | ||
} // If the node isn't already the next sibling of the previous node, move | ||
} | ||
// If the node isn't already the next sibling of the previous node, move | ||
// it so that it is before merging. | ||
if (!isPreviousSibling && | ||
// DIFF | ||
!mergeNode) { | ||
moveNodes(editor, { | ||
at: path, | ||
to: newPath, | ||
voids | ||
}); | ||
} | ||
if (!isPreviousSibling) { | ||
// DIFF | ||
if (!mergeNode) { | ||
moveNodes(editor, { | ||
at: path, | ||
to: newPath, | ||
voids | ||
}); | ||
} | ||
} // If there was going to be an empty ancestor of the node that was merged, | ||
// If there was going to be an empty ancestor of the node that was merged, | ||
// we remove it from the tree. | ||
if (emptyRef) { | ||
// DIFF: start | ||
if (!removeEmptyAncestor) { | ||
if (removeEmptyAncestor) { | ||
const emptyPath = emptyRef.current; | ||
emptyPath && removeEmptyAncestor(editor, { | ||
at: emptyPath | ||
}); | ||
} else { | ||
removeNodes(editor, { | ||
@@ -438,10 +426,7 @@ at: emptyRef.current, | ||
}); | ||
} else { | ||
const emptyPath = emptyRef.current; | ||
emptyPath && removeEmptyAncestor(editor, { | ||
at: emptyPath | ||
}); | ||
} // DIFF: end | ||
} | ||
// DIFF: end | ||
} | ||
} // If the target node that we're merging with is empty, remove it instead | ||
// If the target node that we're merging with is empty, remove it instead | ||
// of merging the two. This is a common rich text editor behavior to | ||
@@ -451,4 +436,2 @@ // prevent losing formatting when deleting entire nodes when you have a | ||
// DIFF: start | ||
if (mergeNode) { | ||
@@ -458,3 +441,4 @@ mergeNode(editor, { | ||
to: newPath | ||
}); // DIFF: end | ||
}); | ||
// DIFF: end | ||
} else if (isElement(prevNode) && isElementEmpty(editor, prevNode) || isText(prevNode) && prevNode.text === '') { | ||
@@ -473,3 +457,2 @@ removeNodes(editor, { | ||
} | ||
if (emptyRef) { | ||
@@ -530,11 +513,8 @@ emptyRef.unref(); | ||
} = options; | ||
if (!at) { | ||
return; | ||
} | ||
if (Range.isRange(at) && Range.isCollapsed(at)) { | ||
at = at.anchor; | ||
} | ||
if (Point.isPoint(at)) { | ||
@@ -545,3 +525,2 @@ const furthestVoid = getVoidNode(editor, { | ||
}); | ||
if (!voids && furthestVoid) { | ||
@@ -563,3 +542,2 @@ const [, voidPath] = furthestVoid; | ||
} | ||
if (Path.isPath(at)) { | ||
@@ -572,7 +550,5 @@ removeNodes(editor, { | ||
} | ||
if (Range.isCollapsed(at)) { | ||
return; | ||
} | ||
if (!hanging) { | ||
@@ -583,3 +559,2 @@ at = Editor.unhangRange(editor, at, { | ||
} | ||
let [start, end] = Range.edges(at); | ||
@@ -605,7 +580,7 @@ const startBlock = getAboveNode(editor, { | ||
mode: 'highest' | ||
}); // If the start or end points are inside an inline void, nudge them out. | ||
}); | ||
// If the start or end points are inside an inline void, nudge them out. | ||
if (startVoid) { | ||
const before = getPointBefore(editor, start); | ||
if (before && startBlock && Path.isAncestor(startBlock[1], before.path)) { | ||
@@ -615,16 +590,13 @@ start = before; | ||
} | ||
if (endVoid) { | ||
const after = getPointAfter(editor, end); | ||
if (after && endBlock && Path.isAncestor(endBlock[1], after.path)) { | ||
end = after; | ||
} | ||
} // Get the highest nodes that are completely inside the range, as well as | ||
} | ||
// Get the highest nodes that are completely inside the range, as well as | ||
// the start and end nodes. | ||
const matches = []; | ||
let lastPath; | ||
const _nodes = getNodeEntries(editor, { | ||
@@ -634,10 +606,7 @@ at, | ||
}); | ||
for (const entry of _nodes) { | ||
const [node, path] = entry; | ||
if (lastPath && Path.compare(path, lastPath) === 0) { | ||
continue; | ||
} | ||
if (!voids && isVoid(editor, node) || !Path.isCommon(path, start.path) && !Path.isCommon(path, end.path)) { | ||
@@ -648,7 +617,5 @@ matches.push(entry); | ||
} | ||
const pathRefs = Array.from(matches, ([, p]) => createPathRef(editor, p)); | ||
const startRef = createPointRef(editor, start); | ||
const endRef = createPointRef(editor, end); | ||
if (!isSingleText && !startVoid) { | ||
@@ -671,3 +638,2 @@ const point = startRef.current; | ||
} | ||
for (const pathRef of pathRefs) { | ||
@@ -680,3 +646,2 @@ const path = pathRef.unref(); | ||
} | ||
if (!endVoid) { | ||
@@ -697,3 +662,2 @@ const point = endRef.current; | ||
} | ||
if (!isSingleText && isAcrossBlocks && endRef.current && startRef.current) { | ||
@@ -707,5 +671,3 @@ // DIFF: allow custom mergeNodes | ||
} | ||
const point = endRef.unref() || startRef.unref(); | ||
if (options.at == null && point) { | ||
@@ -730,3 +692,2 @@ select(editor, point); | ||
if (!at) return ''; | ||
try { | ||
@@ -775,3 +736,3 @@ return Editor.string(editor, at, options); | ||
return Editor.node(editor, at, options); | ||
} catch (err) {} | ||
} catch (error) {} | ||
}; | ||
@@ -923,2 +884,20 @@ | ||
/** | ||
* The `Descendant` union type represents nodes that are descendants in the | ||
* tree. It is returned as a convenience in certain cases to narrow a value | ||
* further than the more generic `Node` union. | ||
*/ | ||
/** | ||
* Descendant of an editor. | ||
*/ | ||
/** | ||
* A utility type to get all the descendant node types from a root node type. | ||
*/ | ||
/** | ||
* A utility type to get the child node types from a root node type. | ||
*/ | ||
const isDescendant = node => isElement(node) || isText(node); | ||
@@ -960,12 +939,9 @@ | ||
const p = path[i]; | ||
if (isText(root) || !root.children[p]) { | ||
return null; | ||
} | ||
root = root.children[p]; | ||
} | ||
return root; | ||
} catch (e) { | ||
} catch (error) { | ||
return null; | ||
@@ -1103,3 +1079,2 @@ } | ||
*/ | ||
const isCollapsed = range => !!range && Range.isCollapsed(range); | ||
@@ -1111,3 +1086,2 @@ | ||
*/ | ||
const isExpanded = range => !!range && Range.isExpanded(range); | ||
@@ -1139,3 +1113,19 @@ | ||
*/ | ||
const insertNodes = (editor, nodes, options) => Transforms.insertNodes(editor, nodes, options); | ||
const insertNodes = (editor, nodes, options) => { | ||
if (options !== null && options !== void 0 && options.nextBlock) { | ||
const at = (options === null || options === void 0 ? void 0 : options.at) || editor.selection; | ||
if (at) { | ||
const endPoint = getEndPoint(editor, at); | ||
const blockEntry = getAboveNode(editor, { | ||
at: endPoint, | ||
block: true | ||
}); | ||
if (blockEntry) { | ||
const nextPath = Path.next(blockEntry[1]); | ||
options.at = nextPath; | ||
} | ||
} | ||
} | ||
Transforms.insertNodes(editor, nodes, options); | ||
}; | ||
@@ -1222,6 +1212,4 @@ /** | ||
const [node, path] = entry; | ||
if (level) { | ||
const levels = castArray_1(level); | ||
if (!levels.includes(path.length)) { | ||
@@ -1231,29 +1219,20 @@ return false; | ||
} | ||
if (maxLevel) { | ||
if (path.length > maxLevel) { | ||
return false; | ||
} | ||
if (maxLevel && path.length > maxLevel) { | ||
return false; | ||
} | ||
if (filter && !filter(entry)) { | ||
return false; | ||
} | ||
if (allow) { | ||
const allows = castArray_1(allow); | ||
if (allows.length && !allows.includes(node.type)) { | ||
if (allows.length > 0 && !allows.includes(node.type)) { | ||
return false; | ||
} | ||
} | ||
if (exclude) { | ||
const excludes = castArray_1(exclude); | ||
if (excludes.length && excludes.includes(node.type)) { | ||
if (excludes.length > 0 && excludes.includes(node.type)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
@@ -1273,2 +1252,3 @@ }; | ||
// eslint-disable-next-line no-unreachable-loop | ||
for (const [node, path] of nodeEntries) { | ||
@@ -1286,3 +1266,2 @@ return [node, path]; | ||
*/ | ||
const someNode = (editor, options) => { | ||
@@ -1302,3 +1281,2 @@ return !!findNode(editor, options); | ||
} | ||
const match = (node, path) => { | ||
@@ -1314,6 +1292,4 @@ if (!Text.isText(node)) { | ||
}; | ||
const isExpandedRange = Range.isExpanded(at); | ||
let markAcceptingVoidSelected = false; | ||
if (!isExpandedRange) { | ||
@@ -1323,3 +1299,2 @@ const selectedEntry = Editor.node(editor, at); | ||
const [selectedNode, selectedPath] = selectedEntry; | ||
if (selectedNode && match(selectedNode, selectedPath)) { | ||
@@ -1332,3 +1307,2 @@ const parentEntry = Editor.parent(editor, selectedPath); | ||
} | ||
if (isExpandedRange || markAcceptingVoidSelected) { | ||
@@ -1341,3 +1315,4 @@ Transforms.setNodes(editor, props, { | ||
}); | ||
} // else { | ||
} | ||
// else { | ||
// const marks = { | ||
@@ -1353,3 +1328,2 @@ // ...(Editor.marks(editor as any) || {}), | ||
// } | ||
} | ||
@@ -1363,10 +1337,7 @@ }; | ||
*/ | ||
const unhangCharacterRange = (editor, at) => { | ||
let [start, end] = Range.edges(at); | ||
if (!Path.equals(start.path, end.path)) { | ||
if (end.offset === 0) { | ||
const pointAfter = getPointAfter(editor, start); | ||
if (pointAfter) { | ||
@@ -1377,3 +1348,2 @@ end = pointAfter; | ||
const pointBefore = getPointBefore(editor, end); | ||
if (pointBefore) { | ||
@@ -1384,3 +1354,2 @@ start = pointBefore; | ||
} | ||
return { | ||
@@ -1387,0 +1356,0 @@ anchor: start, |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var slate = require('slate'); | ||
@@ -162,13 +160,11 @@ var slateHistory = require('slate-history'); | ||
if (!predicate) return true; | ||
if (typeof predicate === 'object') { | ||
return Object.entries(predicate).every(([key, value]) => { | ||
const values = castArray_1(value); | ||
return values.includes(obj[key]); | ||
}); | ||
} | ||
return predicate(obj, path); | ||
}; | ||
/** | ||
@@ -179,3 +175,2 @@ * Extended query options for slate queries: | ||
*/ | ||
const getQueryOptions = (editor, options = {}) => { | ||
@@ -186,3 +181,4 @@ const { | ||
} = options; | ||
return { ...options, | ||
return { | ||
...options, | ||
match: _match || block ? (n, path) => match(n, path, _match) && (!block || isBlock(editor, n)) : undefined | ||
@@ -207,3 +203,2 @@ }; | ||
} = options; | ||
if (slate.Range.isRange(range) && unhang) { | ||
@@ -231,3 +226,3 @@ return slate.Editor.unhangRange(editor, range, { | ||
return slate.Editor.parent(editor, at, options); | ||
} catch (err) {} | ||
} catch (error) {} | ||
}; | ||
@@ -266,3 +261,2 @@ | ||
} | ||
return node.children.length === 1 && hasSingleChild(node.children[0]); | ||
@@ -312,11 +306,8 @@ }; | ||
} = options; | ||
if (!at) { | ||
return; | ||
} | ||
if (match == null) { | ||
if (slate.Path.isPath(at)) { | ||
const [parent] = getParentNode(editor, at); | ||
match = n => parent.children.includes(n); | ||
@@ -327,7 +318,5 @@ } else { | ||
} | ||
if (!hanging && slate.Range.isRange(at)) { | ||
at = slate.Editor.unhangRange(editor, at); | ||
} | ||
if (slate.Range.isRange(at)) { | ||
@@ -343,3 +332,2 @@ if (slate.Range.isCollapsed(at)) { | ||
at = pointRef.unref(); | ||
if (options.at == null) { | ||
@@ -350,3 +338,2 @@ select(editor, at); | ||
} | ||
const _nodes = getNodeEntries(editor, { | ||
@@ -358,3 +345,2 @@ at, | ||
}); | ||
const [current] = Array.from(_nodes); | ||
@@ -367,35 +353,31 @@ const prev = getPreviousNode(editor, { | ||
}); | ||
if (!current || !prev) { | ||
return; | ||
} | ||
const [node, path] = current; | ||
const [prevNode, prevPath] = prev; | ||
if (path.length === 0 || prevPath.length === 0) { | ||
return; | ||
} | ||
const newPath = slate.Path.next(prevPath); | ||
const commonPath = slate.Path.common(path, prevPath); | ||
const isPreviousSibling = slate.Path.isSibling(path, prevPath); | ||
const _levels = slate.Editor.levels(editor, { | ||
at: path | ||
}); | ||
const levels = new Set(Array.from(_levels, ([n]) => n).slice(commonPath.length).slice(0, -1)); | ||
const levels = Array.from(_levels, ([n]) => n).slice(commonPath.length).slice(0, -1); // Determine if the merge will leave an ancestor of the path empty as a | ||
// Determine if the merge will leave an ancestor of the path empty as a | ||
// result, in which case we'll want to remove it after merging. | ||
const emptyAncestor = getAboveNode(editor, { | ||
at: path, | ||
mode: 'highest', | ||
match: n => levels.includes(n) && isElement(n) && hasSingleChild(n) | ||
match: n => levels.has(n) && isElement(n) && hasSingleChild(n) | ||
}); | ||
const emptyRef = emptyAncestor && createPathRef(editor, emptyAncestor[1]); | ||
let properties; | ||
let position; // Ensure that the nodes are equivalent, and figure out what the position | ||
let position; | ||
// Ensure that the nodes are equivalent, and figure out what the position | ||
// and extra properties of the merge will be. | ||
if (isText(node) && isText(prevNode)) { | ||
@@ -417,22 +399,26 @@ const { | ||
throw new Error(`Cannot merge the node at path [${path}] with the previous sibling because it is not the same kind: ${JSON.stringify(node)} ${JSON.stringify(prevNode)}`); | ||
} // If the node isn't already the next sibling of the previous node, move | ||
} | ||
// If the node isn't already the next sibling of the previous node, move | ||
// it so that it is before merging. | ||
if (!isPreviousSibling && | ||
// DIFF | ||
!mergeNode) { | ||
moveNodes(editor, { | ||
at: path, | ||
to: newPath, | ||
voids | ||
}); | ||
} | ||
if (!isPreviousSibling) { | ||
// DIFF | ||
if (!mergeNode) { | ||
moveNodes(editor, { | ||
at: path, | ||
to: newPath, | ||
voids | ||
}); | ||
} | ||
} // If there was going to be an empty ancestor of the node that was merged, | ||
// If there was going to be an empty ancestor of the node that was merged, | ||
// we remove it from the tree. | ||
if (emptyRef) { | ||
// DIFF: start | ||
if (!removeEmptyAncestor) { | ||
if (removeEmptyAncestor) { | ||
const emptyPath = emptyRef.current; | ||
emptyPath && removeEmptyAncestor(editor, { | ||
at: emptyPath | ||
}); | ||
} else { | ||
removeNodes(editor, { | ||
@@ -442,10 +428,7 @@ at: emptyRef.current, | ||
}); | ||
} else { | ||
const emptyPath = emptyRef.current; | ||
emptyPath && removeEmptyAncestor(editor, { | ||
at: emptyPath | ||
}); | ||
} // DIFF: end | ||
} | ||
// DIFF: end | ||
} | ||
} // If the target node that we're merging with is empty, remove it instead | ||
// If the target node that we're merging with is empty, remove it instead | ||
// of merging the two. This is a common rich text editor behavior to | ||
@@ -455,4 +438,2 @@ // prevent losing formatting when deleting entire nodes when you have a | ||
// DIFF: start | ||
if (mergeNode) { | ||
@@ -462,3 +443,4 @@ mergeNode(editor, { | ||
to: newPath | ||
}); // DIFF: end | ||
}); | ||
// DIFF: end | ||
} else if (isElement(prevNode) && isElementEmpty(editor, prevNode) || isText(prevNode) && prevNode.text === '') { | ||
@@ -477,3 +459,2 @@ removeNodes(editor, { | ||
} | ||
if (emptyRef) { | ||
@@ -534,11 +515,8 @@ emptyRef.unref(); | ||
} = options; | ||
if (!at) { | ||
return; | ||
} | ||
if (slate.Range.isRange(at) && slate.Range.isCollapsed(at)) { | ||
at = at.anchor; | ||
} | ||
if (slate.Point.isPoint(at)) { | ||
@@ -549,3 +527,2 @@ const furthestVoid = getVoidNode(editor, { | ||
}); | ||
if (!voids && furthestVoid) { | ||
@@ -567,3 +544,2 @@ const [, voidPath] = furthestVoid; | ||
} | ||
if (slate.Path.isPath(at)) { | ||
@@ -576,7 +552,5 @@ removeNodes(editor, { | ||
} | ||
if (slate.Range.isCollapsed(at)) { | ||
return; | ||
} | ||
if (!hanging) { | ||
@@ -587,3 +561,2 @@ at = slate.Editor.unhangRange(editor, at, { | ||
} | ||
let [start, end] = slate.Range.edges(at); | ||
@@ -609,7 +582,7 @@ const startBlock = getAboveNode(editor, { | ||
mode: 'highest' | ||
}); // If the start or end points are inside an inline void, nudge them out. | ||
}); | ||
// If the start or end points are inside an inline void, nudge them out. | ||
if (startVoid) { | ||
const before = getPointBefore(editor, start); | ||
if (before && startBlock && slate.Path.isAncestor(startBlock[1], before.path)) { | ||
@@ -619,16 +592,13 @@ start = before; | ||
} | ||
if (endVoid) { | ||
const after = getPointAfter(editor, end); | ||
if (after && endBlock && slate.Path.isAncestor(endBlock[1], after.path)) { | ||
end = after; | ||
} | ||
} // Get the highest nodes that are completely inside the range, as well as | ||
} | ||
// Get the highest nodes that are completely inside the range, as well as | ||
// the start and end nodes. | ||
const matches = []; | ||
let lastPath; | ||
const _nodes = getNodeEntries(editor, { | ||
@@ -638,10 +608,7 @@ at, | ||
}); | ||
for (const entry of _nodes) { | ||
const [node, path] = entry; | ||
if (lastPath && slate.Path.compare(path, lastPath) === 0) { | ||
continue; | ||
} | ||
if (!voids && isVoid(editor, node) || !slate.Path.isCommon(path, start.path) && !slate.Path.isCommon(path, end.path)) { | ||
@@ -652,7 +619,5 @@ matches.push(entry); | ||
} | ||
const pathRefs = Array.from(matches, ([, p]) => createPathRef(editor, p)); | ||
const startRef = createPointRef(editor, start); | ||
const endRef = createPointRef(editor, end); | ||
if (!isSingleText && !startVoid) { | ||
@@ -675,3 +640,2 @@ const point = startRef.current; | ||
} | ||
for (const pathRef of pathRefs) { | ||
@@ -684,3 +648,2 @@ const path = pathRef.unref(); | ||
} | ||
if (!endVoid) { | ||
@@ -701,3 +664,2 @@ const point = endRef.current; | ||
} | ||
if (!isSingleText && isAcrossBlocks && endRef.current && startRef.current) { | ||
@@ -711,5 +673,3 @@ // DIFF: allow custom mergeNodes | ||
} | ||
const point = endRef.unref() || startRef.unref(); | ||
if (options.at == null && point) { | ||
@@ -734,3 +694,2 @@ select(editor, point); | ||
if (!at) return ''; | ||
try { | ||
@@ -779,3 +738,3 @@ return slate.Editor.string(editor, at, options); | ||
return slate.Editor.node(editor, at, options); | ||
} catch (err) {} | ||
} catch (error) {} | ||
}; | ||
@@ -927,2 +886,20 @@ | ||
/** | ||
* The `Descendant` union type represents nodes that are descendants in the | ||
* tree. It is returned as a convenience in certain cases to narrow a value | ||
* further than the more generic `Node` union. | ||
*/ | ||
/** | ||
* Descendant of an editor. | ||
*/ | ||
/** | ||
* A utility type to get all the descendant node types from a root node type. | ||
*/ | ||
/** | ||
* A utility type to get the child node types from a root node type. | ||
*/ | ||
const isDescendant = node => isElement(node) || isText(node); | ||
@@ -964,12 +941,9 @@ | ||
const p = path[i]; | ||
if (isText(root) || !root.children[p]) { | ||
return null; | ||
} | ||
root = root.children[p]; | ||
} | ||
return root; | ||
} catch (e) { | ||
} catch (error) { | ||
return null; | ||
@@ -1107,3 +1081,2 @@ } | ||
*/ | ||
const isCollapsed = range => !!range && slate.Range.isCollapsed(range); | ||
@@ -1115,3 +1088,2 @@ | ||
*/ | ||
const isExpanded = range => !!range && slate.Range.isExpanded(range); | ||
@@ -1143,3 +1115,19 @@ | ||
*/ | ||
const insertNodes = (editor, nodes, options) => slate.Transforms.insertNodes(editor, nodes, options); | ||
const insertNodes = (editor, nodes, options) => { | ||
if (options !== null && options !== void 0 && options.nextBlock) { | ||
const at = (options === null || options === void 0 ? void 0 : options.at) || editor.selection; | ||
if (at) { | ||
const endPoint = getEndPoint(editor, at); | ||
const blockEntry = getAboveNode(editor, { | ||
at: endPoint, | ||
block: true | ||
}); | ||
if (blockEntry) { | ||
const nextPath = slate.Path.next(blockEntry[1]); | ||
options.at = nextPath; | ||
} | ||
} | ||
} | ||
slate.Transforms.insertNodes(editor, nodes, options); | ||
}; | ||
@@ -1226,6 +1214,4 @@ /** | ||
const [node, path] = entry; | ||
if (level) { | ||
const levels = castArray_1(level); | ||
if (!levels.includes(path.length)) { | ||
@@ -1235,29 +1221,20 @@ return false; | ||
} | ||
if (maxLevel) { | ||
if (path.length > maxLevel) { | ||
return false; | ||
} | ||
if (maxLevel && path.length > maxLevel) { | ||
return false; | ||
} | ||
if (filter && !filter(entry)) { | ||
return false; | ||
} | ||
if (allow) { | ||
const allows = castArray_1(allow); | ||
if (allows.length && !allows.includes(node.type)) { | ||
if (allows.length > 0 && !allows.includes(node.type)) { | ||
return false; | ||
} | ||
} | ||
if (exclude) { | ||
const excludes = castArray_1(exclude); | ||
if (excludes.length && excludes.includes(node.type)) { | ||
if (excludes.length > 0 && excludes.includes(node.type)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
@@ -1277,2 +1254,3 @@ }; | ||
// eslint-disable-next-line no-unreachable-loop | ||
for (const [node, path] of nodeEntries) { | ||
@@ -1290,3 +1268,2 @@ return [node, path]; | ||
*/ | ||
const someNode = (editor, options) => { | ||
@@ -1306,3 +1283,2 @@ return !!findNode(editor, options); | ||
} | ||
const match = (node, path) => { | ||
@@ -1318,6 +1294,4 @@ if (!slate.Text.isText(node)) { | ||
}; | ||
const isExpandedRange = slate.Range.isExpanded(at); | ||
let markAcceptingVoidSelected = false; | ||
if (!isExpandedRange) { | ||
@@ -1327,3 +1301,2 @@ const selectedEntry = slate.Editor.node(editor, at); | ||
const [selectedNode, selectedPath] = selectedEntry; | ||
if (selectedNode && match(selectedNode, selectedPath)) { | ||
@@ -1336,3 +1309,2 @@ const parentEntry = slate.Editor.parent(editor, selectedPath); | ||
} | ||
if (isExpandedRange || markAcceptingVoidSelected) { | ||
@@ -1345,3 +1317,4 @@ slate.Transforms.setNodes(editor, props, { | ||
}); | ||
} // else { | ||
} | ||
// else { | ||
// const marks = { | ||
@@ -1357,3 +1330,2 @@ // ...(Editor.marks(editor as any) || {}), | ||
// } | ||
} | ||
@@ -1367,10 +1339,7 @@ }; | ||
*/ | ||
const unhangCharacterRange = (editor, at) => { | ||
let [start, end] = slate.Range.edges(at); | ||
if (!slate.Path.equals(start.path, end.path)) { | ||
if (end.offset === 0) { | ||
const pointAfter = getPointAfter(editor, start); | ||
if (pointAfter) { | ||
@@ -1381,3 +1350,2 @@ end = pointAfter; | ||
const pointBefore = getPointBefore(editor, end); | ||
if (pointBefore) { | ||
@@ -1388,3 +1356,2 @@ start = pointBefore; | ||
} | ||
return { | ||
@@ -1391,0 +1358,0 @@ anchor: start, |
@@ -8,3 +8,3 @@ import { Path } from 'slate'; | ||
*/ | ||
export declare const createPathRef: <V extends Value>(editor: TEditor<V>, at: Path, options?: EditorPathRefOptions | undefined) => import("slate").PathRef; | ||
export declare const createPathRef: <V extends Value>(editor: TEditor<V>, at: Path, options?: EditorPathRefOptions) => import("slate").PathRef; | ||
//# sourceMappingURL=createPathRef.d.ts.map |
@@ -8,3 +8,3 @@ import { Point } from 'slate'; | ||
*/ | ||
export declare const createPointRef: <V extends Value>(editor: TEditor<V>, point: Point, options?: EditorPointRefOptions | undefined) => import("slate").PointRef; | ||
export declare const createPointRef: <V extends Value>(editor: TEditor<V>, point: Point, options?: EditorPointRefOptions) => import("slate").PointRef; | ||
//# sourceMappingURL=createPointRef.d.ts.map |
@@ -8,3 +8,3 @@ import { Range } from 'slate'; | ||
*/ | ||
export declare const createRangeRef: <V extends Value>(editor: TEditor<V>, range: Range, options?: EditorRangeRefOptions | undefined) => import("slate").RangeRef; | ||
export declare const createRangeRef: <V extends Value>(editor: TEditor<V>, range: Range, options?: EditorRangeRefOptions) => import("slate").RangeRef; | ||
//# sourceMappingURL=createRangeRef.d.ts.map |
@@ -6,3 +6,3 @@ import { EditorDirectedDeletionOptions } from 'slate/dist/interfaces/editor'; | ||
*/ | ||
export declare const deleteBackward: <V extends Value>(editor: TEditor<V>, options?: EditorDirectedDeletionOptions | undefined) => void; | ||
export declare const deleteBackward: <V extends Value>(editor: TEditor<V>, options?: EditorDirectedDeletionOptions) => void; | ||
//# sourceMappingURL=deleteBackward.d.ts.map |
@@ -6,3 +6,3 @@ import { EditorDirectedDeletionOptions } from 'slate/dist/interfaces/editor'; | ||
*/ | ||
export declare const deleteForward: <V extends Value>(editor: TEditor<V>, options?: EditorDirectedDeletionOptions | undefined) => void; | ||
export declare const deleteForward: <V extends Value>(editor: TEditor<V>, options?: EditorDirectedDeletionOptions) => void; | ||
//# sourceMappingURL=deleteForward.d.ts.map |
@@ -6,3 +6,3 @@ import { EditorFragmentDeletionOptions } from 'slate/dist/interfaces/editor'; | ||
*/ | ||
export declare const deleteFragment: <V extends Value>(editor: TEditor<V>, options?: EditorFragmentDeletionOptions | undefined) => void; | ||
export declare const deleteFragment: <V extends Value>(editor: TEditor<V>, options?: EditorFragmentDeletionOptions) => void; | ||
//# sourceMappingURL=deleteFragment.d.ts.map |
import { Modify } from '@udecode/utils'; | ||
import { EditorAboveOptions } from 'slate/dist/interfaces/editor'; | ||
import { ENodeMatchOptions } from '../../utils/match'; | ||
import { TAncestor } from '../node/TAncestor'; | ||
import { EAncestor, TAncestor } from '../node/TAncestor'; | ||
import { TNodeEntry } from '../node/TNodeEntry'; | ||
import { TEditor, Value } from './TEditor'; | ||
export declare type GetAboveNodeOptions<V extends Value = Value> = Modify<NonNullable<EditorAboveOptions<TAncestor>>, ENodeMatchOptions<V>>; | ||
export type GetAboveNodeOptions<V extends Value = Value> = Modify<NonNullable<EditorAboveOptions<TAncestor>>, ENodeMatchOptions<V>>; | ||
/** | ||
* Get the ancestor above a location in the document. | ||
*/ | ||
export declare const getAboveNode: <N extends import("../node/TAncestor").AncestorOf<TEditor<V>>, V extends Value = Value>(editor: TEditor<V>, options?: GetAboveNodeOptions<V> | undefined) => TNodeEntry<N> | undefined; | ||
export declare const getAboveNode: <N extends EAncestor<V>, V extends Value = Value>(editor: TEditor<V>, options?: GetAboveNodeOptions<V> | undefined) => TNodeEntry<N> | undefined; | ||
//# sourceMappingURL=getAboveNode.d.ts.map |
@@ -10,3 +10,3 @@ import { Location } from 'slate'; | ||
*/ | ||
export declare const getEditorString: <V extends Value>(editor: TEditor<V>, at: Location | null | undefined, options?: EditorStringOptions | undefined) => string; | ||
export declare const getEditorString: <V extends Value>(editor: TEditor<V>, at: Location | null | undefined, options?: EditorStringOptions) => string; | ||
//# sourceMappingURL=getEditorString.d.ts.map |
@@ -8,3 +8,3 @@ import { Location } from 'slate'; | ||
*/ | ||
export declare const getLeafNode: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorLeafOptions | undefined) => ETextEntry<V>; | ||
export declare const getLeafNode: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorLeafOptions) => ETextEntry<V>; | ||
//# sourceMappingURL=getLeafNode.d.ts.map |
@@ -6,3 +6,3 @@ import { Modify } from '@udecode/utils'; | ||
import { TEditor, Value } from './TEditor'; | ||
export declare type GetLevelsOptions<V extends Value = Value> = Modify<NonNullable<EditorLevelsOptions<TNode>>, { | ||
export type GetLevelsOptions<V extends Value = Value> = Modify<NonNullable<EditorLevelsOptions<TNode>>, { | ||
match?: TNodeMatch<ENode<V>>; | ||
@@ -9,0 +9,0 @@ }>; |
@@ -0,1 +1,2 @@ | ||
import { EMarks } from '../text/TText'; | ||
import { TEditor, Value } from './TEditor'; | ||
@@ -5,3 +6,3 @@ /** | ||
*/ | ||
export declare const getMarks: <V extends Value>(editor: TEditor<V>) => import("@udecode/utils").Simplify<import("@udecode/utils").UnionToIntersection<import("..").TNodeProps<import("../text/TText").TextOf<TEditor<V>>>>> | null; | ||
export declare const getMarks: <V extends Value>(editor: TEditor<V>) => EMarks<V> | null; | ||
//# sourceMappingURL=getMarks.d.ts.map |
@@ -7,3 +7,3 @@ import { Modify } from '@udecode/utils'; | ||
import { TEditor, Value } from './TEditor'; | ||
export declare type GetNextNodeOptions<V extends Value = Value> = Modify<NonNullable<EditorNextOptions<TDescendant>>, { | ||
export type GetNextNodeOptions<V extends Value = Value> = Modify<NonNullable<EditorNextOptions<TDescendant>>, { | ||
match?: TNodeMatch<ENode<V>>; | ||
@@ -10,0 +10,0 @@ }>; |
@@ -8,3 +8,3 @@ import { Modify } from '@udecode/utils'; | ||
import { UnhangRangeOptions } from './unhangRange'; | ||
export declare type GetNodeEntriesOptions<V extends Value = Value> = Modify<NonNullable<EditorNodesOptions<TNode>>, ENodeMatchOptions<V>> & UnhangRangeOptions; | ||
export type GetNodeEntriesOptions<V extends Value = Value> = Modify<NonNullable<EditorNodesOptions<TNode>>, ENodeMatchOptions<V>> & UnhangRangeOptions; | ||
/** | ||
@@ -11,0 +11,0 @@ * Iterate through all of the nodes in the Editor. |
@@ -8,3 +8,3 @@ import { EditorNodeOptions, Location } from 'slate'; | ||
*/ | ||
export declare const getNodeEntry: <N extends ENode<V>, V extends Value = Value>(editor: TEditor<V>, at: Location, options?: EditorNodeOptions | undefined) => TNodeEntry<N> | undefined; | ||
export declare const getNodeEntry: <N extends ENode<V>, V extends Value = Value>(editor: TEditor<V>, at: Location, options?: EditorNodeOptions) => TNodeEntry<N> | undefined; | ||
//# sourceMappingURL=getNodeEntry.d.ts.map |
import { EditorParentOptions, Location } from 'slate'; | ||
import { EAncestor } from '../node/TAncestor'; | ||
import { TNodeEntry } from '../node/TNodeEntry'; | ||
@@ -8,3 +9,3 @@ import { TEditor, Value } from './TEditor'; | ||
*/ | ||
export declare const getParentNode: <N extends import("../node/TAncestor").AncestorOf<TEditor<V>>, V extends Value = Value>(editor: TEditor<V>, at: Location, options?: EditorParentOptions | undefined) => TNodeEntry<N> | undefined; | ||
export declare const getParentNode: <N extends EAncestor<V>, V extends Value = Value>(editor: TEditor<V>, at: Location, options?: EditorParentOptions) => TNodeEntry<N> | undefined; | ||
//# sourceMappingURL=getParentNode.d.ts.map |
@@ -6,3 +6,3 @@ import { EditorPathOptions, Location } from 'slate'; | ||
*/ | ||
export declare const getPath: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorPathOptions | undefined) => import("slate").Path; | ||
export declare const getPath: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorPathOptions) => import("slate").Path; | ||
//# sourceMappingURL=getPath.d.ts.map |
@@ -6,3 +6,3 @@ import { EditorPointOptions, Location } from 'slate'; | ||
*/ | ||
export declare const getPoint: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorPointOptions | undefined) => import("slate").BasePoint; | ||
export declare const getPoint: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorPointOptions) => import("slate").BasePoint; | ||
//# sourceMappingURL=getPoint.d.ts.map |
@@ -6,3 +6,3 @@ import { EditorAfterOptions, Location } from 'slate'; | ||
*/ | ||
export declare const getPointAfter: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorAfterOptions | undefined) => import("slate").BasePoint | undefined; | ||
export declare const getPointAfter: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorAfterOptions) => import("slate").BasePoint | undefined; | ||
//# sourceMappingURL=getPointAfter.d.ts.map |
@@ -6,3 +6,3 @@ import { EditorBeforeOptions, Location } from 'slate'; | ||
*/ | ||
export declare const getPointBefore: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorBeforeOptions | undefined) => import("slate").BasePoint | undefined; | ||
export declare const getPointBefore: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorBeforeOptions) => import("slate").BasePoint | undefined; | ||
//# sourceMappingURL=getPointBefore.d.ts.map |
@@ -15,3 +15,3 @@ import { EditorPositionsOptions } from 'slate'; | ||
*/ | ||
export declare const getPositions: <V extends Value>(editor: TEditor<V>, options?: EditorPositionsOptions | undefined) => Generator<import("slate").BasePoint, void, undefined>; | ||
export declare const getPositions: <V extends Value>(editor: TEditor<V>, options?: EditorPositionsOptions) => Generator<import("slate").BasePoint, void, undefined>; | ||
//# sourceMappingURL=getPositions.d.ts.map |
@@ -6,3 +6,3 @@ import { Modify } from '@udecode/utils'; | ||
import { TEditor, Value } from './TEditor'; | ||
export declare type GetPreviousNodeOptions<V extends Value = Value> = Modify<NonNullable<EditorPreviousOptions<TNode>>, { | ||
export type GetPreviousNodeOptions<V extends Value = Value> = Modify<NonNullable<EditorPreviousOptions<TNode>>, { | ||
match?: TNodeMatch<ENode<V>>; | ||
@@ -9,0 +9,0 @@ }>; |
@@ -6,3 +6,3 @@ import { Location } from 'slate'; | ||
*/ | ||
export declare const getRange: <V extends Value>(editor: TEditor<V>, at: Location, to?: Location | undefined) => import("slate").BaseRange; | ||
export declare const getRange: <V extends Value>(editor: TEditor<V>, at: Location, to?: Location) => import("slate").BaseRange; | ||
//# sourceMappingURL=getRange.d.ts.map |
import { EditorVoidOptions } from 'slate'; | ||
import { EElement } from '../element/TElement'; | ||
import { TNodeEntry } from '../node/TNodeEntry'; | ||
@@ -7,3 +8,3 @@ import { TEditor, Value } from './TEditor'; | ||
*/ | ||
export declare const getVoidNode: <N extends import("../element/TElement").ElementOf<TEditor<V>>, V extends Value = Value>(editor: TEditor<V>, options?: EditorVoidOptions | undefined) => TNodeEntry<N> | undefined; | ||
export declare const getVoidNode: <N extends EElement<V>, V extends Value = Value>(editor: TEditor<V>, options?: EditorVoidOptions) => TNodeEntry<N> | undefined; | ||
//# sourceMappingURL=getVoidNode.d.ts.map |
@@ -5,3 +5,3 @@ import { TEditor } from './TEditor'; | ||
*/ | ||
export declare const isEditor: (value: any) => value is TEditor<import("./TEditor").Value>; | ||
export declare const isEditor: (value: any) => value is TEditor; | ||
//# sourceMappingURL=isEditor.d.ts.map |
@@ -6,3 +6,3 @@ import { EElement } from '../element/TElement'; | ||
*/ | ||
export declare const isElementEmpty: <V extends Value>(editor: TEditor<V>, element: import("../element/TElement").ElementOf<TEditor<V>>) => boolean; | ||
export declare const isElementEmpty: <V extends Value>(editor: TEditor<V>, element: EElement<V>) => boolean; | ||
//# sourceMappingURL=isElementEmpty.d.ts.map |
@@ -6,3 +6,3 @@ import { EditorNormalizeOptions } from 'slate'; | ||
*/ | ||
export declare const normalizeEditor: <V extends Value>(editor: TEditor<V>, options?: EditorNormalizeOptions | undefined) => void; | ||
export declare const normalizeEditor: <V extends Value>(editor: TEditor<V>, options?: EditorNormalizeOptions) => void; | ||
//# sourceMappingURL=normalizeEditor.d.ts.map |
@@ -8,8 +8,8 @@ import { Modify, UnknownObject } from '@udecode/utils'; | ||
import { TNodeEntry } from '../node/TNodeEntry'; | ||
export declare type Value = TElement[]; | ||
export type Value = TElement[]; | ||
/** | ||
* A helper type for getting the value of an editor. | ||
*/ | ||
export declare type ValueOf<E extends TEditor> = E['children']; | ||
export declare type TEditor<V extends Value = Value> = Modify<Editor, { | ||
export type ValueOf<E extends TEditor> = E['children']; | ||
export type TEditor<V extends Value = Value> = Modify<Editor, { | ||
id: any; | ||
@@ -35,4 +35,4 @@ children: V; | ||
operations: TOperation<EElementOrText<V>>[]; | ||
isInline: (element: import("../element/TElement").ElementOf<TEditor<V>>) => boolean; | ||
isVoid: (element: import("../element/TElement").ElementOf<TEditor<V>>) => boolean; | ||
isInline: (element: EElement<V>) => boolean; | ||
isVoid: (element: EElement<V>) => boolean; | ||
normalizeNode: (entry: TNodeEntry<ENode<V>>) => void; | ||
@@ -39,0 +39,0 @@ apply: (operation: TOperation<EElementOrText<V>>) => void; |
@@ -1,4 +0,4 @@ | ||
import { EditorUnhangRangeOptions, Path, Span } from 'slate'; | ||
import { EditorUnhangRangeOptions, Path, Point, Range, Span } from 'slate'; | ||
import { TEditor, Value } from './TEditor'; | ||
export declare type UnhangRangeOptions = EditorUnhangRangeOptions & { | ||
export type UnhangRangeOptions = EditorUnhangRangeOptions & { | ||
unhang?: boolean; | ||
@@ -11,3 +11,3 @@ }; | ||
*/ | ||
export declare const unhangRange: <V extends Value>(editor: TEditor<V>, range?: Path | import("slate").BasePoint | import("slate").BaseRange | Span | null | undefined, options?: UnhangRangeOptions) => import("slate").BaseRange | undefined; | ||
export declare const unhangRange: <V extends Value>(editor: TEditor<V>, range?: Range | Path | Point | Span | null, options?: UnhangRangeOptions) => import("slate").BaseRange | undefined; | ||
//# sourceMappingURL=unhangRange.d.ts.map |
@@ -18,7 +18,7 @@ import { UnknownObject } from '@udecode/utils'; | ||
*/ | ||
export declare type EElement<V extends Value> = ElementOf<TEditor<V>>; | ||
export type EElement<V extends Value> = ElementOf<TEditor<V>>; | ||
/** | ||
* Element or text of an editor. Differs from EDescendant<V>. | ||
*/ | ||
export declare type EElementOrText<V extends Value> = EElement<V> | EText<V>; | ||
export type EElementOrText<V extends Value> = EElement<V> | EText<V>; | ||
/** | ||
@@ -31,3 +31,3 @@ * `ElementEntry` objects refer to an `Element` and the `Path` where it can be | ||
*/ | ||
export declare type ElementOf<N extends TNode> = TEditor extends N ? TElement : TElement extends N ? TElement : N extends TEditor ? Extract<N['children'][number], TElement> | ElementOf<N['children'][number]> : N extends TElement ? N | Extract<N['children'][number], TElement> | ElementOf<N['children'][number]> : never; | ||
export type ElementOf<N extends TNode> = TEditor extends N ? TElement : TElement extends N ? TElement : N extends TEditor ? Extract<N['children'][number], TElement> | ElementOf<N['children'][number]> : N extends TElement ? N | Extract<N['children'][number], TElement> | ElementOf<N['children'][number]> : never; | ||
//# sourceMappingURL=TElement.d.ts.map |
@@ -5,3 +5,3 @@ import { THistoryEditor } from './THistoryEditor'; | ||
*/ | ||
export declare const isHistoryEditor: (value: any) => value is THistoryEditor<import("..").Value>; | ||
export declare const isHistoryEditor: (value: any) => value is THistoryEditor; | ||
//# sourceMappingURL=isHistoryEditor.d.ts.map |
import { HistoryEditor } from 'slate-history'; | ||
import { TEditor, Value } from '../editor/TEditor'; | ||
export declare type THistoryEditor<V extends Value = Value> = TEditor<V> & Pick<HistoryEditor, 'history' | 'undo' | 'redo'>; | ||
export type THistoryEditor<V extends Value = Value> = TEditor<V> & Pick<HistoryEditor, 'history' | 'undo' | 'redo'>; | ||
//# sourceMappingURL=THistoryEditor.d.ts.map |
@@ -11,3 +11,3 @@ import { NodeAncestorsOptions, Path } from 'slate'; | ||
*/ | ||
export declare const getNodeAncestors: <N extends AncestorOf<R>, R extends TNode = TNode>(root: R, path: Path, options?: NodeAncestorsOptions | undefined) => Generator<TNodeEntry<N>, void, undefined>; | ||
export declare const getNodeAncestors: <N extends AncestorOf<R>, R extends TNode = TNode>(root: R, path: Path, options?: NodeAncestorsOptions) => Generator<TNodeEntry<N>, void, undefined>; | ||
//# sourceMappingURL=getNodeAncestors.d.ts.map |
@@ -8,3 +8,3 @@ import { NodeChildrenOptions, Path } from 'slate'; | ||
*/ | ||
export declare const getNodeChildren: <N extends ChildOf<R, number>, R extends TNode = TNode>(root: R, path: Path, options?: NodeChildrenOptions | undefined) => Generator<TNodeEntry<N>, void, undefined>; | ||
export declare const getNodeChildren: <N extends ChildOf<R>, R extends TNode = TNode>(root: R, path: Path, options?: NodeChildrenOptions) => Generator<TNodeEntry<N>, void, undefined>; | ||
//# sourceMappingURL=getNodeChildren.d.ts.map |
@@ -10,3 +10,3 @@ import { NodeLevelsOptions, Path } from 'slate'; | ||
*/ | ||
export declare const getNodeLevels: <N extends NodeOf<R>, R extends TNode = TNode>(root: R, path: Path, options?: NodeLevelsOptions | undefined) => Generator<TNodeEntry<N>, void, undefined>; | ||
export declare const getNodeLevels: <N extends NodeOf<R>, R extends TNode = TNode>(root: R, path: Path, options?: NodeLevelsOptions) => Generator<TNodeEntry<N>, void, undefined>; | ||
//# sourceMappingURL=getNodeLevels.d.ts.map |
@@ -9,11 +9,11 @@ import { TEditor, Value } from '../editor/TEditor'; | ||
*/ | ||
export declare type TAncestor = TEditor | TElement; | ||
export type TAncestor = TEditor | TElement; | ||
/** | ||
* Ancestor of an editor. | ||
*/ | ||
export declare type EAncestor<V extends Value> = AncestorOf<TEditor<V>>; | ||
export type EAncestor<V extends Value> = AncestorOf<TEditor<V>>; | ||
/** | ||
* A utility type to get all the ancestor node types from a root node type. | ||
*/ | ||
export declare type AncestorOf<N extends TNode> = TEditor extends N ? TEditor | TElement : TElement extends N ? TElement : N extends TEditor ? N | N['children'][number] | ElementOf<N['children'][number]> : N extends TElement ? N | ElementOf<N> : never; | ||
export type AncestorOf<N extends TNode> = TEditor extends N ? TEditor | TElement : TElement extends N ? TElement : N extends TEditor ? N | N['children'][number] | ElementOf<N['children'][number]> : N extends TElement ? N | ElementOf<N> : never; | ||
//# sourceMappingURL=TAncestor.d.ts.map |
import { TEditor, Value } from '../editor/TEditor'; | ||
import { ElementOf, TElement } from '../element/TElement'; | ||
import { TextOf, TText } from '../text/TText'; | ||
import { TText, TextOf } from '../text/TText'; | ||
import { TNode } from './TNode'; | ||
@@ -10,16 +10,16 @@ /** | ||
*/ | ||
export declare type TDescendant = TElement | TText; | ||
export type TDescendant = TElement | TText; | ||
/** | ||
* Descendant of an editor. | ||
*/ | ||
export declare type EDescendant<V extends Value> = DescendantOf<TEditor<V>>; | ||
export type EDescendant<V extends Value> = DescendantOf<TEditor<V>>; | ||
/** | ||
* A utility type to get all the descendant node types from a root node type. | ||
*/ | ||
export declare type DescendantOf<N extends TNode> = N extends TEditor ? ElementOf<N> | TextOf<N> : N extends TElement ? ElementOf<N['children'][number]> | TextOf<N> : never; | ||
export type DescendantOf<N extends TNode> = N extends TEditor ? ElementOf<N> | TextOf<N> : N extends TElement ? ElementOf<N['children'][number]> | TextOf<N> : never; | ||
/** | ||
* A utility type to get the child node types from a root node type. | ||
*/ | ||
export declare type ChildOf<N extends TNode, I extends number = number> = N extends TEditor ? N['children'][I] : N extends TElement ? N['children'][I] : never; | ||
export type ChildOf<N extends TNode, I extends number = number> = N extends TEditor ? N['children'][I] : N extends TElement ? N['children'][I] : never; | ||
export declare const isDescendant: (value: any) => value is TDescendant; | ||
//# sourceMappingURL=TDescendant.d.ts.map |
import { Path } from 'slate'; | ||
import { TEditor, Value } from '../editor/TEditor'; | ||
import { ElementOf, TElement } from '../element/TElement'; | ||
import { TextOf, TText } from '../text/TText'; | ||
export declare type TNode = TEditor | TElement | TText; | ||
import { TText, TextOf } from '../text/TText'; | ||
export type TNode = TEditor | TElement | TText; | ||
/** | ||
* Node of an editor. | ||
*/ | ||
export declare type ENode<V extends Value> = NodeOf<TEditor<V>>; | ||
export type ENode<V extends Value> = NodeOf<TEditor<V>>; | ||
/** | ||
* A utility type to get all the node types from a root node type. | ||
*/ | ||
export declare type NodeOf<N extends TNode> = N | ElementOf<N> | TextOf<N>; | ||
export type NodeOf<N extends TNode> = N | ElementOf<N> | TextOf<N>; | ||
/** | ||
* Convenience type for returning the props of a node. | ||
*/ | ||
export declare type TNodeProps<N extends TNode> = N extends TEditor ? Omit<N, 'children'> : N extends TElement ? Omit<N, 'children'> : Omit<N, 'text'>; | ||
export type TNodeProps<N extends TNode> = N extends TEditor ? Omit<N, 'children'> : N extends TElement ? Omit<N, 'children'> : Omit<N, 'text'>; | ||
/** | ||
* A helper type for narrowing matched nodes with a predicate. | ||
*/ | ||
export declare type TNodeMatch<N extends TNode = TNode> = ((node: N, path: Path) => node is N) | ((node: N, path: Path) => boolean); | ||
export type TNodeMatch<N extends TNode = TNode> = ((node: N, path: Path) => node is N) | ((node: N, path: Path) => boolean); | ||
//# sourceMappingURL=TNode.d.ts.map |
@@ -13,11 +13,11 @@ import { Path } from 'slate'; | ||
*/ | ||
export declare type TNodeEntry<N extends TNode = TNode> = [N, Path]; | ||
export type TNodeEntry<N extends TNode = TNode> = [N, Path]; | ||
/** | ||
* Node entry from an editor. | ||
*/ | ||
export declare type ENodeEntry<V extends Value> = TNodeEntry<ENode<V>>; | ||
export type ENodeEntry<V extends Value> = TNodeEntry<ENode<V>>; | ||
/** | ||
* Element entry from a node. | ||
*/ | ||
export declare type TElementEntry<N extends TNode = TNode> = TNodeEntry<ElementOf<N>>; | ||
export type TElementEntry<N extends TNode = TNode> = TNodeEntry<ElementOf<N>>; | ||
/** | ||
@@ -29,7 +29,7 @@ * Element entry from an editor. | ||
*/ | ||
export declare type EElementEntry<V extends Value> = TNodeEntry<EElement<V>>; | ||
export type EElementEntry<V extends Value> = TNodeEntry<EElement<V>>; | ||
/** | ||
* Text node entry from a node. | ||
*/ | ||
export declare type TTextEntry<N extends TNode = TNode> = TNodeEntry<TextOf<N>>; | ||
export type TTextEntry<N extends TNode = TNode> = TNodeEntry<TextOf<N>>; | ||
/** | ||
@@ -41,15 +41,15 @@ * Text node entry from an editor. | ||
*/ | ||
export declare type ETextEntry<V extends Value> = TNodeEntry<EText<V>>; | ||
export type ETextEntry<V extends Value> = TNodeEntry<EText<V>>; | ||
/** | ||
* Ancestor entry from a node. | ||
*/ | ||
export declare type TAncestorEntry<N extends TNode = TNode> = TNodeEntry<AncestorOf<N>>; | ||
export type TAncestorEntry<N extends TNode = TNode> = TNodeEntry<AncestorOf<N>>; | ||
/** | ||
* Ancestor entry from an editor. | ||
*/ | ||
export declare type EAncestorEntry<V extends Value> = TAncestorEntry<TEditor<V>>; | ||
export type EAncestorEntry<V extends Value> = TAncestorEntry<TEditor<V>>; | ||
/** | ||
* Descendant entry from a node. | ||
*/ | ||
export declare type TDescendantEntry<N extends TNode = TNode> = TNodeEntry<DescendantOf<N>>; | ||
export type TDescendantEntry<N extends TNode = TNode> = TNodeEntry<DescendantOf<N>>; | ||
/** | ||
@@ -61,7 +61,7 @@ * Descendant entry from an editor. | ||
*/ | ||
export declare type EDescendantEntry<V extends Value> = TNodeEntry<EDescendant<V>>; | ||
export type EDescendantEntry<V extends Value> = TNodeEntry<EDescendant<V>>; | ||
/** | ||
* Child node entry from a node. | ||
*/ | ||
export declare type TNodeChildEntry<N extends TNode = TNode> = TNodeEntry<ChildOf<N>>; | ||
export type TNodeChildEntry<N extends TNode = TNode> = TNodeEntry<ChildOf<N>>; | ||
//# sourceMappingURL=TNodeEntry.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import { Range } from 'slate'; | ||
/** | ||
@@ -5,3 +6,3 @@ * See {@link Range.isCollapsed}. | ||
*/ | ||
export declare const isCollapsed: (range?: import("slate").BaseRange | null | undefined) => boolean; | ||
export declare const isCollapsed: (range?: Range | null) => boolean; | ||
//# sourceMappingURL=isCollapsed.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import { Range } from 'slate'; | ||
/** | ||
@@ -5,3 +6,3 @@ * See {@link Range.isExpanded}. | ||
*/ | ||
export declare const isExpanded: (range?: import("slate").BaseRange | null | undefined) => boolean; | ||
export declare const isExpanded: (range?: Range | null) => boolean; | ||
//# sourceMappingURL=isExpanded.d.ts.map |
@@ -16,13 +16,13 @@ import { Simplify, UnionToIntersection, UnknownObject } from '@udecode/utils'; | ||
*/ | ||
export declare type EText<V extends Value> = TextOf<TEditor<V>>; | ||
export type EText<V extends Value> = TextOf<TEditor<V>>; | ||
/** | ||
* A utility type to get all the text node types from a root node type. | ||
*/ | ||
export declare type TextOf<N extends TNode> = TEditor extends N ? TText : TElement extends N ? TText : N extends TEditor ? TextOf<N['children'][number]> : N extends TElement ? Extract<N['children'][number], TText> | TextOf<N['children'][number]> : N extends TText ? N : never; | ||
export type TextOf<N extends TNode> = TEditor extends N ? TText : TElement extends N ? TText : N extends TEditor ? TextOf<N['children'][number]> : N extends TElement ? Extract<N['children'][number], TText> | TextOf<N['children'][number]> : N extends TText ? N : never; | ||
/** | ||
* A utility type to get all the mark types from a root node type. | ||
*/ | ||
export declare type MarksOf<N extends TNode> = Simplify<UnionToIntersection<TNodeProps<TextOf<N>>>>; | ||
export declare type EMarks<V extends Value> = MarksOf<TEditor<V>>; | ||
export declare type MarkKeysOf<N extends TNode> = {} extends MarksOf<N> ? unknown : keyof MarksOf<N>; | ||
export type MarksOf<N extends TNode> = Simplify<UnionToIntersection<TNodeProps<TextOf<N>>>>; | ||
export type EMarks<V extends Value> = MarksOf<TEditor<V>>; | ||
export type MarkKeysOf<N extends TNode> = {} extends MarksOf<N> ? unknown : keyof MarksOf<N>; | ||
//# sourceMappingURL=TText.d.ts.map |
@@ -6,3 +6,3 @@ import { SelectionCollapseOptions } from 'slate/dist/interfaces/transforms/selection'; | ||
*/ | ||
export declare const collapseSelection: <V extends Value>(editor: TEditor<V>, options?: SelectionCollapseOptions | undefined) => void; | ||
export declare const collapseSelection: <V extends Value>(editor: TEditor<V>, options?: SelectionCollapseOptions) => void; | ||
//# sourceMappingURL=collapseSelection.d.ts.map |
@@ -6,3 +6,3 @@ import { TextDeleteOptions } from 'slate/dist/interfaces/transforms/text'; | ||
*/ | ||
export declare const deleteText: <V extends Value>(editor: TEditor<V>, options?: TextDeleteOptions | undefined) => void; | ||
export declare const deleteText: <V extends Value>(editor: TEditor<V>, options?: TextDeleteOptions) => void; | ||
//# sourceMappingURL=deleteText.d.ts.map |
@@ -7,3 +7,3 @@ import { TextInsertFragmentOptions } from 'slate/dist/interfaces/transforms/text'; | ||
*/ | ||
export declare const insertFragment: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, fragment: N[], options?: TextInsertFragmentOptions | undefined) => void; | ||
export declare const insertFragment: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, fragment: N[], options?: TextInsertFragmentOptions) => void; | ||
//# sourceMappingURL=insertFragment.d.ts.map |
@@ -6,3 +6,5 @@ import { Modify } from '@udecode/utils'; | ||
import { EElementOrText } from '../element/TElement'; | ||
export declare type InsertNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.insertNodes>[2]>, NodeMatchOption<V>>; | ||
export type InsertNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.insertNodes>[2]>, NodeMatchOption<V>> & { | ||
nextBlock?: boolean; | ||
}; | ||
/** | ||
@@ -9,0 +11,0 @@ * Insert nodes at a specific location in the Editor. |
@@ -6,3 +6,3 @@ import { TextInsertTextOptions } from 'slate/dist/interfaces/transforms/text'; | ||
*/ | ||
export declare const insertText: <V extends Value>(editor: TEditor<V>, text: string, options?: TextInsertTextOptions | undefined) => void; | ||
export declare const insertText: <V extends Value>(editor: TEditor<V>, text: string, options?: TextInsertTextOptions) => void; | ||
//# sourceMappingURL=insertText.d.ts.map |
@@ -5,3 +5,3 @@ import { Modify } from '@udecode/utils'; | ||
import { TEditor, Value } from '../editor/TEditor'; | ||
export declare type LiftNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.liftNodes>[1]>, NodeMatchOption<V>>; | ||
export type LiftNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.liftNodes>[1]>, NodeMatchOption<V>>; | ||
/** | ||
@@ -8,0 +8,0 @@ * Lift nodes at a specific location upwards in the document tree, splitting |
@@ -5,3 +5,3 @@ import { Modify } from '@udecode/utils'; | ||
import { TEditor, Value } from '../editor/TEditor'; | ||
export declare type MergeNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.mergeNodes>[1]>, NodeMatchOption<V>> & { | ||
export type MergeNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.mergeNodes>[1]>, NodeMatchOption<V>> & { | ||
/** | ||
@@ -8,0 +8,0 @@ * Default: if the node isn't already the next sibling of the previous node, move |
@@ -5,3 +5,3 @@ import { Modify } from '@udecode/utils'; | ||
import { TEditor, Value } from '../editor/TEditor'; | ||
export declare type MoveNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.moveNodes>[1]>, NodeMatchOption<V>>; | ||
export type MoveNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.moveNodes>[1]>, NodeMatchOption<V>>; | ||
/** | ||
@@ -8,0 +8,0 @@ * Move the nodes at a location to a new location. |
@@ -6,3 +6,3 @@ import { SelectionMoveOptions } from 'slate/dist/interfaces/transforms/selection'; | ||
*/ | ||
export declare const moveSelection: <V extends Value>(editor: TEditor<V>, options?: SelectionMoveOptions | undefined) => void; | ||
export declare const moveSelection: <V extends Value>(editor: TEditor<V>, options?: SelectionMoveOptions) => void; | ||
//# sourceMappingURL=moveSelection.d.ts.map |
@@ -5,3 +5,3 @@ import { Modify } from '@udecode/utils'; | ||
import { TEditor, Value } from '../editor/TEditor'; | ||
export declare type RemoveNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.removeNodes>[1]>, NodeMatchOption<V>>; | ||
export type RemoveNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.removeNodes>[1]>, NodeMatchOption<V>>; | ||
/** | ||
@@ -8,0 +8,0 @@ * Remove the nodes at a specific location in the document. |
@@ -6,3 +6,3 @@ import { Modify } from '@udecode/utils'; | ||
import { ENode, TNodeProps } from '../node/TNode'; | ||
export declare type SetNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.setNodes>[2]>, NodeMatchOption<V>>; | ||
export type SetNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.setNodes>[2]>, NodeMatchOption<V>>; | ||
/** | ||
@@ -9,0 +9,0 @@ * Set new properties on the nodes at a location. |
@@ -7,3 +7,3 @@ import { Point } from 'slate'; | ||
*/ | ||
export declare const setPoint: <V extends Value>(editor: TEditor<V>, props: Partial<Point>, options?: SelectionSetPointOptions | undefined) => void; | ||
export declare const setPoint: <V extends Value>(editor: TEditor<V>, props: Partial<Point>, options?: SelectionSetPointOptions) => void; | ||
//# sourceMappingURL=setPoint.d.ts.map |
@@ -5,3 +5,3 @@ import { Modify } from '@udecode/utils'; | ||
import { TEditor, Value } from '../editor/TEditor'; | ||
export declare type SplitNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.splitNodes>[1]>, NodeMatchOption<V>>; | ||
export type SplitNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.splitNodes>[1]>, NodeMatchOption<V>>; | ||
/** | ||
@@ -8,0 +8,0 @@ * Split the nodes at a specific location. |
@@ -6,3 +6,3 @@ import { Modify } from '@udecode/utils'; | ||
import { ENode, TNodeProps } from '../node/TNode'; | ||
export declare type UnsetNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.unsetNodes>[2]>, NodeMatchOption<V>>; | ||
export type UnsetNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.unsetNodes>[2]>, NodeMatchOption<V>>; | ||
/** | ||
@@ -9,0 +9,0 @@ * Unset properties on the nodes at a location. |
@@ -5,3 +5,3 @@ import { Modify } from '@udecode/utils'; | ||
import { TEditor, Value } from '../editor/TEditor'; | ||
export declare type UnwrapNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.unwrapNodes>[1]>, ENodeMatchOptions<V>>; | ||
export type UnwrapNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.unwrapNodes>[1]>, ENodeMatchOptions<V>>; | ||
/** | ||
@@ -8,0 +8,0 @@ * Unwrap the nodes at a location from a parent node, splitting the parent if |
@@ -5,3 +5,4 @@ import { Modify } from '@udecode/utils'; | ||
import { TEditor, Value } from '../editor/TEditor'; | ||
export declare type WrapNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.wrapNodes>[2]>, NodeMatchOption<V>>; | ||
import { EElement } from '../element/TElement'; | ||
export type WrapNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.wrapNodes>[2]>, NodeMatchOption<V>>; | ||
/** | ||
@@ -11,3 +12,3 @@ * Wrap the nodes at a location in a new container node, splitting the edges | ||
*/ | ||
export declare const wrapNodes: <N extends import("../element/TElement").ElementOf<TEditor<V>>, V extends Value = Value>(editor: TEditor<V>, element: N, options?: WrapNodesOptions<V> | undefined) => void; | ||
export declare const wrapNodes: <N extends EElement<V>, V extends Value = Value>(editor: TEditor<V>, element: N, options?: WrapNodesOptions<V> | undefined) => void; | ||
//# sourceMappingURL=wrapNodes.d.ts.map |
import { ENode, GetNodeEntriesOptions, TEditor, TNodeEntry, Value } from '../interfaces'; | ||
export declare type FindNodeOptions<V extends Value = Value> = GetNodeEntriesOptions<V>; | ||
export type FindNodeOptions<V extends Value = Value> = GetNodeEntriesOptions<V>; | ||
/** | ||
@@ -4,0 +4,0 @@ * Find node matching the condition. |
import { TEditor, TElement, TNodeProps, Value } from '../interfaces'; | ||
import { SetNodesOptions } from '../interfaces/transforms/setNodes'; | ||
export declare const setElements: <V extends Value>(editor: TEditor<V>, props: Partial<TNodeProps<TElement>>, options?: SetNodesOptions<Value> | undefined) => void; | ||
export declare const setElements: <V extends Value>(editor: TEditor<V>, props: Partial<TNodeProps<TElement>>, options?: SetNodesOptions) => void; | ||
//# sourceMappingURL=setElements.d.ts.map |
import { Location, Path, Range, Selection, Span } from 'slate'; | ||
export declare type TLocation = Location; | ||
export declare type TPath = Path; | ||
export declare type TRange = Range; | ||
export declare type TSelection = Selection; | ||
export declare type TSpan = Span; | ||
export type TLocation = Location; | ||
export type TPath = Path; | ||
export type TRange = Range; | ||
export type TSelection = Selection; | ||
export type TSpan = Span; | ||
//# sourceMappingURL=interfaces.d.ts.map |
import { TDescendant } from '../interfaces/node/TDescendant'; | ||
import { TPath, TRange } from './interfaces'; | ||
export declare type TInsertNodeOperation<N extends TDescendant = TDescendant> = { | ||
export type TInsertNodeOperation<N extends TDescendant = TDescendant> = { | ||
type: 'insert_node'; | ||
@@ -9,3 +9,3 @@ path: TPath; | ||
}; | ||
export declare type TInsertTextOperation = { | ||
export type TInsertTextOperation = { | ||
type: 'insert_text'; | ||
@@ -17,3 +17,3 @@ path: TPath; | ||
}; | ||
export declare type TMergeNodeOperation = { | ||
export type TMergeNodeOperation = { | ||
type: 'merge_node'; | ||
@@ -25,3 +25,3 @@ path: TPath; | ||
}; | ||
export declare type TMoveNodeOperation = { | ||
export type TMoveNodeOperation = { | ||
type: 'move_node'; | ||
@@ -32,3 +32,3 @@ path: TPath; | ||
}; | ||
export declare type TRemoveNodeOperation<N extends TDescendant = TDescendant> = { | ||
export type TRemoveNodeOperation<N extends TDescendant = TDescendant> = { | ||
type: 'remove_node'; | ||
@@ -39,3 +39,3 @@ path: TPath; | ||
}; | ||
export declare type TRemoveTextOperation = { | ||
export type TRemoveTextOperation = { | ||
type: 'remove_text'; | ||
@@ -47,3 +47,3 @@ path: TPath; | ||
}; | ||
export declare type TSetNodeOperation = { | ||
export type TSetNodeOperation = { | ||
type: 'set_node'; | ||
@@ -55,3 +55,3 @@ path: TPath; | ||
}; | ||
export declare type TSetSelectionOperation = { | ||
export type TSetSelectionOperation = { | ||
type: 'set_selection'; | ||
@@ -72,3 +72,3 @@ properties: null; | ||
}; | ||
export declare type TSplitNodeOperation = { | ||
export type TSplitNodeOperation = { | ||
type: 'split_node'; | ||
@@ -80,5 +80,5 @@ path: TPath; | ||
}; | ||
export declare type TNodeOperation<N extends TDescendant = TDescendant> = TInsertNodeOperation<N> | TMergeNodeOperation | TMoveNodeOperation | TRemoveNodeOperation<N> | TSetNodeOperation | TSplitNodeOperation; | ||
export declare type TSelectionOperation = TSetSelectionOperation; | ||
export declare type TTextOperation = TInsertTextOperation | TRemoveTextOperation; | ||
export type TNodeOperation<N extends TDescendant = TDescendant> = TInsertNodeOperation<N> | TMergeNodeOperation | TMoveNodeOperation | TRemoveNodeOperation<N> | TSetNodeOperation | TSplitNodeOperation; | ||
export type TSelectionOperation = TSetSelectionOperation; | ||
export type TTextOperation = TInsertTextOperation | TRemoveTextOperation; | ||
/** | ||
@@ -90,3 +90,3 @@ * `Operation` objects define the low-level instructions that Slate editors use | ||
*/ | ||
export declare type TOperation<N extends TDescendant = TDescendant> = TNodeOperation<N> | TSelectionOperation | TTextOperation; | ||
export type TOperation<N extends TDescendant = TDescendant> = TNodeOperation<N> | TSelectionOperation | TTextOperation; | ||
//# sourceMappingURL=TOperation.d.ts.map |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import { Modify } from '@udecode/utils'; | ||
@@ -6,7 +5,7 @@ import { RenderLeafProps } from 'slate-react'; | ||
import { EText, TText } from '../interfaces/text/TText'; | ||
export declare type TRenderLeafProps<V extends Value = Value, N extends TText = EText<V>> = Modify<RenderLeafProps, { | ||
export type TRenderLeafProps<V extends Value = Value, N extends TText = EText<V>> = Modify<RenderLeafProps, { | ||
leaf: N; | ||
text: N; | ||
}>; | ||
export declare type RenderLeafFn<V extends Value = Value> = (props: TRenderLeafProps<V>) => JSX.Element; | ||
export type RenderLeafFn<V extends Value = Value> = (props: TRenderLeafProps<V>) => JSX.Element; | ||
//# sourceMappingURL=TRenderLeafProps.d.ts.map |
import { TEditor, Value } from '../interfaces/editor/TEditor'; | ||
import { ENode, TNode } from '../interfaces/node/TNode'; | ||
import { TPath } from '../types/interfaces'; | ||
export declare type PredicateObj = Record<string, any | any[]>; | ||
export declare type PredicateFn<T extends TNode> = (obj: T, path: TPath) => boolean; | ||
export declare type Predicate<T extends TNode> = PredicateObj | PredicateFn<T>; | ||
export type PredicateObj = Record<string, any | any[]>; | ||
export type PredicateFn<T extends TNode> = (obj: T, path: TPath) => boolean; | ||
export type Predicate<T extends TNode> = PredicateObj | PredicateFn<T>; | ||
/** | ||
@@ -20,3 +20,3 @@ * Match the object with a predicate object or function. | ||
export declare const getQueryOptions: <V extends Value>(editor: TEditor<V>, options?: any) => any; | ||
export declare type ENodeMatch<N extends TNode> = Predicate<N>; | ||
export type ENodeMatch<N extends TNode> = Predicate<N>; | ||
export interface ENodeMatchOptions<V extends Value = Value> { | ||
@@ -23,0 +23,0 @@ match?: ENodeMatch<ENode<V>>; |
{ | ||
"name": "@udecode/slate", | ||
"version": "21.4.1", | ||
"version": "22.0.2", | ||
"description": "Slate extension", | ||
"license": "MIT", | ||
"homepage": "https://plate.udecode.io", | ||
"homepage": "https://platejs.org", | ||
"repository": { | ||
@@ -21,2 +21,13 @@ "type": "git", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "yarn p:build", | ||
"build:watch": "yarn p:build:watch", | ||
"brl": "yarn p:brl", | ||
"clean": "yarn p:clean", | ||
"lint": "yarn p:lint", | ||
"lint:fix": "yarn p:lint:fix", | ||
"test": "yarn p:test", | ||
"test:watch": "yarn p:test:watch", | ||
"typecheck": "yarn p:typecheck" | ||
}, | ||
"dependencies": { | ||
@@ -23,0 +34,0 @@ "@udecode/utils": "19.7.1" |
# Slate extension | ||
## Documentation | ||
@@ -9,8 +7,4 @@ | ||
## API | ||
See the [API documentation](https://plate-api.udecode.io/globals.html). | ||
## License | ||
[MIT](../../LICENSE) |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
429327
298
3924
10