mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-05 16:28:49 +01:00
This commit is contained in:
parent
ff5875f7d7
commit
d362524d0e
3 changed files with 23 additions and 1 deletions
|
|
@ -227,6 +227,7 @@ export const openGalleryItemMenu = (options: {
|
|||
target: HTMLElement,
|
||||
blockElement: HTMLElement,
|
||||
protyle: IProtyle,
|
||||
returnMenu: boolean
|
||||
}) => {
|
||||
const menu = new Menu();
|
||||
const avID = options.blockElement.getAttribute("data-av-id");
|
||||
|
|
@ -267,6 +268,9 @@ export const openGalleryItemMenu = (options: {
|
|||
}
|
||||
}
|
||||
});
|
||||
if (options.returnMenu) {
|
||||
return menu;
|
||||
}
|
||||
const rect = options.target.getBoundingClientRect();
|
||||
menu.open({
|
||||
x: rect.left,
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ export const getSwitcherHTML = (views: IAVView[], viewId: string) => {
|
|||
html += `<button draggable="true" class="b3-menu__item${item.id === viewId ? " b3-menu__item--current" : ""}" data-id="${item.id}">
|
||||
<svg class="b3-menu__icon fn__grab"><use xlink:href="#iconDrag"></use></svg>
|
||||
<div class="b3-menu__label fn__flex" data-type="av-view-switch" data-av-type="${item.type}">
|
||||
${item.icon ? unicode2Emoji(item.icon, "b3-menu__icon", true) : '<svg class="b3-menu__icon"><use xlink:href="#iconTable"></use></svg>'}
|
||||
${item.icon ? unicode2Emoji(item.icon, "b3-menu__icon", true) : `<svg class="b3-menu__icon"><use xlink:href="#${getViewIcon(item.type)}"></use></svg>`}
|
||||
<span class="fn__ellipsis">${item.name}</span>
|
||||
</div>
|
||||
<svg class="b3-menu__action" data-type="av-view-edit"><use xlink:href="#iconEdit"></use></svg>
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ import {editAssetItem} from "../render/av/asset";
|
|||
import {img3115} from "../../boot/compatibleVersion";
|
||||
import {globalClickHideMenu} from "../../boot/globalEvent/click";
|
||||
import {hideTooltip} from "../../dialog/tooltip";
|
||||
import {openGalleryItemMenu} from "../render/av/gallery/util";
|
||||
|
||||
export class WYSIWYG {
|
||||
public lastHTMLs: { [key: string]: string } = {};
|
||||
|
|
@ -1794,6 +1795,23 @@ export class WYSIWYG {
|
|||
if (!nodeElement) {
|
||||
return false;
|
||||
}
|
||||
const avGalleryItemElement = hasClosestByClassName(target, "av__gallery-item");
|
||||
if (avGalleryItemElement) {
|
||||
avGalleryItemElement.classList.add("av__gallery-item--select");
|
||||
const menu = openGalleryItemMenu({
|
||||
target: avGalleryItemElement.querySelector('.protyle-icon--last'),
|
||||
blockElement: nodeElement,
|
||||
protyle,
|
||||
returnMenu: true
|
||||
});
|
||||
menu.open({
|
||||
x: event.clientX,
|
||||
y: event.clientY
|
||||
});
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
const avCellElement = hasClosestByClassName(target, "av__cell");
|
||||
if (avCellElement) {
|
||||
if (avCellElement.classList.contains("av__cell--header")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue