mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
This commit is contained in:
parent
a742bd49a6
commit
2889872b89
2 changed files with 21 additions and 4 deletions
|
|
@ -257,7 +257,7 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: I
|
||||||
dialog.element.addEventListener("click", (event) => {
|
dialog.element.addEventListener("click", (event) => {
|
||||||
let target = event.target as HTMLElement;
|
let target = event.target as HTMLElement;
|
||||||
if (typeof event.detail === "string") {
|
if (typeof event.detail === "string") {
|
||||||
target = dialog.element.querySelector('.item--full[data-type="NodeAttributeView"]');
|
target = dialog.element.querySelector(`.item--full[data-type="${event.detail}"]`);
|
||||||
}
|
}
|
||||||
while (!target.isSameNode(dialog.element)) {
|
while (!target.isSameNode(dialog.element)) {
|
||||||
const type = target.dataset.action;
|
const type = target.dataset.action;
|
||||||
|
|
@ -358,13 +358,15 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: I
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialog.element.querySelectorAll(".b3-text-field").forEach((item: HTMLInputElement) => {
|
dialog.element.querySelectorAll(".b3-text-field").forEach((item: HTMLInputElement) => {
|
||||||
if (focusName !== "av" && focusName === item.getAttribute("data-name")) {
|
if (focusName !== "av" && focusName !== "custom" && focusName === item.getAttribute("data-name")) {
|
||||||
item.focus();
|
item.focus();
|
||||||
}
|
}
|
||||||
bindAttrInput(item, attrs.id);
|
bindAttrInput(item, attrs.id);
|
||||||
});
|
});
|
||||||
if (focusName === "av") {
|
if (focusName === "av") {
|
||||||
dialog.element.dispatchEvent(new CustomEvent("click", {detail: "av"}));
|
dialog.element.dispatchEvent(new CustomEvent("click", {detail: "NodeAttributeView"}));
|
||||||
|
} else if (focusName === "custom") {
|
||||||
|
dialog.element.dispatchEvent(new CustomEvent("click", {detail: "custom"}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import {Model} from "../layout/Model";
|
||||||
import {getDockByType} from "../layout/tabUtil";
|
import {getDockByType} from "../layout/tabUtil";
|
||||||
import {getAllEditor, getAllModels} from "../layout/getAll";
|
import {getAllEditor, getAllModels} from "../layout/getAll";
|
||||||
import {openSetting} from "../config";
|
import {openSetting} from "../config";
|
||||||
|
import {openAttr, openFileAttr} from "../menus/commonMenuItem";
|
||||||
|
|
||||||
let openTab;
|
let openTab;
|
||||||
let openWindow;
|
let openWindow;
|
||||||
|
|
@ -177,6 +178,19 @@ const getModelByDockType = (type: TDock | string) => {
|
||||||
/// #endif
|
/// #endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const openAttributePanel = (options: {
|
||||||
|
data?: IObject // 块属性值
|
||||||
|
nodeElement?: HTMLElement, // 块元素
|
||||||
|
focusName: "bookmark" | "name" | "alias" | "memo" | "av" | "custom", // av 为数据库页签,custom 为自定义页签,其余为内置输入框
|
||||||
|
protyle?: IProtyle, // 有数据库时需要传入 protyle
|
||||||
|
}) => {
|
||||||
|
if (options.data) {
|
||||||
|
openFileAttr(options.data, options.focusName, options.protyle);
|
||||||
|
} else {
|
||||||
|
openAttr(options.nodeElement, options.focusName, options.protyle);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const API = {
|
export const API = {
|
||||||
adaptHotkey: updateHotkeyTip,
|
adaptHotkey: updateHotkeyTip,
|
||||||
confirm: confirmDialog,
|
confirm: confirmDialog,
|
||||||
|
|
@ -201,5 +215,6 @@ export const API = {
|
||||||
getAllEditor,
|
getAllEditor,
|
||||||
getAllModels,
|
getAllModels,
|
||||||
platformUtils,
|
platformUtils,
|
||||||
openSetting
|
openSetting,
|
||||||
|
openAttributePanel,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue