Vanessa 2023-07-29 11:20:57 +08:00
parent b8085a58e0
commit 2946bd4b9c
2 changed files with 16 additions and 4 deletions

View file

@ -9,6 +9,7 @@ import {emitOpenMenu} from "../../../plugin/EventBus";
import {addCol} from "./addCol";
import {openMenuPanel} from "./openMenuPanel";
import {hintRef} from "../../hint/extend";
import {hideElements} from "../../ui/hideElements";
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
const blockElement = hasClosestBlock(event.target);
@ -131,9 +132,13 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
const addRowElement = hasClosestByClassName(event.target, "av__row--add");
if (addRowElement) {
protyle.toolbar.range = document.createRange()
protyle.toolbar.range.selectNodeContents(blockElement.querySelector(".av__title"));
hintRef("", protyle, "av");
if (protyle.hint.element.classList.contains("fn__none")) {
protyle.toolbar.range = document.createRange();
protyle.toolbar.range.selectNodeContents(blockElement.querySelector(".av__title"));
hintRef("", protyle, "av");
} else {
hideElements(["hint"], protyle);
}
event.preventDefault();
event.stopPropagation();
return true;

View file

@ -1563,7 +1563,14 @@ export class WYSIWYG {
event
});
});
hideElements(["hint", "util"], protyle);
const addRowElement = hasClosestByClassName(event.target, "av__row--add");
if (addRowElement) {
hideElements(["util"], protyle);
} else {
hideElements(["hint", "util"], protyle);
}
const ctrlIsPressed = event.metaKey || event.ctrlKey;
/// #if !MOBILE
const backlinkBreadcrumbItemElement = hasClosestByClassName(event.target, "protyle-breadcrumb__item");