This commit is contained in:
parent
5ff5f36af7
commit
bda97eaef5
2 changed files with 31 additions and 16 deletions
|
@ -33,6 +33,7 @@ import {Constants} from "../../../constants";
|
|||
import {hideElements} from "../../ui/hideElements";
|
||||
import {fetchPost, fetchSyncPost} from "../../../util/fetch";
|
||||
import {scrollCenter} from "../../../util/highlightById";
|
||||
import {escapeHtml} from "../../../util/escape";
|
||||
|
||||
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
|
||||
if (isOnlyMeta(event)) {
|
||||
|
@ -288,17 +289,31 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
});
|
||||
/// #endif
|
||||
}
|
||||
let copyMenu: IMenu[] = [];
|
||||
if (rowElements.length === 1 && keyCellElement.getAttribute("data-detached") === "true") {
|
||||
copyMenu.push({
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages["_attrView"].key,
|
||||
click() {
|
||||
writeText(rowElements[0].querySelector('.av__cell[data-dtype="block"] .av__celltext').textContent);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
copyMenu = [{
|
||||
let hasBlock = false
|
||||
rowElements.forEach((item, i) => {
|
||||
if (item.querySelector('.av__cell[data-dtype="block"]').getAttribute("data-detached") !== "true") {
|
||||
hasBlock = true
|
||||
}
|
||||
})
|
||||
const copyMenu: IMenu[] = [{
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.keyContent,
|
||||
click() {
|
||||
let text = ""
|
||||
rowElements.forEach((item, i) => {
|
||||
if (rowElements.length > 1) {
|
||||
text += "* ";
|
||||
}
|
||||
text += item.querySelector('.av__cell[data-dtype="block"] .av__celltext').textContent.trim();
|
||||
if (ids.length > 1 && i !== ids.length - 1) {
|
||||
text += "\n";
|
||||
}
|
||||
})
|
||||
writeText(text);
|
||||
}
|
||||
}];
|
||||
if (hasBlock) {
|
||||
copyMenu.splice(1, 0, {
|
||||
id: "copyBlockRef",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.copyBlockRef,
|
||||
|
@ -443,7 +458,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
});
|
||||
writeText(text);
|
||||
}
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
menu.addItem({
|
||||
|
@ -572,7 +587,7 @@ ${window.siyuan.languages.insertRowAfter.replace("${x}", '<span class="fn__space
|
|||
const icon = cellElement.dataset.icon;
|
||||
editAttrSubmenu.push({
|
||||
iconHTML: icon ? unicode2Emoji(icon, "b3-menu__icon", true) : `<svg class="b3-menu__icon"><use xlink:href="#${getColIconByType(type)}"></use></svg>`,
|
||||
label: cellElement.querySelector(".av__celltext").textContent.trim(),
|
||||
label: escapeHtml(cellElement.querySelector(".av__celltext").textContent.trim()),
|
||||
click() {
|
||||
popTextCell(protyle, selectElements);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import {bindRelationEvent, getRelationHTML, openSearchAV, setRelationCell, updat
|
|||
import {bindRollupData, getRollupHTML, goSearchRollupCol} from "./rollup";
|
||||
import {updateCellsValue} from "./cell";
|
||||
import {openCalcMenu} from "./calc";
|
||||
import {escapeAttr} from "../../../util/escape";
|
||||
import {escapeAttr, escapeHtml} from "../../../util/escape";
|
||||
import {Dialog} from "../../../dialog";
|
||||
|
||||
export const openMenuPanel = (options: {
|
||||
|
@ -1336,7 +1336,7 @@ export const getPropertiesHTML = (data: IAVTable) => {
|
|||
<svg class="b3-menu__icon fn__grab"><use xlink:href="#iconDrag"></use></svg>
|
||||
<div class="b3-menu__label fn__flex">
|
||||
${item.icon ? unicode2Emoji(item.icon, "b3-menu__icon", true) : `<svg class="b3-menu__icon"><use xlink:href="#${getColIconByType(item.type)}"></use></svg>`}
|
||||
${item.name || " "}
|
||||
${escapeHtml(item.name) || " "}
|
||||
</div>
|
||||
<svg class="b3-menu__action" data-type="showCol"><use xlink:href="#iconEye"></use></svg>
|
||||
<svg class="b3-menu__icon b3-menu__icon--small"><use xlink:href="#iconRight"></use></svg>
|
||||
|
@ -1346,7 +1346,7 @@ export const getPropertiesHTML = (data: IAVTable) => {
|
|||
<svg class="b3-menu__icon fn__grab"><use xlink:href="#iconDrag"></use></svg>
|
||||
<div class="b3-menu__label fn__flex">
|
||||
${item.icon ? unicode2Emoji(item.icon, "b3-menu__icon", true) : `<svg class="b3-menu__icon"><use xlink:href="#${getColIconByType(item.type)}"></use></svg>`}
|
||||
${item.name || " "}
|
||||
${escapeHtml(item.name) || " "}
|
||||
</div>
|
||||
<svg class="b3-menu__action${item.type === "block" ? " fn__none" : ""}" data-type="hideCol"><use xlink:href="#iconEyeoff"></use></svg>
|
||||
<svg class="b3-menu__icon b3-menu__icon--small"><use xlink:href="#iconRight"></use></svg>
|
||||
|
|
Loading…
Add table
Reference in a new issue