prosemirror-codemark
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -40,3 +40,5 @@ "use strict"; | ||
const nextCode = !!markType.isInSet((_a = pos.marksAcross((0, utils_1.safeResolve)(doc, selection.from + 1))) !== null && _a !== void 0 ? _a : []); | ||
if (pos.pos === view.state.doc.nodeSize - 3 && (pluginState === null || pluginState === void 0 ? void 0 : pluginState.active)) { | ||
if (pos.pos === view.state.doc.nodeSize - 3 && | ||
pos.parentOffset === pos.parent.nodeSize - 2 && | ||
(pluginState === null || pluginState === void 0 ? void 0 : pluginState.active)) { | ||
// Behaviour stops: `code`| at the end of the document | ||
@@ -87,3 +89,9 @@ view.dispatch(view.state.tr.removeStoredMark(markType)); | ||
} | ||
if (inCode && nextCode && (pluginState === null || pluginState === void 0 ? void 0 : pluginState.active) && (pluginState === null || pluginState === void 0 ? void 0 : pluginState.side) === 0) { | ||
if ((pluginState === null || pluginState === void 0 ? void 0 : pluginState.side) === 0 && selection.$from.parentOffset === 0) { | ||
// New line! | ||
// ^`|code` --> ^|`code` | ||
view.dispatch(view.state.tr.removeStoredMark(markType)); | ||
return true; | ||
} | ||
if (inCode && nextCode && (pluginState === null || pluginState === void 0 ? void 0 : pluginState.side) === 0) { | ||
// `code`| --> `code|` | ||
@@ -133,8 +141,2 @@ view.dispatch(view.state.tr.addStoredMark(markType.create())); | ||
} | ||
if (inCode && !(pluginState === null || pluginState === void 0 ? void 0 : pluginState.active) && selection.$from.parentOffset === 0) { | ||
// Start of line | ||
// ^`|code` --> ^|`code` | ||
view.dispatch(view.state.tr.removeStoredMark(markType)); | ||
return true; | ||
} | ||
if (inCode && !nextCode && (pluginState === null || pluginState === void 0 ? void 0 : pluginState.active) && pluginState.side !== -1) { | ||
@@ -159,2 +161,6 @@ // `x`| --> `x|` - Single character | ||
const pos = selection.$from; | ||
const pluginState = plugin.getState(view.state); | ||
if (pos.pos === 1 && pos.parentOffset === 0 && (pluginState === null || pluginState === void 0 ? void 0 : pluginState.side) === -1) { | ||
return true; | ||
} | ||
if (selection.empty && pos.parentOffset === 0) { | ||
@@ -161,0 +167,0 @@ return stepOutsideNextTrAndPass(view, plugin); |
{ | ||
"name": "prosemirror-codemark", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Inline code mark for ProseMirror", | ||
@@ -5,0 +5,0 @@ "author": "Rowan Cockett <rowan@curvenote.com>", |
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
58012
550