🎨 Clean code

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-04 21:15:12 +08:00
parent 12456ce23a
commit 950d419b91
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 9 additions and 6 deletions

View file

@ -7,6 +7,7 @@ import {isWindow} from "../../util/functions";
import {writeText} from "../../protyle/util/compatibility";
import {showMessage} from "../../dialog/message";
import {cancelDrag} from "./dragover";
import {code160to32} from "../../protyle/util/code160to32";
export const globalClickHideMenu = (element: HTMLElement) => {
if (!window.siyuan.menus.menu.element.contains(element) && !hasClosestByAttribute(element, "data-menu", "true")) {
@ -42,7 +43,7 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
if (copyElement) {
let text = copyElement.parentElement.nextElementSibling.textContent.replace(/\n$/, "");
text = text.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382
text = code160to32(text) // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382
// https://github.com/siyuan-note/siyuan/issues/14800
text = text.replace(/\u200D```/g, "```");
writeText(text);