mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🚨
This commit is contained in:
parent
55371ed04d
commit
2a6aa53660
12 changed files with 37 additions and 41 deletions
|
|
@ -226,7 +226,7 @@ export class BlockPanel {
|
|||
}
|
||||
} else if (type === "open") {
|
||||
/// #if !BROWSER
|
||||
openNewWindowById(this.nodeIds[0])
|
||||
openNewWindowById(this.nodeIds[0]);
|
||||
/// #endif
|
||||
}
|
||||
event.preventDefault();
|
||||
|
|
@ -265,9 +265,9 @@ export class BlockPanel {
|
|||
});
|
||||
// 浮窗完整文档面包屑应不显示 退出聚焦
|
||||
if (editor.protyle.breadcrumb && editor.protyle.block.id === editor.protyle.block.rootID) {
|
||||
const exitFocusElement = editor.protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]')
|
||||
exitFocusElement.classList.add("fn__none")
|
||||
exitFocusElement.nextElementSibling.classList.add("fn__none")
|
||||
const exitFocusElement = editor.protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]');
|
||||
exitFocusElement.classList.add("fn__none");
|
||||
exitFocusElement.nextElementSibling.classList.add("fn__none");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -299,11 +299,11 @@ export class BlockPanel {
|
|||
this.destroy();
|
||||
return;
|
||||
}
|
||||
let openHTML = ""
|
||||
let openHTML = "";
|
||||
/// #if !BROWSER
|
||||
if (this.nodeIds.length === 1) {
|
||||
openHTML = `<span data-type="open" class="block__icon b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.openByNewWindow}"><svg style="width: 10px"><use xlink:href="#iconMove"></use></svg></span>
|
||||
<span class="fn__space"></span>`
|
||||
<span class="fn__space"></span>`;
|
||||
}
|
||||
/// #endif
|
||||
let html = `<div class="block__icons block__icons--border">
|
||||
|
|
|
|||
|
|
@ -981,7 +981,7 @@ class="b3-list-item b3-list-item--hide-action" data-path="${item.path}">
|
|||
this.init(false);
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
return window.siyuan.menus.menu;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,4 +37,4 @@ export const transferBlockRef = (id:string) => {
|
|||
});
|
||||
}
|
||||
}).element);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import {dialog as remoteDialog} from "@electron/remote";
|
|||
import * as path from "path";
|
||||
/// #endif
|
||||
import {MenuItem} from "./Menu";
|
||||
import {getDisplayName, getNotebookName, getTopPaths, pathPosix, setNoteBook} from "../util/pathName";
|
||||
import {getDisplayName, getNotebookName, getTopPaths, pathPosix} from "../util/pathName";
|
||||
import {hideMessage, showMessage} from "../dialog/message";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
import {onGetnotebookconf} from "./onGetnotebookconf";
|
||||
|
|
@ -111,7 +111,7 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
|
|||
}
|
||||
});
|
||||
return true;
|
||||
})
|
||||
});
|
||||
}
|
||||
/// #if !MOBILE
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
|
|
@ -541,7 +541,7 @@ export const sortMenu = (type: "notebooks" | "notebook", sortMode: number, click
|
|||
click: () => {
|
||||
clickEvent(15);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
icon: "iconSort",
|
||||
|
|
@ -549,4 +549,4 @@ export const sortMenu = (type: "notebooks" | "notebook", sortMode: number, click
|
|||
type: "submenu",
|
||||
submenu,
|
||||
}).element);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
label: window.siyuan.languages.openByNewWindow,
|
||||
icon: "iconMove",
|
||||
click() {
|
||||
openNewWindowById(refBlockId)
|
||||
openNewWindowById(refBlockId);
|
||||
}
|
||||
}).element);
|
||||
/// #endif
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ export class MobileFiles extends Model {
|
|||
this.init(false);
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
window.siyuan.menus.menu.element.style.zIndex = "310";
|
||||
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ import {duplicateBlock} from "../wysiwyg/commonHotkey";
|
|||
import {movePathTo} from "../../util/pathName";
|
||||
import {hintMoveBlock} from "../hint/extend";
|
||||
import {makeCard} from "../../card/makeCard";
|
||||
import {Dialog} from "../../dialog";
|
||||
import {isMobile} from "../../util/functions";
|
||||
import {transferBlockRef} from "../../menus/block";
|
||||
|
||||
export class Gutter {
|
||||
|
|
@ -603,8 +601,8 @@ export class Gutter {
|
|||
click() {
|
||||
duplicateBlock(selectsElement, protyle);
|
||||
}
|
||||
}]
|
||||
const copyTextRefMenu = this.genCopyTextRef(selectsElement)
|
||||
}];
|
||||
const copyTextRefMenu = this.genCopyTextRef(selectsElement);
|
||||
if (copyTextRefMenu) {
|
||||
copyMenu.splice(2, 0, copyTextRefMenu);
|
||||
}
|
||||
|
|
@ -984,8 +982,8 @@ export class Gutter {
|
|||
click() {
|
||||
duplicateBlock([nodeElement], protyle);
|
||||
}
|
||||
}])
|
||||
const copyTextRefMenu = this.genCopyTextRef([nodeElement])
|
||||
}]);
|
||||
const copyTextRefMenu = this.genCopyTextRef([nodeElement]);
|
||||
if (copyTextRefMenu) {
|
||||
copyMenu.splice(copyMenu.length - 1, 0, copyTextRefMenu);
|
||||
}
|
||||
|
|
@ -1373,9 +1371,9 @@ export class Gutter {
|
|||
insertEmptyBlock(protyle, "afterend", id);
|
||||
}
|
||||
}).element);
|
||||
const countElement = nodeElement.lastElementChild.querySelector(".protyle-attr--refcount")
|
||||
const countElement = nodeElement.lastElementChild.querySelector(".protyle-attr--refcount");
|
||||
if (countElement && countElement.textContent) {
|
||||
transferBlockRef(id)
|
||||
transferBlockRef(id);
|
||||
}
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
|
|
@ -1733,17 +1731,17 @@ export class Gutter {
|
|||
|
||||
private genCopyTextRef(selectsElement: Element[]): false | IMenu {
|
||||
if (isNotEditBlock(selectsElement[0])) {
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
return {
|
||||
label: `${window.siyuan.languages.copy} ${window.siyuan.languages.text} *`,
|
||||
click() {
|
||||
// 用于标识复制文本 *
|
||||
selectsElement[0].setAttribute("data-reftext", "true")
|
||||
selectsElement[0].setAttribute("data-reftext", "true");
|
||||
focusByRange(getEditorRange(selectsElement[0]));
|
||||
document.execCommand("copy");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public render(protyle: IProtyle, element: Element, wysiwyg: HTMLElement) {
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ export class Title {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
const countElement = this.element.lastElementChild.querySelector(".protyle-attr--refcount")
|
||||
const countElement = this.element.lastElementChild.querySelector(".protyle-attr--refcount");
|
||||
if (countElement && countElement.textContent) {
|
||||
transferBlockRef(protyle.block.rootID);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import {Constants} from "../../constants";
|
|||
import {hideElements} from "../ui/hideElements";
|
||||
import {fetchPost} from "../../util/fetch";
|
||||
import {onGet} from "../util/onGet";
|
||||
import {showMessage} from "../../dialog/message";
|
||||
import {updateHotkeyTip} from "../util/compatibility";
|
||||
import {isMobile} from "../../util/functions";
|
||||
import {hasClosestBlock, hasClosestByClassName} from "../util/hasClosest";
|
||||
|
||||
|
|
|
|||
|
|
@ -214,18 +214,18 @@ export class WYSIWYG {
|
|||
let html = "";
|
||||
let textPlain = "";
|
||||
if (selectElements.length > 0) {
|
||||
const isRefText = selectElements[0].getAttribute("data-reftext") === "true"
|
||||
const isRefText = selectElements[0].getAttribute("data-reftext") === "true";
|
||||
if (selectElements[0].getAttribute("data-type") === "NodeListItem" &&
|
||||
selectElements[0].parentElement.classList.contains("list") && // 反链复制列表项 https://github.com/siyuan-note/siyuan/issues/6555
|
||||
selectElements[0].parentElement.childElementCount - 1 === selectElements.length) {
|
||||
if (isRefText) {
|
||||
const cloneElement = selectElements[0].parentElement.cloneNode(true) as HTMLElement
|
||||
const cloneEditElement = getContenteditableElement(cloneElement)
|
||||
const cloneElement = selectElements[0].parentElement.cloneNode(true) as HTMLElement;
|
||||
const cloneEditElement = getContenteditableElement(cloneElement);
|
||||
if (cloneEditElement) {
|
||||
cloneEditElement.insertAdjacentHTML("beforeend", ` <span data-type="block-ref" data-subtype="s" data-id="${cloneElement.getAttribute("data-node-id")}">*</span>`)
|
||||
cloneEditElement.insertAdjacentHTML("beforeend", ` <span data-type="block-ref" data-subtype="s" data-id="${cloneElement.getAttribute("data-node-id")}">*</span>`);
|
||||
}
|
||||
html = cloneElement.outerHTML;
|
||||
selectElements[0].removeAttribute("data-reftext")
|
||||
selectElements[0].removeAttribute("data-reftext");
|
||||
} else {
|
||||
html = selectElements[0].parentElement.outerHTML;
|
||||
}
|
||||
|
|
@ -233,13 +233,13 @@ export class WYSIWYG {
|
|||
selectElements.forEach((item, index) => {
|
||||
const topElement = getTopAloneElement(item);
|
||||
if (isRefText && index === 0) {
|
||||
const cloneElement = topElement.cloneNode(true) as HTMLElement
|
||||
const cloneEditElement = getContenteditableElement(cloneElement)
|
||||
const cloneElement = topElement.cloneNode(true) as HTMLElement;
|
||||
const cloneEditElement = getContenteditableElement(cloneElement);
|
||||
if (cloneEditElement) {
|
||||
cloneEditElement.insertAdjacentHTML("beforeend", ` <span data-type="block-ref" data-subtype="s" data-id="${topElement.getAttribute("data-node-id")}">*</span>`)
|
||||
cloneEditElement.insertAdjacentHTML("beforeend", ` <span data-type="block-ref" data-subtype="s" data-id="${topElement.getAttribute("data-node-id")}">*</span>`);
|
||||
}
|
||||
html += removeEmbed(cloneElement);
|
||||
selectElements[0].removeAttribute("data-reftext")
|
||||
selectElements[0].removeAttribute("data-reftext");
|
||||
} else {
|
||||
html += removeEmbed(topElement);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const loadThirdIcon = (iconURL: string, data: IAppearance) => {
|
|||
};
|
||||
|
||||
export const loadAssets = (data: IAppearance) => {
|
||||
const htmlElement = document.getElementsByTagName("html")[0]
|
||||
const htmlElement = document.getElementsByTagName("html")[0];
|
||||
htmlElement.setAttribute("lang",window.siyuan.config.appearance.lang);
|
||||
htmlElement.setAttribute("data-theme-mode",getThemeMode());
|
||||
htmlElement.setAttribute("data-light-theme",window.siyuan.config.appearance.themeLight);
|
||||
|
|
@ -305,4 +305,4 @@ export const getThemeMode = () => {
|
|||
} else {
|
||||
return window.siyuan.config.appearance.mode === 0 ? "light" : "dark";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export const openNewWindowById = (id: string) => {
|
|||
mode: "wysiwyg",
|
||||
instance: "Editor",
|
||||
}
|
||||
}
|
||||
};
|
||||
if (response.data.rootID === id) {
|
||||
fetchPost("/api/attr/getBlockAttrs", {id}, (attrResponse) => {
|
||||
json.children.scrollAttr = JSON.parse(attrResponse.data.scroll || "{}");
|
||||
|
|
@ -48,7 +48,7 @@ export const openNewWindowById = (id: string) => {
|
|||
focusId: id,
|
||||
focusStart: 0,
|
||||
focusEnd: 0
|
||||
}
|
||||
};
|
||||
/// #if !BROWSER
|
||||
ipcRenderer.send(Constants.SIYUAN_OPENWINDOW, `${window.location.protocol}//${window.location.host}/stage/build/app/window.html?v=${Constants.SIYUAN_VERSION}&json=${JSON.stringify(json)}`);
|
||||
/// #endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue