Skip to content

Commit

Permalink
🎨 fix #11403
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed May 15, 2024
1 parent 681489b commit 0fa75ec
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
4 changes: 4 additions & 0 deletions app/src/assets/scss/business/_av.scss
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@
white-space: nowrap;
}

&[data-block-id] > .block__icon[data-type="copy"] {
display: none;
}

&.dragover__right {
border-right-color: var(--b3-theme-primary-lighter);
}
Expand Down
4 changes: 4 additions & 0 deletions app/src/assets/scss/protyle/_wysiwyg.scss
Original file line number Diff line number Diff line change
Expand Up @@ -670,5 +670,9 @@
.av__cell--header:hover {
background-color: transparent;
}

.av__cell[data-block-id] > .block__icon[data-type="copy"] {
display: block;
}
}
}
3 changes: 3 additions & 0 deletions app/src/protyle/render/av/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {addView, openViewMenu} from "./view";
import {isOnlyMeta, writeText} from "../../util/compatibility";
import {openSearchAV} from "./relation";
import {Constants} from "../../../constants";
import {hideElements} from "../../ui/hideElements";

export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
if (isOnlyMeta(event)) {
Expand Down Expand Up @@ -164,6 +165,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
event.stopPropagation();
return true;
} else if (type === "block-more") {
window.siyuan.menus.menu.remove();
protyle.toolbar.range = document.createRange();
protyle.toolbar.range.selectNodeContents(target);
focusByRange(protyle.toolbar.range);
Expand Down Expand Up @@ -231,6 +233,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
};

export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, position: IPosition) => {
hideElements(["hint"], protyle);
if (rowElement.classList.contains("av__row--header")) {
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions app/src/protyle/render/av/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,9 @@ export const renderCell = (cellValue: IAVCellValue, rowIndex = 0) => {
}
}

if (["text", "template", "url", "email", "phone", "number", "date", "created", "updated", "lineNumber"].includes(cellValue.type) &&
(cellValue.type === "lineNumber" || (cellValue && cellValue[cellValue.type as "url"].content))) {
if ((["text", "template", "url", "email", "phone", "number", "date", "created", "updated"].includes(cellValue.type) && cellValue[cellValue.type as "url"]?.content) ||
cellValue.type === "lineNumber" ||
(cellValue.type === "block" && cellValue.block?.content)) {
text += `<span ${cellValue.type !== "number" ? "" : 'style="right:auto;left:5px"'} data-type="copy" class="block__icon"><svg><use xlink:href="#iconCopy"></use></svg></span>`;
}
return text;
Expand Down
7 changes: 0 additions & 7 deletions app/src/protyle/util/onGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,6 @@ export const disabledProtyle = (protyle: IProtyle) => {
protyle.wysiwyg.element.querySelectorAll('.protyle-action[draggable="true"]').forEach(item => {
item.setAttribute("draggable", "false");
});
protyle.wysiwyg.element.querySelectorAll(".av").forEach((item: HTMLElement) => {
const headerElement = item.querySelector(".av__row--header") as HTMLElement;
if (headerElement) {
headerElement.style.transform = "";
(item.querySelector(".av__row--footer") as HTMLElement).style.transform = "";
}
});
if (protyle.breadcrumb) {
protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"] use').setAttribute("xlink:href", "#iconLock");
protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"]').setAttribute("aria-label", window.siyuan.config.editor.readOnly ? window.siyuan.languages.tempUnlock : window.siyuan.languages.unlockEdit);
Expand Down

0 comments on commit 0fa75ec

Please sign in to comment.