|
@@ -623,6 +623,11 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|
|
const tdElement = hasClosestByMatchTag(range.startContainer, "TD") || hasClosestByMatchTag(range.startContainer, "TH");
|
|
|
const nodeEditableElement = (tdElement || getContenteditableElement(nodeElement) || nodeElement) as HTMLElement;
|
|
|
const position = getSelectionOffset(nodeEditableElement, protyle.wysiwyg.element, range);
|
|
|
+ if (nodeElement.classList.contains("code-block") && position.end === nodeEditableElement.innerText.length) {
|
|
|
+ // 代码块换最后一个 /n 肉眼是无法区分是否在其后的,因此统一在之前
|
|
|
+ position.end -= 1;
|
|
|
+
|
|
|
+ }
|
|
|
// 需使用 innerText 否则表格内 br 无法传唤为 /n
|
|
|
if (event.key === "ArrowDown" && nodeEditableElement?.innerText.trimRight().substr(position.start).indexOf("\n") === -1 && (
|
|
|
(tdElement && !tdElement.parentElement.nextElementSibling && nodeElement.getAttribute("data-type") === "NodeTable" && !getNextBlock(nodeElement)) ||
|