This commit is contained in:
Vanessa 2022-07-31 10:18:05 +08:00
parent 6b64a031f0
commit 88c666b723
8 changed files with 11 additions and 11 deletions

View file

@ -63,14 +63,14 @@ export const genSBElement = (layout: string, id?: string, attrHTML?: string) =>
export const jumpToParentNext = (protyle:IProtyle,nodeElement: Element) => {
const topElement = getTopAloneElement(nodeElement);
if (topElement) {
const topParentElement = hasClosestByClassName(topElement, "list") || hasClosestByClassName(topElement, "bq") || hasClosestByClassName(topElement, "sb") || topElement
const nextElement = getNextBlock(topParentElement)
const topParentElement = hasClosestByClassName(topElement, "list") || hasClosestByClassName(topElement, "bq") || hasClosestByClassName(topElement, "sb") || topElement;
const nextElement = getNextBlock(topParentElement);
if (nextElement) {
focusBlock(nextElement)
focusBlock(nextElement);
scrollCenter(protyle, nextElement);
}
}
}
};
export const insertEmptyBlock = (protyle: IProtyle, position: InsertPosition, id?: string) => {
const range = getEditorRange(protyle.wysiwyg.element);

View file

@ -36,7 +36,7 @@ export const netImg2LocalAssets = (protyle: IProtyle) => {
});
/// #endif
});
}
};
export const fullscreen = (element: Element, btnElement?: Element) => {
const isFullscreen = element.className.includes("fullscreen");

View file

@ -219,7 +219,7 @@ export class Breadcrumb {
icon: "iconTransform",
accelerator: window.siyuan.config.keymap.editor.general.netImg2LocalAsset.custom,
click () {
netImg2LocalAssets(protyle)
netImg2LocalAssets(protyle);
}
}).element);
window.siyuan.menus.menu.append(new MenuItem({

View file

@ -1099,7 +1099,7 @@ export class Gutter {
accelerator: window.siyuan.config.keymap.editor.general.jumpToParentNext.custom,
click() {
nodeElement.classList.remove("protyle-wysiwyg--select");
jumpToParentNext(protyle, nodeElement)
jumpToParentNext(protyle, nodeElement);
}
}).element);
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);

View file

@ -43,7 +43,7 @@ export const commonHotkey = (protyle: IProtyle, event: KeyboardEvent) => {
return true;
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.netImg2LocalAsset.custom, event)) {
netImg2LocalAssets(protyle)
netImg2LocalAssets(protyle);
event.preventDefault();
event.stopPropagation();
return;

View file

@ -226,7 +226,7 @@ export class WYSIWYG {
} else {
const tempElement = document.createElement("div");
// https://github.com/siyuan-note/siyuan/issues/5540
const selectTypes = protyle.toolbar.getCurrentType(range)
const selectTypes = protyle.toolbar.getCurrentType(range);
if ((selectTypes.length === 1 || range.startContainer.parentElement.parentElement.getAttribute("data-type") === "NodeHeading") &&
(
(range.startContainer.nodeType === 3 && range.startContainer.parentElement.textContent === range.toString()) ||

View file

@ -1190,7 +1190,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
return true;
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.jumpToParentNext.custom, event)) {
jumpToParentNext(protyle, nodeElement)
jumpToParentNext(protyle, nodeElement);
event.preventDefault();
event.stopPropagation();
return true;

View file

@ -381,7 +381,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: b
if (operation.previousID) {
let beforeElement: Element;
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.previousID}"]`)).find(item => {
const embedElement = hasClosestByAttribute(item.parentElement, "data-type", "NodeBlockQueryEmbed")
const embedElement = hasClosestByAttribute(item.parentElement, "data-type", "NodeBlockQueryEmbed");
if (embedElement) {
// https://github.com/siyuan-note/siyuan/issues/5524
embedElement.removeAttribute("data-render");