prosemirror-flat-list
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -10,7 +10,5 @@ // src/commands/dedent-list.ts | ||
function parseInteger(attr) { | ||
if (attr == null) | ||
return null; | ||
if (attr == null) return null; | ||
const int = Number.parseInt(attr, 10); | ||
if (Number.isInteger(int)) | ||
return int; | ||
if (Number.isInteger(int)) return int; | ||
return null; | ||
@@ -256,4 +254,3 @@ } | ||
function isListNode(node) { | ||
if (!node) | ||
return false; | ||
if (!node) return false; | ||
return isListType(node.type); | ||
@@ -308,7 +305,5 @@ } | ||
const before = parent.maybeChild(index - 1); | ||
if (!before) | ||
continue; | ||
if (!before) continue; | ||
const after = parent.maybeChild(index); | ||
if (!after) | ||
continue; | ||
if (!after) continue; | ||
if (prediction(before, after, parent, index)) { | ||
@@ -430,4 +425,3 @@ joinable.push(boundary); | ||
const range = $from.blockRange($to); | ||
if (!range) | ||
return false; | ||
if (!range) return false; | ||
return safeLift(tr, range); | ||
@@ -526,4 +520,3 @@ } | ||
const range = findListsRange($from, $to); | ||
if (!range) | ||
return false; | ||
if (!range) return false; | ||
if (dedentRange(range, tr)) { | ||
@@ -569,4 +562,3 @@ dispatch == null ? void 0 : dispatch(tr); | ||
const range1 = $from.blockRange(tr.doc.resolve(splitPos - 1)); | ||
if (!range1) | ||
return false; | ||
if (!range1) return false; | ||
const getRange2From = mapPos(tr, splitPos + 1); | ||
@@ -605,4 +597,3 @@ const getRange2To = mapPos(tr, $to.pos); | ||
const lastChild = parent.maybeChild(endIndex - 1); | ||
if (!lastChild) | ||
return false; | ||
if (!lastChild) return false; | ||
const canAppend = endIndex < parent.childCount && lastChild.canReplace( | ||
@@ -676,8 +667,6 @@ lastChild.childCount, | ||
const listNode = $start.nodeAfter; | ||
if (!listNode) | ||
return false; | ||
if (!listNode) return false; | ||
const start = range.start; | ||
const end = start + listNode.nodeSize; | ||
if (getRangeEnd() !== end) | ||
return false; | ||
if (getRangeEnd() !== end) return false; | ||
if (!$start.parent.canReplace( | ||
@@ -742,4 +731,3 @@ startIndex, | ||
const range = findListsRange($from, $to) || $from.blockRange($to); | ||
if (!range) | ||
return false; | ||
if (!range) return false; | ||
if (indentRange(range, tr)) { | ||
@@ -781,4 +769,3 @@ dispatch == null ? void 0 : dispatch(tr); | ||
const range1 = $from.blockRange(tr.doc.resolve(splitPos - 1)); | ||
if (!range1) | ||
return false; | ||
if (!range1) return false; | ||
const getRange2From = mapPos(tr, splitPos + 1); | ||
@@ -849,7 +836,5 @@ const getRange2To = mapPos(tr, $to.pos); | ||
for (; !beforeText.isTextblock; beforePos--) { | ||
if (beforeText.type.spec.isolating) | ||
return false; | ||
if (beforeText.type.spec.isolating) return false; | ||
let child = beforeText.lastChild; | ||
if (!child) | ||
return false; | ||
if (!child) return false; | ||
beforeText = child; | ||
@@ -859,12 +844,9 @@ } | ||
for (; !afterText.isTextblock; afterPos++) { | ||
if (afterText.type.spec.isolating) | ||
return false; | ||
if (afterText.type.spec.isolating) return false; | ||
let child = afterText.firstChild; | ||
if (!child) | ||
return false; | ||
if (!child) return false; | ||
afterText = child; | ||
} | ||
let step = replaceStep(tr.doc, beforePos, afterPos, Slice3.empty); | ||
if (!step || step.from != beforePos || step instanceof ReplaceStep && step.slice.size >= afterPos - beforePos) | ||
return false; | ||
if (!step || step.from != beforePos || step instanceof ReplaceStep && step.slice.size >= afterPos - beforePos) return false; | ||
if (dispatch) { | ||
@@ -881,7 +863,5 @@ tr.step(step); | ||
const $cursor = atTextblockStart(state, view); | ||
if (!$cursor) | ||
return false; | ||
if (!$cursor) return false; | ||
const $cut = findCutBefore($cursor); | ||
if (!$cut) | ||
return false; | ||
if (!$cut) return false; | ||
const { nodeBefore, nodeAfter } = $cut; | ||
@@ -905,6 +885,4 @@ if (nodeBefore && nodeAfter && isListNode(nodeBefore) && nodeBefore.attrs.collapsed && nodeAfter.isBlock) { | ||
for (let i = $pos.depth - 1; i >= 0; i--) { | ||
if ($pos.index(i) > 0) | ||
return $pos.doc.resolve($pos.before(i + 1)); | ||
if ($pos.node(i).type.spec.isolating) | ||
break; | ||
if ($pos.index(i) > 0) return $pos.doc.resolve($pos.before(i + 1)); | ||
if ($pos.node(i).type.spec.isolating) break; | ||
} | ||
@@ -918,11 +896,8 @@ return null; | ||
const $cursor = atTextblockStart(state, view); | ||
if (!$cursor) | ||
return false; | ||
if (!$cursor) return false; | ||
const { depth } = $cursor; | ||
if (depth < 2) | ||
return false; | ||
if (depth < 2) return false; | ||
const listDepth = depth - 1; | ||
const listNode = $cursor.node(listDepth); | ||
if (!isListNode(listNode)) | ||
return false; | ||
if (!isListNode(listNode)) return false; | ||
const indexInList = $cursor.index(listDepth); | ||
@@ -1206,4 +1181,3 @@ if (indexInList === 0) { | ||
const range = findListsRange($from, $to); | ||
if (!range) | ||
return false; | ||
if (!range) return false; | ||
const { parent, depth, startIndex, endIndex } = range; | ||
@@ -1603,8 +1577,6 @@ if (direction === "up") { | ||
var _a2; | ||
if (!node2.sameMarkup(prevNode)) | ||
return false; | ||
if (!node2.sameMarkup(prevNode)) return false; | ||
const nested = ((_a2 = node2.firstChild) == null ? void 0 : _a2.type) === node2.type; | ||
const singleChild = node2.childCount === 1; | ||
if (prevNested !== nested || prevSingleChild !== singleChild) | ||
return false; | ||
if (prevNested !== nested || prevSingleChild !== singleChild) return false; | ||
prevNode = node2; | ||
@@ -1645,4 +1617,3 @@ return true; | ||
const child = parent.children.item(i); | ||
if (!child) | ||
continue; | ||
if (!child) continue; | ||
if (child.tagName === "UL" || child.tagName === "OL") { | ||
@@ -1649,0 +1620,0 @@ let next = null; |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.43.0" | ||
"packageVersion": "7.47.2" | ||
} | ||
] | ||
} |
{ | ||
"name": "prosemirror-flat-list", | ||
"type": "module", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "Powerful list support for ProseMirror", | ||
@@ -39,29 +39,29 @@ "author": "ocavue <ocavue@gmail.com>", | ||
"prosemirror-inputrules": "^1.4.0", | ||
"prosemirror-model": "^1.22.1", | ||
"prosemirror-safari-ime-span": "^1.0.1", | ||
"prosemirror-model": "^1.22.2", | ||
"prosemirror-safari-ime-span": "^1.0.2", | ||
"prosemirror-state": "^1.4.3", | ||
"prosemirror-transform": "^1.9.0", | ||
"prosemirror-view": "^1.33.8" | ||
"prosemirror-view": "^1.33.9" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.43.0", | ||
"@microsoft/api-extractor": "^7.47.2", | ||
"@remirror/core": "^2.0.19", | ||
"@remirror/extension-blockquote": "^2.0.14", | ||
"@remirror/extension-heading": "^2.0.14", | ||
"@remirror/extension-heading": "^2.0.15", | ||
"@remirror/extension-horizontal-rule": "^2.0.13", | ||
"@remirror/pm": "^2.0.8", | ||
"@remirror/pm": "^2.0.9", | ||
"@remirror/preset-core": "^2.0.16", | ||
"@types/dedent": "^0.7.2", | ||
"@types/node": "^20.12.5", | ||
"@vitest/coverage-v8": "^1.4.0", | ||
"dedent": "^1.5.1", | ||
"execa": "^9.2.0", | ||
"@types/node": "^20.14.11", | ||
"@vitest/coverage-v8": "^1.6.0", | ||
"dedent": "^1.5.3", | ||
"execa": "^9.3.0", | ||
"jest-prosemirror": "^2.1.6", | ||
"jest-remirror": "^2.1.5", | ||
"jsdom": "^24.0.0", | ||
"jsdom": "^24.1.0", | ||
"npm-run-all": "^4.1.5", | ||
"postcss": "^8.4.38", | ||
"postcss-nesting": "^12.1.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"postcss": "^8.4.39", | ||
"postcss-nesting": "^12.1.5", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"rehype-stringify": "^10.0.0", | ||
@@ -71,8 +71,8 @@ "remark-gfm": "^4.0.0", | ||
"remark-rehype": "^11.1.0", | ||
"remirror": "^2.0.39", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.4.4", | ||
"unified": "^11.0.4", | ||
"vite": "^5.1.6", | ||
"vitest": "^1.4.0" | ||
"remirror": "^2.0.40", | ||
"tsup": "^8.1.2", | ||
"typescript": "^5.5.3", | ||
"unified": "^11.0.5", | ||
"vite": "^5.3.4", | ||
"vitest": "^1.6.0" | ||
}, | ||
@@ -79,0 +79,0 @@ "typedocOptions": { |
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
130361
3967
Updatedprosemirror-model@^1.22.2
Updatedprosemirror-view@^1.33.9