mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-28 18:00:15 +01:00
This commit is contained in:
parent
7a7af86b11
commit
334a2385b3
13 changed files with 37 additions and 35 deletions
|
|
@ -19,6 +19,17 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
|||
if (!blockElement) {
|
||||
return false;
|
||||
}
|
||||
const copyElement = hasClosestByAttribute(event.target, "data-type", "copy");
|
||||
if (copyElement) {
|
||||
writeText(copyElement.previousElementSibling.textContent.trim());
|
||||
showMessage(window.siyuan.languages.copied);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
}
|
||||
if (protyle.disabled) {
|
||||
return false;
|
||||
}
|
||||
const addElement = hasClosestByAttribute(event.target, "data-type", "av-header-add");
|
||||
if (addElement) {
|
||||
const addMenu = addCol(protyle, blockElement);
|
||||
|
|
@ -105,15 +116,6 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
|||
return true;
|
||||
}
|
||||
|
||||
const copyElement = hasClosestByAttribute(event.target, "data-type", "copy");
|
||||
if (copyElement) {
|
||||
writeText(copyElement.previousElementSibling.textContent.trim());
|
||||
showMessage(window.siyuan.languages.copied);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
}
|
||||
|
||||
const linkElement = hasClosestByClassName(event.target, "av__celltext--url");
|
||||
if (linkElement) {
|
||||
let prefix = "";
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import {hasClosestByAttribute} from "../../util/hasClosest";
|
|||
import {Menu} from "../../../plugin/Menu";
|
||||
import {escapeAttr} from "../../../util/escape";
|
||||
|
||||
export const avRender = (element: Element, cb?: () => void) => {
|
||||
export const avRender = (element: Element, protyle: IProtyle, cb?: () => void) => {
|
||||
let avElements: Element[] = [];
|
||||
if (element.getAttribute("data-type") === "NodeAttributeView") {
|
||||
// 编辑器内代码块编辑渲染
|
||||
|
|
@ -138,7 +138,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
|||
</span>
|
||||
<div class="fn__space"></div>
|
||||
</div>
|
||||
<div contenteditable="true" class="av__title" data-title="${data.name || ""}" data-tip="${window.siyuan.languages.title}">${response.data.name || ""}</div>
|
||||
<div contenteditable="${protyle.disabled ? "false" : "true"}" spellcheck="${window.siyuan.config.editor.spellcheck.toString()}" class="av__title" data-title="${data.name || ""}" data-tip="${window.siyuan.languages.title}">${response.data.name || ""}</div>
|
||||
<div class="av__counter fn__none"></div>
|
||||
</div>
|
||||
<div class="av__scroll">
|
||||
|
|
@ -174,7 +174,7 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
|||
if (operation.action === "addAttrViewCol") {
|
||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${avId}"]`)).forEach((item: HTMLElement) => {
|
||||
item.removeAttribute("data-render");
|
||||
avRender(item, () => {
|
||||
avRender(item, protyle, () => {
|
||||
showColMenu(protyle, item, item.querySelector(`.av__row--header .av__cell[data-col-id="${operation.id}"]`));
|
||||
});
|
||||
});
|
||||
|
|
@ -200,7 +200,7 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
|||
} else {
|
||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${avId}"]`)).forEach((item: HTMLElement) => {
|
||||
item.removeAttribute("data-render");
|
||||
avRender(item);
|
||||
avRender(item, protyle);
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export const blockRender = (protyle: IProtyle, element: Element, top?: number) =
|
|||
|
||||
processRender(item);
|
||||
highlightRender(item);
|
||||
avRender(item);
|
||||
avRender(item, protyle);
|
||||
if (top) {
|
||||
// 前进后退定位 https://ld246.com/article/1667652729995
|
||||
protyle.contentElement.scrollTop = top;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue