mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-10 22:52:34 +01:00
This commit is contained in:
parent
90a89f886d
commit
e10d247480
15 changed files with 53 additions and 16 deletions
|
|
@ -3,6 +3,7 @@
|
|||
box-sizing: border-box;
|
||||
display: flex;
|
||||
max-width: 100%;
|
||||
margin: 4px 0 !important;
|
||||
|
||||
&:hover .av__views .block__icon {
|
||||
opacity: 1;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export const exportAsset = (src: string) => {
|
|||
};
|
||||
};
|
||||
|
||||
export const openEditorTab = (app: App, ids: string[], notebookId?: string, pathString?: string) => {
|
||||
export const openEditorTab = (app: App, ids: string[], notebookId?: string, pathString?: string, onlyGetMenus = false) => {
|
||||
/// #if !MOBILE
|
||||
const openSubmenus: IMenu[] = [{
|
||||
id: "insertRight",
|
||||
|
|
@ -159,6 +159,9 @@ export const openEditorTab = (app: App, ids: string[], notebookId?: string, path
|
|||
}
|
||||
});
|
||||
/// #endif
|
||||
if (onlyGetMenus ) {
|
||||
return openSubmenus;
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "openBy",
|
||||
label: window.siyuan.languages.openBy,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
import {getIconByType} from "../../editor/getIcon";
|
||||
import {enterBack, iframeMenu, setFold, tableMenu, videoMenu, zoomOut} from "../../menus/protyle";
|
||||
import {MenuItem} from "../../menus/Menu";
|
||||
import {copySubMenu, openAttr, openWechatNotify} from "../../menus/commonMenuItem";
|
||||
import {copySubMenu, openAttr, openFileAttr, openWechatNotify} from "../../menus/commonMenuItem";
|
||||
import {
|
||||
copyPlainText,
|
||||
isInAndroid,
|
||||
|
|
@ -285,6 +285,15 @@ export class Gutter {
|
|||
}
|
||||
blockElement.setAttribute("updated", newUpdated);
|
||||
} else {
|
||||
if (!protyle.disabled && event.shiftKey) {
|
||||
const blockId = rowElement.querySelector('[data-dtype="block"] .av__celltext--ref')?.getAttribute("data-id")
|
||||
if (blockId) {
|
||||
fetchPost("/api/attr/getBlockAttrs", {id: blockId}, (response) => {
|
||||
openFileAttr(response.data, "av", protyle);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
avContextmenu(protyle, rowElement as HTMLElement, {
|
||||
x: gutterRect.left,
|
||||
y: gutterRect.bottom,
|
||||
|
|
@ -2232,7 +2241,13 @@ export class Gutter {
|
|||
const rowElement = hasClosestByClassName(target, "av__row");
|
||||
if (rowElement && !rowElement.classList.contains("av__row--header")) {
|
||||
element = rowElement;
|
||||
html = `<button data-type="NodeAttributeViewRowMenu" data-node-id="${dataNodeId}" data-row-id="${rowElement.dataset.id}" class="ariaLabel" data-position="right" aria-label="${window.siyuan.languages.rowTip}"><svg><use xlink:href="#iconDrag"></use></svg><span ${protyle.disabled ? "" : 'draggable="true" class="fn__grab"'}></span></button>`;
|
||||
let iconAriaLabel = isMac() ? window.siyuan.languages.rowTip : window.siyuan.languages.rowTip.replace("⇧", "Shift+");
|
||||
if (protyle.disabled) {
|
||||
iconAriaLabel = window.siyuan.languages.rowTip.substring(0, window.siyuan.languages.rowTip.indexOf("<br"))
|
||||
} else if (rowElement.querySelector('[data-dtype="block"]').getAttribute("data-detached") === "true") {
|
||||
iconAriaLabel = window.siyuan.languages.rowTip.substring(0, window.siyuan.languages.rowTip.lastIndexOf("<br"))
|
||||
}
|
||||
html = `<button data-type="NodeAttributeViewRowMenu" data-node-id="${dataNodeId}" data-row-id="${rowElement.dataset.id}" class="ariaLabel" data-position="right" aria-label="${iconAriaLabel}"><svg><use xlink:href="#iconDrag"></use></svg><span ${protyle.disabled ? "" : 'draggable="true" class="fn__grab"'}></span></button>`;
|
||||
if (!protyle.disabled) {
|
||||
html = `<button data-type="NodeAttributeViewRow" data-node-id="${dataNodeId}" data-row-id="${rowElement.dataset.id}" class="ariaLabel" data-position="right" aria-label="${isMac() ? window.siyuan.languages.addBelowAbove : window.siyuan.languages.addBelowAbove.replace("⌥", "Alt+")}"><svg><use xlink:href="#iconAdd"></use></svg></button>${html}`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import {Menu} from "../../../plugin/Menu";
|
|||
import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "../../util/hasClosest";
|
||||
import {transaction} from "../../wysiwyg/transaction";
|
||||
import {openEditorTab} from "../../../menus/util";
|
||||
import {copySubMenu} from "../../../menus/commonMenuItem";
|
||||
import {copySubMenu, openFileAttr} from "../../../menus/commonMenuItem";
|
||||
import {
|
||||
addDragFill,
|
||||
genCellValueByElement,
|
||||
|
|
@ -262,8 +262,26 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
updateHeader(rowElement);
|
||||
const keyCellElement = rowElements[0].querySelector(".av__cell[data-block-id]") as HTMLElement;
|
||||
if (rowElements.length === 1 && keyCellElement.getAttribute("data-detached") !== "true") {
|
||||
/// #if !MOBILE
|
||||
const blockId = rowElements[0].getAttribute("data-id");
|
||||
openEditorTab(protyle.app, [blockId]);
|
||||
const openSubmenus = openEditorTab(protyle.app, [blockId], undefined, undefined, true);
|
||||
openSubmenus.push({type: "separator"})
|
||||
openSubmenus.push({
|
||||
icon: "iconAttr",
|
||||
label: window.siyuan.languages.attr,
|
||||
click: () => {
|
||||
fetchPost("/api/attr/getBlockAttrs", {id: blockId}, (response) => {
|
||||
openFileAttr(response.data, "av", protyle);
|
||||
});
|
||||
}
|
||||
})
|
||||
menu.addItem({
|
||||
id: "openBy",
|
||||
label: window.siyuan.languages.openBy,
|
||||
icon: "iconOpen",
|
||||
submenu: openSubmenus,
|
||||
});
|
||||
/// #endif
|
||||
menu.addItem({
|
||||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue