This commit is contained in:
Vanessa 2024-01-14 16:38:45 +08:00
parent b399b5e877
commit eb18429d6e
9 changed files with 20 additions and 21 deletions

View file

@ -27,12 +27,12 @@ export const initBlockPopover = (app: App) => {
if (aElement.classList.contains("av__cell--header")) {
const textElement = aElement.querySelector(".av__celltext");
if (textElement.scrollWidth > textElement.clientWidth + 2) {
tip = getCellText(aElement)
tip = getCellText(aElement);
}
} else if (aElement.dataset.wrap !== "true" && event.target.dataset.type !== "block-more" && !hasClosestByClassName(event.target, "block__icon")) {
aElement.style.overflow = "auto";
if (aElement.scrollWidth > aElement.clientWidth + 2) {
tip = getCellText(aElement)
tip = getCellText(aElement);
}
aElement.style.overflow = "";
}
@ -115,7 +115,7 @@ const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => {
return false;
}
const avPanelElement = hasClosestByClassName(target, "av__panel")
const avPanelElement = hasClosestByClassName(target, "av__panel");
if (avPanelElement) {
// 浮窗上点击 av 操作,浮窗不能消失
const blockPanel = window.siyuan.blockPanels.find((item) => {
@ -128,7 +128,7 @@ const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => {
}
} else {
// 浮窗上点击菜单,浮窗不能消失 https://ld246.com/article/1632668091023
const menuElement = hasClosestByClassName(target, "b3-menu")
const menuElement = hasClosestByClassName(target, "b3-menu");
if (menuElement) {
const blockPanel = window.siyuan.blockPanels.find((item) => {
if (item.element.style.zIndex < menuElement.style.zIndex) {
@ -213,7 +213,7 @@ const getTarget = (event: MouseEvent & { target: HTMLElement }, aElement: false
if (aElement.getAttribute("data-href")?.startsWith("siyuan://blocks") && aElement.getAttribute("prevent-popover") !== "true") {
popoverTargetElement = aElement;
} else if (aElement.classList.contains("av__cell")) {
const textElement = aElement.querySelector(".av__celltext--url") as HTMLElement
const textElement = aElement.querySelector(".av__celltext--url") as HTMLElement;
if (textElement && textElement.dataset.type === "url" && textElement.dataset.href?.startsWith("siyuan://blocks")) {
popoverTargetElement = textElement;
}

View file

@ -14,7 +14,6 @@ import {fetchPost, fetchSyncPost} from "../util/fetch";
import {addGA, initAssets, setInlineStyle} from "../util/assets";
import {renderSnippet} from "../config/util/snippets";
import {openFile, openFileById} from "../editor/util";
import {focusByRange} from "../protyle/util/selection";
import {exitSiYuan} from "../dialog/processSystem";
import {isWindow} from "../util/functions";
import {initStatus} from "../layout/status";

View file

@ -37,6 +37,6 @@ export const getCloudURL = (key: string) => {
};
export const getIndexURL = (key: string) => {
const lang = 'zh_CN' === window.siyuan.config.lang ? "" : "/en";
return 'https://b3log.org/siyuan' + `${lang}/${key}`;
}
const lang = "zh_CN" === window.siyuan.config.lang ? "" : "/en";
return "https://b3log.org/siyuan" + `${lang}/${key}`;
};

View file

@ -101,4 +101,4 @@ export const updateReadonly = (target: Element, protyle: IProtyle) => {
});
}
}
}
};

View file

@ -20,7 +20,7 @@ import {saveLayout, setPanelFocus} from "../../layout/util";
/// #if !BROWSER
import {ipcRenderer} from "electron";
/// #endif
import {disabledProtyle, enableProtyle, onGet} from "../util/onGet";
import {onGet} from "../util/onGet";
import {hideElements} from "../ui/hideElements";
import {confirmDialog} from "../../dialog/confirmDialog";
import {reloadProtyle} from "../util/reload";

View file

@ -26,7 +26,7 @@ export const getCellText = (cellElement: HTMLElement | false) => {
} else if (item.getAttribute("data-type") !== "block-more") {
cellText += item.textContent + ", ";
}
})
});
cellText = cellText.substring(0, cellText.length - 2);
} else {
cellText = cellElement.textContent;
@ -643,7 +643,7 @@ export const updateHeaderCell = (cellElement: HTMLElement, headerValue: {
textElement.insertAdjacentHTML("afterend", '<svg class="av__cellheadericon av__cellheadericon--pin"><use xlink:href="#iconPin"></use></svg>');
}
} else {
cellElement.querySelector(".av__cellheadericon--pin")?.remove()
cellElement.querySelector(".av__cellheadericon--pin")?.remove();
}
}
};
@ -664,4 +664,4 @@ export const getPositionByCellElement = (cellElement: HTMLElement) => {
celIndex++;
}
return {rowIndex, celIndex};
}
};

View file

@ -124,7 +124,7 @@ const setHTML = (options: {
}
protyle.block.showAll = options.action.includes(Constants.CB_GET_ALL);
const REMOVED_OVER_HEIGHT = protyle.contentElement.clientHeight * 8;
const isUpdate = protyle.wysiwyg.element.innerHTML !== ""
const isUpdate = protyle.wysiwyg.element.innerHTML !== "";
if (options.action.includes(Constants.CB_GET_APPEND)) {
// 动态加载移除
if (!protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select") && !protyle.scroll.keepLazyLoad && protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT) {

View file

@ -447,10 +447,10 @@ export class WYSIWYG {
}
nodeElement.querySelectorAll(".av__cell--select").forEach(item => {
item.classList.remove("av__cell--select");
})
});
nodeElement.querySelectorAll(".av__drag-fill").forEach(item => {
item.remove();
})
});
avCellElement.classList.add("av__cell--select");
const originIndex = getPositionByCellElement(avCellElement);
let moveCellElement: HTMLElement;
@ -465,7 +465,7 @@ export class WYSIWYG {
const newIndex = getPositionByCellElement(moveCellElement);
nodeElement.querySelectorAll(".av__cell--active").forEach((item: HTMLElement) => {
item.classList.remove("av__cell--active");
})
});
nodeElement.querySelectorAll(".av__row").forEach((rowElement: HTMLElement, index: number) => {
if (index >= Math.min(originIndex.rowIndex, newIndex.rowIndex) && index <= Math.max(originIndex.rowIndex, newIndex.rowIndex)) {
rowElement.querySelectorAll(".av__cell").forEach((cellElement: HTMLElement, cellIndex: number) => {
@ -475,7 +475,7 @@ export class WYSIWYG {
}
});
}
})
});
}
};
@ -487,7 +487,7 @@ export class WYSIWYG {
documentSelf.onselect = null;
if (lastCellElement) {
focusBlock(nodeElement);
lastCellElement.insertAdjacentHTML("beforeend", `<div aria-label="${window.siyuan.languages.dragFill}" class="av__drag-fill ariaLabel"></div>`)
lastCellElement.insertAdjacentHTML("beforeend", `<div aria-label="${window.siyuan.languages.dragFill}" class="av__drag-fill ariaLabel"></div>`);
this.preventClick = true;
}
return false;

View file

@ -37,7 +37,7 @@ import {fontEvent} from "../toolbar/Font";
import {listIndent, listOutdent} from "./list";
import {newFileContentBySelect, rename, replaceFileName} from "../../editor/rename";
import {insertEmptyBlock, jumpToParentNext} from "../../block/util";
import {isLocalPath, pathPosix} from "../../util/pathName";
import {isLocalPath} from "../../util/pathName";
/// #if !MOBILE
import {openBy, openFileById} from "../../editor/util";
/// #endif