mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🚨
This commit is contained in:
parent
23bece401f
commit
45c389629a
9 changed files with 32 additions and 32 deletions
|
|
@ -68,7 +68,7 @@ export const fileAnnotationRefMenu = (protyle: IProtyle, refElement: HTMLElement
|
||||||
} else {
|
} else {
|
||||||
refElement.innerHTML = "*";
|
refElement.innerHTML = "*";
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
anchorElement.addEventListener("input", (event: KeyboardEvent) => {
|
anchorElement.addEventListener("input", (event: KeyboardEvent) => {
|
||||||
if (event.isComposing) {
|
if (event.isComposing) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -49,4 +49,4 @@ export const emitOpenMenu = (options: {
|
||||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import {
|
||||||
} from "../util/selection";
|
} from "../util/selection";
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
||||||
import {replaceFileName, validateName} from "../../editor/rename";
|
import {replaceFileName, validateName} from "../../editor/rename";
|
||||||
import {MenuItem, subMenu} from "../../menus/Menu";
|
import {MenuItem} from "../../menus/Menu";
|
||||||
import {
|
import {
|
||||||
copySubMenu,
|
copySubMenu,
|
||||||
movePathToMenu,
|
movePathToMenu,
|
||||||
|
|
|
||||||
|
|
@ -133,18 +133,18 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
||||||
if (checkElement) {
|
if (checkElement) {
|
||||||
window.siyuan.menus.menu.remove();
|
window.siyuan.menus.menu.remove();
|
||||||
const rowElement = checkElement.parentElement;
|
const rowElement = checkElement.parentElement;
|
||||||
const useElement = checkElement.querySelector("use")
|
const useElement = checkElement.querySelector("use");
|
||||||
if (rowElement.classList.contains("av__row--header")) {
|
if (rowElement.classList.contains("av__row--header")) {
|
||||||
if ("#iconCheck" === useElement.getAttribute("xlink:href")) {
|
if ("#iconCheck" === useElement.getAttribute("xlink:href")) {
|
||||||
rowElement.parentElement.querySelectorAll(".av__firstcol").forEach(item => {
|
rowElement.parentElement.querySelectorAll(".av__firstcol").forEach(item => {
|
||||||
item.querySelector("use").setAttribute("xlink:href", "#iconUncheck");
|
item.querySelector("use").setAttribute("xlink:href", "#iconUncheck");
|
||||||
item.parentElement.classList.remove("av__row--select");
|
item.parentElement.classList.remove("av__row--select");
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
rowElement.parentElement.querySelectorAll(".av__firstcol").forEach(item => {
|
rowElement.parentElement.querySelectorAll(".av__firstcol").forEach(item => {
|
||||||
item.querySelector("use").setAttribute("xlink:href", "#iconCheck");
|
item.querySelector("use").setAttribute("xlink:href", "#iconCheck");
|
||||||
item.parentElement.classList.add("av__row--select");
|
item.parentElement.classList.add("av__row--select");
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (useElement.getAttribute("xlink:href") === "#iconUncheck") {
|
if (useElement.getAttribute("xlink:href") === "#iconUncheck") {
|
||||||
|
|
@ -181,7 +181,7 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (rowElement.classList.contains("av__row--header")) {
|
if (rowElement.classList.contains("av__row--header")) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
const blockElement = hasClosestBlock(rowElement);
|
const blockElement = hasClosestBlock(rowElement);
|
||||||
if (!blockElement) {
|
if (!blockElement) {
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,9 @@ const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVC
|
||||||
}
|
}
|
||||||
const avMaskElement = document.querySelector(".av__mask");
|
const avMaskElement = document.querySelector(".av__mask");
|
||||||
const inputElement = avMaskElement.querySelector(".b3-text-field") as HTMLInputElement;
|
const inputElement = avMaskElement.querySelector(".b3-text-field") as HTMLInputElement;
|
||||||
const cellId = cellElement.getAttribute("data-id")
|
const cellId = cellElement.getAttribute("data-id");
|
||||||
const avId = blockElement.getAttribute("data-av-id")
|
const avId = blockElement.getAttribute("data-av-id");
|
||||||
const rowId = rowElement.getAttribute("data-id")
|
const rowId = rowElement.getAttribute("data-id");
|
||||||
transaction(protyle, [{
|
transaction(protyle, [{
|
||||||
action: "updateAttrViewCell",
|
action: "updateAttrViewCell",
|
||||||
id: cellId,
|
id: cellId,
|
||||||
|
|
@ -90,7 +90,7 @@ const removeCol = (cellElement: HTMLElement) => {
|
||||||
export const showHeaderCellMenu = (protyle: IProtyle, blockElement: HTMLElement, cellElement: HTMLElement) => {
|
export const showHeaderCellMenu = (protyle: IProtyle, blockElement: HTMLElement, cellElement: HTMLElement) => {
|
||||||
const type = cellElement.getAttribute("data-dtype") as TAVCol;
|
const type = cellElement.getAttribute("data-dtype") as TAVCol;
|
||||||
const menu = new Menu("av-header-cell", () => {
|
const menu = new Menu("av-header-cell", () => {
|
||||||
const newValue = (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement).value
|
const newValue = (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement).value;
|
||||||
if (newValue === cellElement.textContent.trim()) {
|
if (newValue === cellElement.textContent.trim()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,26 +14,26 @@ export const updateHeader = (rowElement: HTMLElement) => {
|
||||||
if (!blockElement) {
|
if (!blockElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const selectCount = rowElement.parentElement.querySelectorAll(".av__row--select:not(.av__row--header)").length
|
const selectCount = rowElement.parentElement.querySelectorAll(".av__row--select:not(.av__row--header)").length;
|
||||||
const diffCount = rowElement.parentElement.childElementCount - 3 - selectCount
|
const diffCount = rowElement.parentElement.childElementCount - 3 - selectCount;
|
||||||
const headElement = rowElement.parentElement.firstElementChild
|
const headElement = rowElement.parentElement.firstElementChild;
|
||||||
const headUseElement = headElement.querySelector("use")
|
const headUseElement = headElement.querySelector("use");
|
||||||
const counterElement = blockElement.querySelector(".av__counter")
|
const counterElement = blockElement.querySelector(".av__counter");
|
||||||
const avHeadElement = blockElement.querySelector(".av__header") as HTMLElement
|
const avHeadElement = blockElement.querySelector(".av__header") as HTMLElement;
|
||||||
if (diffCount === 0) {
|
if (diffCount === 0) {
|
||||||
headElement.classList.add("av__row--select");
|
headElement.classList.add("av__row--select");
|
||||||
headUseElement.setAttribute("xlink:href", "#iconCheck");
|
headUseElement.setAttribute("xlink:href", "#iconCheck");
|
||||||
} else if (diffCount === rowElement.parentElement.childElementCount - 3) {
|
} else if (diffCount === rowElement.parentElement.childElementCount - 3) {
|
||||||
headElement.classList.remove("av__row--select");
|
headElement.classList.remove("av__row--select");
|
||||||
headUseElement.setAttribute("xlink:href", "#iconUncheck");
|
headUseElement.setAttribute("xlink:href", "#iconUncheck");
|
||||||
counterElement.classList.add("fn__none")
|
counterElement.classList.add("fn__none");
|
||||||
avHeadElement.style.position = ""
|
avHeadElement.style.position = "";
|
||||||
return;
|
return;
|
||||||
} else if (diffCount > 0) {
|
} else if (diffCount > 0) {
|
||||||
headElement.classList.add("av__row--select");
|
headElement.classList.add("av__row--select");
|
||||||
headUseElement.setAttribute("xlink:href", "#iconIndeterminateCheck");
|
headUseElement.setAttribute("xlink:href", "#iconIndeterminateCheck");
|
||||||
}
|
}
|
||||||
counterElement.classList.remove("fn__none")
|
counterElement.classList.remove("fn__none");
|
||||||
counterElement.innerHTML = `${selectCount} selected`
|
counterElement.innerHTML = `${selectCount} selected`;
|
||||||
avHeadElement.style.position = "sticky"
|
avHeadElement.style.position = "sticky";
|
||||||
}
|
};
|
||||||
|
|
|
||||||
|
|
@ -48,19 +48,19 @@ export const avRender = (element: Element, cb?: () => void) => {
|
||||||
</div>
|
</div>
|
||||||
<div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>`;
|
<div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>`;
|
||||||
row.cells.forEach((cell, index) => {
|
row.cells.forEach((cell, index) => {
|
||||||
let text: string
|
let text: string;
|
||||||
if (cell.valueType === "text") {
|
if (cell.valueType === "text") {
|
||||||
text = cell.value?.text.content || ""
|
text = cell.value?.text.content || "";
|
||||||
} else if (cell.valueType === "block") {
|
} else if (cell.valueType === "block") {
|
||||||
text = cell.value?.block.content || ""
|
text = cell.value?.block.content || "";
|
||||||
} else if (cell.valueType === "number") {
|
} else if (cell.valueType === "number") {
|
||||||
text = cell.value?.number.content || ""
|
text = cell.value?.number.content || "";
|
||||||
} else if (cell.valueType === "select") {
|
} else if (cell.valueType === "select") {
|
||||||
text = cell.value?.select.content || ""
|
text = cell.value?.select.content || "";
|
||||||
} else if (cell.valueType === "mSelect") {
|
} else if (cell.valueType === "mSelect") {
|
||||||
text = cell.value?.mSelect.content || ""
|
text = cell.value?.mSelect.content || "";
|
||||||
} else if (cell.valueType === "date") {
|
} else if (cell.valueType === "date") {
|
||||||
text = cell.value?.date.content || ""
|
text = cell.value?.date.content || "";
|
||||||
}
|
}
|
||||||
tableHTML += `<div class="av__cell" ${index === 0 ? 'data-block-id="' + (cell.value.block.id || "") + '"' : ""} data-id="${cell.id}" data-index="${index}" style="width: ${data.columns[index].width || 200}px;${cell.bgColor ? `background-color:${cell.bgColor};` : ""}${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
tableHTML += `<div class="av__cell" ${index === 0 ? 'data-block-id="' + (cell.value.block.id || "") + '"' : ""} data-id="${cell.id}" data-index="${index}" style="width: ${data.columns[index].width || 200}px;${cell.bgColor ? `background-color:${cell.bgColor};` : ""}${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import {Link} from "./Link";
|
||||||
import {setPosition} from "../../util/setPosition";
|
import {setPosition} from "../../util/setPosition";
|
||||||
import {updateTransaction} from "../wysiwyg/transaction";
|
import {updateTransaction} from "../wysiwyg/transaction";
|
||||||
import {Constants} from "../../constants";
|
import {Constants} from "../../constants";
|
||||||
import {getEventName, openByMobile, setStorageVal} from "../util/compatibility";
|
import {openByMobile, setStorageVal} from "../util/compatibility";
|
||||||
import {upDownHint} from "../../util/upDownHint";
|
import {upDownHint} from "../../util/upDownHint";
|
||||||
import {highlightRender} from "../render/highlightRender";
|
import {highlightRender} from "../render/highlightRender";
|
||||||
import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
|
import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
|
||||||
|
|
|
||||||
|
|
@ -1015,7 +1015,7 @@ const replace = (element: Element, config: ISearchOption, edit: Protyle, app: Ap
|
||||||
if (isAll) {
|
if (isAll) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const rootId = currentList.getAttribute("data-root-id")
|
const rootId = currentList.getAttribute("data-root-id");
|
||||||
getAllModels().editor.forEach(item => {
|
getAllModels().editor.forEach(item => {
|
||||||
if (rootId === item.editor.protyle.block.rootID) {
|
if (rootId === item.editor.protyle.block.rootID) {
|
||||||
reloadProtyle(item.editor.protyle, false);
|
reloadProtyle(item.editor.protyle, false);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue