mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 06:30:14 +01:00
This commit is contained in:
parent
a9cc6acfd6
commit
5e4ac24a64
1 changed files with 10 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ import {isNotCtrl} from "./compatibility";
|
||||||
import {scrollCenter} from "../../util/highlightById";
|
import {scrollCenter} from "../../util/highlightById";
|
||||||
import {insertEmptyBlock} from "../../block/util";
|
import {insertEmptyBlock} from "../../block/util";
|
||||||
import {removeBlock} from "../wysiwyg/remove";
|
import {removeBlock} from "../wysiwyg/remove";
|
||||||
import {hasPreviousSibling} from "../wysiwyg/getBlock";
|
import {hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
|
||||||
import * as dayjs from "dayjs";
|
import * as dayjs from "dayjs";
|
||||||
|
|
||||||
const scrollToView = (nodeElement: Element, rowElement: HTMLElement, protyle: IProtyle) => {
|
const scrollToView = (nodeElement: Element, rowElement: HTMLElement, protyle: IProtyle) => {
|
||||||
|
|
@ -371,6 +371,15 @@ export const fixTable = (protyle: IProtyle, event: KeyboardEvent, range: Range)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.key === "Backspace" && range.toString() === "") {
|
||||||
|
const previousElement = hasPreviousSibling(range.startContainer) as Element;
|
||||||
|
if (range.startOffset === 1 && previousElement.nodeType === 1 && previousElement.tagName === "BR" &&
|
||||||
|
range.startContainer.textContent.length === 1 && !hasNextSibling(range.startContainer)) {
|
||||||
|
previousElement.insertAdjacentHTML("beforebegin", "<br>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// shift+enter 软换行
|
// shift+enter 软换行
|
||||||
if (event.key === "Enter" && event.shiftKey && isNotCtrl(event) && !event.altKey) {
|
if (event.key === "Enter" && event.shiftKey && isNotCtrl(event) && !event.altKey) {
|
||||||
const wbrElement = document.createElement("wbr");
|
const wbrElement = document.createElement("wbr");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue