Vanessa 2023-09-27 23:13:32 +08:00
parent 81eaf66621
commit 803fb6def8
3 changed files with 17 additions and 16 deletions

View file

@ -171,14 +171,21 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
const addRowElement = hasClosestByClassName(event.target, "av__row--add");
if (addRowElement) {
if (protyle.hint.element.classList.contains("fn__none")) {
protyle.toolbar.range = document.createRange();
protyle.toolbar.range.selectNodeContents(blockElement.querySelector(".av__title"));
focusByRange(protyle.toolbar.range);
hintRef("", protyle, "av");
} else {
hideElements(["hint"], protyle);
}
const avID = blockElement.getAttribute("data-av-id");
const srcIDs = [Lute.NewNodeID()]
const previousID = addRowElement.getAttribute("data-id") || "", ;
transaction(protyle, [{
action: "insertAttrViewBlock",
avID,
previousID,
srcIDs,
isDetached: true,
}], [{
action: "removeAttrViewBlock",
srcIDs,
avID,
}]);
insertAttrViewBlockAnimation(blockElement, 1, previousID);
event.preventDefault();
event.stopPropagation();
return true;

View file

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

View file

@ -373,6 +373,7 @@ interface IOperation {
previousID?: string
retData?: any
nextID?: string // insert 专享
isDetached?: boolean // insertAttrViewBlock 专享
srcIDs?: string[] // insertAttrViewBlock 专享
name?: string // addAttrViewCol 专享
type?: TAVCol // addAttrViewCol 专享