mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-19 02:21:38 +08:00
🚨
This commit is contained in:
parent
8a4ab0daff
commit
cd41c3b6e2
@ -29,6 +29,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--select {
|
||||||
|
background-color: var(--b3-theme-primary-lightest);
|
||||||
|
|
||||||
|
.av__firstcol svg {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&--header,
|
&--header,
|
||||||
&--footer {
|
&--footer {
|
||||||
background-color: var(--b3-theme-background);
|
background-color: var(--b3-theme-background);
|
||||||
|
@ -17,7 +17,7 @@ import {Setting} from "./Setting";
|
|||||||
|
|
||||||
export class Menu {
|
export class Menu {
|
||||||
private menu: SiyuanMenu;
|
private menu: SiyuanMenu;
|
||||||
private isOpen: boolean;
|
public isOpen: boolean;
|
||||||
|
|
||||||
constructor(id?: string, closeCB?: () => void) {
|
constructor(id?: string, closeCB?: () => void) {
|
||||||
this.menu = window.siyuan.menus.menu;
|
this.menu = window.siyuan.menus.menu;
|
||||||
|
@ -103,8 +103,11 @@ const showHeaderCellMenu = (protyle: IProtyle, blockElement: HTMLElement, cellEl
|
|||||||
|
|
||||||
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
|
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
|
||||||
const blockElement = hasClosestBlock(event.target);
|
const blockElement = hasClosestBlock(event.target);
|
||||||
|
if (!blockElement) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
const addElement = hasClosestByAttribute(event.target, "data-type", "av-header-add");
|
const addElement = hasClosestByAttribute(event.target, "data-type", "av-header-add");
|
||||||
if (addElement && blockElement) {
|
if (addElement) {
|
||||||
const menu = new Menu("av-header-add");
|
const menu = new Menu("av-header-add");
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
icon: "iconAlignLeft",
|
icon: "iconAlignLeft",
|
||||||
@ -137,8 +140,15 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const checkElement = hasClosestByClassName(event.target, "av__firstcol");
|
||||||
|
if (checkElement) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const cellElement = hasClosestByClassName(event.target, "av__cell");
|
const cellElement = hasClosestByClassName(event.target, "av__cell");
|
||||||
if (cellElement && blockElement) {
|
if (cellElement) {
|
||||||
if (cellElement.parentElement.classList.contains("av__row--header")) {
|
if (cellElement.parentElement.classList.contains("av__row--header")) {
|
||||||
showHeaderCellMenu(protyle, blockElement, cellElement);
|
showHeaderCellMenu(protyle, blockElement, cellElement);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -160,8 +170,18 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
|
|||||||
if (!blockElement) {
|
if (!blockElement) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
blockElement.querySelectorAll(".av__row--select").forEach(item => {
|
||||||
|
item.classList.remove("av__row--select");
|
||||||
|
});
|
||||||
const rowId = rowElement.getAttribute("data-id");
|
const rowId = rowElement.getAttribute("data-id");
|
||||||
const menu = new Menu("av-row");
|
const menu = new Menu("av-row");
|
||||||
|
if (menu.isOpen) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
rowElement.classList.add("av__row--select");
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
icon: "iconCopy",
|
icon: "iconCopy",
|
||||||
label: window.siyuan.languages.duplicate,
|
label: window.siyuan.languages.duplicate,
|
||||||
@ -222,8 +242,6 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
|
|||||||
x: event.clientX,
|
x: event.clientX,
|
||||||
y: event.clientY,
|
y: event.clientY,
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
|
|||||||
const cellRect = cellElement.getBoundingClientRect();
|
const cellRect = cellElement.getBoundingClientRect();
|
||||||
let html = "";
|
let html = "";
|
||||||
if (type === "block") {
|
if (type === "block") {
|
||||||
html = `<textarea style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px" class="b3-text-field fn__size200">${cellElement.textContent}</textarea>`;
|
html = `<textarea style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 200)}px" class="b3-text-field">${cellElement.textContent}</textarea>`;
|
||||||
}
|
}
|
||||||
document.body.insertAdjacentHTML("beforeend", `<div class="av__mask">
|
document.body.insertAdjacentHTML("beforeend", `<div class="av__mask">
|
||||||
${html}
|
${html}
|
||||||
|
Loading…
Reference in New Issue
Block a user