mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-01 06:18:49 +01:00
🚨
This commit is contained in:
parent
40218fa1a0
commit
3925d5d1c4
11 changed files with 22 additions and 24 deletions
|
|
@ -45,7 +45,7 @@ export const initBlockPopover = (app: App) => {
|
|||
return;
|
||||
}
|
||||
} else if (!aElement) {
|
||||
const tipElement = hasClosestByAttribute(event.target, "id", "tooltip", true)
|
||||
const tipElement = hasClosestByAttribute(event.target, "id", "tooltip", true);
|
||||
if (!tipElement || (
|
||||
tipElement && (tipElement.clientHeight >= tipElement.scrollHeight && tipElement.clientWidth >= tipElement.scrollWidth)
|
||||
)) {
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
|||
protyle = item.editor.protyle;
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
if (!protyle && activeTabElement) {
|
||||
const tab = getInstanceById(activeTabElement.getAttribute("data-id")) as Tab;
|
||||
|
|
@ -187,11 +187,11 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
|||
protyle = editorItem.protyle;
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
if (protyle) {
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
if (!protyle) {
|
||||
models.backlink.find(item => {
|
||||
|
|
@ -209,7 +209,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
if (!protyle) {
|
||||
models.editor.find(item => {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export class Dialog {
|
|||
public element: HTMLElement;
|
||||
private id: string;
|
||||
private disableClose: boolean;
|
||||
public editor: Protyle
|
||||
public editor: Protyle;
|
||||
|
||||
constructor(options: {
|
||||
title?: string,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import {setPosition} from "../util/setPosition";
|
||||
import {isMobile} from "../util/functions";
|
||||
|
||||
export const showTooltip = (message: string, target: Element, error = false) => {
|
||||
|
|
@ -29,7 +28,7 @@ export const showTooltip = (message: string, target: Element, error = false) =>
|
|||
}
|
||||
let left = targetRect.left;
|
||||
let top = targetRect.bottom;
|
||||
const position = target.getAttribute("data-position")
|
||||
const position = target.getAttribute("data-position");
|
||||
const parentRect = target.parentElement.getBoundingClientRect();
|
||||
if (position === "right") {
|
||||
// block icon
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ export const resizeTabs = () => {
|
|||
});
|
||||
models.search.forEach(item => {
|
||||
item.edit.resize();
|
||||
})
|
||||
});
|
||||
models.custom.forEach(item => {
|
||||
if (item.resize) {
|
||||
item.resize();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import {fetchPost} from "../../util/fetch";
|
|||
import {Constants} from "../../constants";
|
||||
import {MenuItem} from "../../menus/Menu";
|
||||
import {fullscreen, netImg2LocalAssets} from "./action";
|
||||
import {exportMd, openFileAttr} from "../../menus/commonMenuItem";
|
||||
import {openFileAttr} from "../../menus/commonMenuItem";
|
||||
import {setEditMode} from "../util/setEditMode";
|
||||
import {RecordMedia} from "../util/RecordMedia";
|
||||
import {hideMessage, showMessage} from "../../dialog/message";
|
||||
|
|
@ -24,7 +24,6 @@ import {onGet} from "../util/onGet";
|
|||
import {hideElements} from "../ui/hideElements";
|
||||
import {confirmDialog} from "../../dialog/confirmDialog";
|
||||
import {reloadProtyle} from "../util/reload";
|
||||
import {deleteFile} from "../../editor/deleteFile";
|
||||
import {Menu} from "../../plugin/Menu";
|
||||
import {getNoContainerElement} from "../wysiwyg/getBlock";
|
||||
import {openTitleMenu} from "../header/openTitleMenu";
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ export class Undo {
|
|||
public replace(doOperations: IOperation[]) {
|
||||
// undo 引发 replace 导致 stack 错误 https://github.com/siyuan-note/siyuan/issues/9178
|
||||
if (this.hasUndo && this.redoStack.length > 0) {
|
||||
this.undoStack.push(this.redoStack.pop())
|
||||
this.undoStack.push(this.redoStack.pop());
|
||||
this.redoStack = [];
|
||||
this.hasUndo = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -560,18 +560,18 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
|
|||
range = setFirstNodeRange(cursorElement, getEditorRange(cursorElement));
|
||||
range.collapse(true);
|
||||
} else {
|
||||
let focusHljs = false
|
||||
let focusHljs = false;
|
||||
// 定位到末尾 https://github.com/siyuan-note/siyuan/issues/5982
|
||||
if (cursorElement.classList.contains("hljs")) {
|
||||
// 代码块末尾定位需在 /n 之前 https://github.com/siyuan-note/siyuan/issues/9141,https://github.com/siyuan-note/siyuan/issues/9189
|
||||
let lastNode = cursorElement.lastChild
|
||||
let lastNode = cursorElement.lastChild;
|
||||
if (lastNode.textContent === "" && lastNode.nodeType === 3) {
|
||||
lastNode = hasPreviousSibling(cursorElement.lastChild) as HTMLElement
|
||||
lastNode = hasPreviousSibling(cursorElement.lastChild) as HTMLElement;
|
||||
}
|
||||
if (lastNode && lastNode.textContent.endsWith("\n")) {
|
||||
range = getEditorRange(cursorElement);
|
||||
range.setStart(lastNode, lastNode.textContent.length - 1)
|
||||
focusHljs = true
|
||||
range.setStart(lastNode, lastNode.textContent.length - 1);
|
||||
focusHljs = true;
|
||||
}
|
||||
}
|
||||
if (!focusHljs) {
|
||||
|
|
|
|||
|
|
@ -1488,7 +1488,7 @@ export class WYSIWYG {
|
|||
}
|
||||
});
|
||||
|
||||
let timeout: number
|
||||
let timeout: number;
|
||||
this.element.addEventListener("input", (event: InputEvent) => {
|
||||
const target = event.target as HTMLElement;
|
||||
if (target.tagName === "VIDEO" || target.tagName === "AUDIO" || event.inputType === "historyRedo") {
|
||||
|
|
|
|||
|
|
@ -736,11 +736,11 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
|
|||
newFileByName(app, searchInputElement.value);
|
||||
} else if (type === "search-item") {
|
||||
const isAsset = target.dataset.id;
|
||||
let isClick = event.detail === 1
|
||||
let isDblClick = event.detail === 2
|
||||
let isClick = event.detail === 1;
|
||||
let isDblClick = event.detail === 2;
|
||||
/// #if BROWSER
|
||||
const newDate = new Date().getTime()
|
||||
isClick = newDate - lastClickTime > Constants.TIMEOUT_DBLCLICK
|
||||
const newDate = new Date().getTime();
|
||||
isClick = newDate - lastClickTime > Constants.TIMEOUT_DBLCLICK;
|
||||
isDblClick = !isClick;
|
||||
lastClickTime = newDate;
|
||||
/// #endif
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ export const closeWindow = async (app: App) => {
|
|||
await app.plugins[i].onunload();
|
||||
}
|
||||
getCurrentWindow().destroy();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue