mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-08 03:41:49 +08:00
This commit is contained in:
parent
5ff5f36af7
commit
bda97eaef5
@ -33,6 +33,7 @@ import {Constants} from "../../../constants";
|
|||||||
import {hideElements} from "../../ui/hideElements";
|
import {hideElements} from "../../ui/hideElements";
|
||||||
import {fetchPost, fetchSyncPost} from "../../../util/fetch";
|
import {fetchPost, fetchSyncPost} from "../../../util/fetch";
|
||||||
import {scrollCenter} from "../../../util/highlightById";
|
import {scrollCenter} from "../../../util/highlightById";
|
||||||
|
import {escapeHtml} from "../../../util/escape";
|
||||||
|
|
||||||
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
|
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
|
||||||
if (isOnlyMeta(event)) {
|
if (isOnlyMeta(event)) {
|
||||||
@ -288,17 +289,31 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||||||
});
|
});
|
||||||
/// #endif
|
/// #endif
|
||||||
}
|
}
|
||||||
let copyMenu: IMenu[] = [];
|
let hasBlock = false
|
||||||
if (rowElements.length === 1 && keyCellElement.getAttribute("data-detached") === "true") {
|
rowElements.forEach((item, i) => {
|
||||||
copyMenu.push({
|
if (item.querySelector('.av__cell[data-dtype="block"]').getAttribute("data-detached") !== "true") {
|
||||||
iconHTML: "",
|
hasBlock = true
|
||||||
label: window.siyuan.languages["_attrView"].key,
|
}
|
||||||
click() {
|
})
|
||||||
writeText(rowElements[0].querySelector('.av__cell[data-dtype="block"] .av__celltext').textContent);
|
const copyMenu: IMenu[] = [{
|
||||||
}
|
iconHTML: "",
|
||||||
});
|
label: window.siyuan.languages.keyContent,
|
||||||
} else {
|
click() {
|
||||||
copyMenu = [{
|
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",
|
id: "copyBlockRef",
|
||||||
iconHTML: "",
|
iconHTML: "",
|
||||||
label: window.siyuan.languages.copyBlockRef,
|
label: window.siyuan.languages.copyBlockRef,
|
||||||
@ -443,7 +458,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||||||
});
|
});
|
||||||
writeText(text);
|
writeText(text);
|
||||||
}
|
}
|
||||||
}];
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
@ -572,7 +587,7 @@ ${window.siyuan.languages.insertRowAfter.replace("${x}", '<span class="fn__space
|
|||||||
const icon = cellElement.dataset.icon;
|
const icon = cellElement.dataset.icon;
|
||||||
editAttrSubmenu.push({
|
editAttrSubmenu.push({
|
||||||
iconHTML: icon ? unicode2Emoji(icon, "b3-menu__icon", true) : `<svg class="b3-menu__icon"><use xlink:href="#${getColIconByType(type)}"></use></svg>`,
|
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() {
|
click() {
|
||||||
popTextCell(protyle, selectElements);
|
popTextCell(protyle, selectElements);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import {bindRelationEvent, getRelationHTML, openSearchAV, setRelationCell, updat
|
|||||||
import {bindRollupData, getRollupHTML, goSearchRollupCol} from "./rollup";
|
import {bindRollupData, getRollupHTML, goSearchRollupCol} from "./rollup";
|
||||||
import {updateCellsValue} from "./cell";
|
import {updateCellsValue} from "./cell";
|
||||||
import {openCalcMenu} from "./calc";
|
import {openCalcMenu} from "./calc";
|
||||||
import {escapeAttr} from "../../../util/escape";
|
import {escapeAttr, escapeHtml} from "../../../util/escape";
|
||||||
import {Dialog} from "../../../dialog";
|
import {Dialog} from "../../../dialog";
|
||||||
|
|
||||||
export const openMenuPanel = (options: {
|
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>
|
<svg class="b3-menu__icon fn__grab"><use xlink:href="#iconDrag"></use></svg>
|
||||||
<div class="b3-menu__label fn__flex">
|
<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.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>
|
</div>
|
||||||
<svg class="b3-menu__action" data-type="showCol"><use xlink:href="#iconEye"></use></svg>
|
<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>
|
<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>
|
<svg class="b3-menu__icon fn__grab"><use xlink:href="#iconDrag"></use></svg>
|
||||||
<div class="b3-menu__label fn__flex">
|
<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.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>
|
</div>
|
||||||
<svg class="b3-menu__action${item.type === "block" ? " fn__none" : ""}" data-type="hideCol"><use xlink:href="#iconEyeoff"></use></svg>
|
<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>
|
<svg class="b3-menu__icon b3-menu__icon--small"><use xlink:href="#iconRight"></use></svg>
|
||||||
|
Loading…
Reference in New Issue
Block a user