mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 15:28:49 +01:00
This commit is contained in:
parent
775ac0413a
commit
48f81ae386
2 changed files with 11 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import {genEmptyElement, insertEmptyBlock} from "../../block/util";
|
||||
import {getSelectionOffset, focusByWbr} from "../util/selection";
|
||||
import {getSelectionOffset, focusByWbr, setLastNodeRange} from "../util/selection";
|
||||
import {
|
||||
getContenteditableElement,
|
||||
getTopEmptyElement,
|
||||
|
|
@ -185,7 +185,14 @@ const listEnter = (protyle: IProtyle, blockElement: HTMLElement, range: Range) =
|
|||
};
|
||||
|
||||
export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle) => {
|
||||
if (isNotEditBlock(blockElement)) {
|
||||
const disableElement = isNotEditBlock(blockElement)
|
||||
if ((!disableElement || blockElement.classList.contains("hr")) && blockElement.classList.contains("protyle-wysiwyg--select")) {
|
||||
setLastNodeRange(getContenteditableElement(blockElement), range, false);
|
||||
range.collapse(false);
|
||||
blockElement.classList.remove("protyle-wysiwyg--select");
|
||||
return;
|
||||
}
|
||||
if (disableElement) {
|
||||
if (blockElement.classList.contains("render-node")) {
|
||||
protyle.toolbar.showRender(protyle, blockElement);
|
||||
} else if (blockElement.classList.contains("hr")) {
|
||||
|
|
|
|||
|
|
@ -208,7 +208,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (!isCtrl(event) && event.key !== "Backspace" && event.key !== "Escape" && event.key !== "Delete" && !event.shiftKey && !event.altKey &&
|
||||
!matchHotKey(window.siyuan.config.keymap.editor.list.indent.custom, event) &&
|
||||
!matchHotKey(window.siyuan.config.keymap.editor.list.outdent.custom, event) &&
|
||||
!matchHotKey(window.siyuan.config.keymap.editor.general.newContentFile.custom, event)) {
|
||||
!matchHotKey(window.siyuan.config.keymap.editor.general.newContentFile.custom, event) &&
|
||||
event.key !== "Enter") {
|
||||
hideElements(["select"], protyle);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue