Skip to content

Commit

Permalink
🎨 fix #9420
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 13, 2023
1 parent 8998de9 commit 55fb8b1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
6 changes: 6 additions & 0 deletions app/src/assets/scss/business/_av.scss
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@
top: 8px;
}

&--select {
background-color: var(--b3-theme-primary-lightest);
box-shadow: 2px 2px 0 var(--b3-theme-primary-lighter) inset, -2px -2px 0px var(--b3-theme-primary-lighter) inset;
border-radius: var(--b3-border-radius);
}

.block__icon {
position: absolute;
right: 5px;
Expand Down
8 changes: 6 additions & 2 deletions app/src/menus/protyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {hideElements} from "../protyle/ui/hideElements";
import {emitOpenMenu} from "../plugin/EventBus";
import {openMobileFileById} from "../mobile/editor";
import {openBacklink, openGraph} from "../layout/dock/util";
import {updateHeader} from "../protyle/render/av/col";

export const fileAnnotationRefMenu = (protyle: IProtyle, refElement: HTMLElement) => {
const nodeElement = hasClosestBlock(refElement);
Expand Down Expand Up @@ -1663,8 +1664,11 @@ export const setFold = (protyle: IProtyle, nodeElement: Element, isOpen?: boolea
focusBlock(nodeElement, undefined, false);
}
}
nodeElement.querySelectorAll(".img--select").forEach((item) => {
item.classList.remove("img--select");
nodeElement.querySelectorAll(".img--select, .av__cell--select, .av__row--select").forEach((item:HTMLElement) => {
if (item.classList.contains("av__row--select")) {
updateHeader(item);
}
item.classList.remove("img--select", "av__cell--select", "av__row--select");
});
}
const id = nodeElement.getAttribute("data-node-id");
Expand Down
1 change: 1 addition & 0 deletions app/src/protyle/render/av/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem
if (doOperations.length > 0) {
transaction(protyle, doOperations, undoOperations);
}
cellElements[0].classList.add("av__cell--select");
setTimeout(() => {
avMaskElement.remove();
});
Expand Down
12 changes: 8 additions & 4 deletions app/src/protyle/wysiwyg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import {removeSearchMark} from "../toolbar/util";
import {activeBlur, hideKeyboardToolbar} from "../../mobile/util/keyboardToolbar";
import {commonClick} from "./commonClick";
import {avClick, avContextmenu, updateAVName} from "../render/av/action";
import {updateHeader} from "../render/av/col";

export class WYSIWYG {
public lastHTMLs: { [key: string]: string } = {};
Expand Down Expand Up @@ -185,10 +186,13 @@ export class WYSIWYG {

private setEmptyOutline(protyle: IProtyle, element: HTMLElement) {
// 图片移除选择状态应放在前面,否则 https://github.com/siyuan-note/siyuan/issues/4173
const selectImgElement = protyle.wysiwyg.element.querySelector(".img--select");
if (selectImgElement) {
selectImgElement.classList.remove("img--select");
}
protyle.wysiwyg.element.querySelectorAll(".img--select, .av__cell--select, .av__row--select").forEach((item: HTMLElement) => {
if (item.classList.contains("av__row--select")) {
updateHeader(item);
}
item.classList.remove("img--select", "av__cell--select", "av__row--select");
});

let nodeElement = element;
if (!element.getAttribute("data-node-id")) {
const tempElement = hasClosestBlock(element);
Expand Down

0 comments on commit 55fb8b1

Please sign in to comment.