mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-02-28 05:32:52 +00:00
This commit is contained in:
@@ -10,9 +10,8 @@ import {writeText} from "../../protyle/util/compatibility";
|
||||
import {showMessage} from "../../dialog/message";
|
||||
import {cancelDrag} from "./dragover";
|
||||
|
||||
export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
|
||||
cancelDrag();
|
||||
if (!window.siyuan.menus.menu.element.contains(event.target) && !hasClosestByAttribute(event.target, "data-menu", "true")) {
|
||||
export const globalClickHideMenu = (element: HTMLElement) => {
|
||||
if (!window.siyuan.menus.menu.element.contains(element) && !hasClosestByAttribute(element, "data-menu", "true")) {
|
||||
if (getSelection().rangeCount > 0 && window.siyuan.menus.menu.element.contains(getSelection().getRangeAt(0).startContainer) &&
|
||||
window.siyuan.menus.menu.element.contains(document.activeElement)) {
|
||||
// https://ld246.com/article/1654567749834/comment/1654589171218#comments
|
||||
@@ -20,6 +19,12 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
|
||||
window.siyuan.menus.menu.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
|
||||
cancelDrag();
|
||||
|
||||
globalClickHideMenu(event.target);
|
||||
|
||||
if (!hasClosestByClassName(event.target, "pdf__outer")) {
|
||||
hideAllElements(["pdfutil"]);
|
||||
|
||||
@@ -96,6 +96,7 @@ import {openLink} from "../../editor/openLink";
|
||||
import {mathRender} from "../render/mathRender";
|
||||
import {editAssetItem} from "../render/av/asset";
|
||||
import {img3115} from "../../boot/compatibleVersion";
|
||||
import {globalClickHideMenu} from "../../boot/globalEvent/click";
|
||||
|
||||
export class WYSIWYG {
|
||||
public lastHTMLs: { [key: string]: string } = {};
|
||||
@@ -2590,6 +2591,7 @@ export class WYSIWYG {
|
||||
hasClosestByClassName(event.target, "iframe");
|
||||
if (!event.shiftKey && !ctrlIsPressed && selectElement) {
|
||||
selectElement.classList.add("protyle-wysiwyg--select");
|
||||
globalClickHideMenu(event.target);
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user