🚨
This commit is contained in:
parent
f54f040a37
commit
6850abe88a
7 changed files with 28 additions and 28 deletions
|
@ -336,7 +336,7 @@ export const bindCardEvent = (options: {
|
|||
hideElements(["toolbar", "hint", "util"], editor.protyle);
|
||||
if (type === "-1") { // 显示答案
|
||||
if (actionElements[0].classList.contains("fn__none")) {
|
||||
type = "3"
|
||||
type = "3";
|
||||
} else {
|
||||
editor.protyle.element.classList.remove("card__block--hidemark", "card__block--hideli", "card__block--hidesb", "card__block--hideh");
|
||||
actionElements[0].classList.add("fn__none");
|
||||
|
|
|
@ -543,7 +543,7 @@ export abstract class Constants {
|
|||
"code-block": true,
|
||||
"math-block": true,
|
||||
"html-block": true
|
||||
}
|
||||
};
|
||||
|
||||
// image
|
||||
public static readonly SIYUAN_IMAGE_VIP: string = `<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
|
|
|
@ -12,7 +12,7 @@ export const getCellText = (cellElement: HTMLElement | false) => {
|
|||
if (!cellElement) {
|
||||
return "";
|
||||
}
|
||||
let cellText = ""
|
||||
let cellText = "";
|
||||
const textElement = cellElement.querySelector(".av__celltext");
|
||||
if (textElement) {
|
||||
if (textElement.querySelector(".av__cellicon")) {
|
||||
|
@ -29,7 +29,7 @@ export const getCellText = (cellElement: HTMLElement | false) => {
|
|||
const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement) => {
|
||||
let cellValue: IAVCellValue;
|
||||
if (colType === "number") {
|
||||
const value = cellElement.querySelector(".av__celltext").getAttribute("data-content")
|
||||
const value = cellElement.querySelector(".av__celltext").getAttribute("data-content");
|
||||
cellValue = {
|
||||
type: colType,
|
||||
number: {
|
||||
|
@ -45,13 +45,13 @@ const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement) => {
|
|||
}
|
||||
};
|
||||
} else if (colType === "mSelect" || colType === "select") {
|
||||
const mSelect: IAVCellSelectValue[] = []
|
||||
const mSelect: IAVCellSelectValue[] = [];
|
||||
cellElement.querySelectorAll(".b3-chip").forEach((item: HTMLElement) => {
|
||||
mSelect.push({
|
||||
content: item.textContent.trim(),
|
||||
color: item.style.color.replace("var(--b3-font-color", "").replace(")", "")
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
cellValue = {
|
||||
type: colType,
|
||||
mSelect
|
||||
|
@ -70,7 +70,7 @@ const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement) => {
|
|||
};
|
||||
}
|
||||
return cellValue;
|
||||
}
|
||||
};
|
||||
|
||||
export const genCellValue = (colType: TAVCol, value: string | any) => {
|
||||
let cellValue: IAVCellValue;
|
||||
|
@ -323,7 +323,7 @@ const updateCellValueByInput = (protyle: IProtyle, type: TAVCol, cellElements: H
|
|||
let tempElement = protyle.wysiwyg.element.querySelector(`.av__cell[data-id="${cellElements[0].dataset.id}"]`) as HTMLElement;
|
||||
if (!tempElement) {
|
||||
// 修改单元格后修改其他没有内容的单元格(id 会随机)
|
||||
tempElement = protyle.wysiwyg.element.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${cellElements[0].dataset.colId}"]`) as HTMLElement
|
||||
tempElement = protyle.wysiwyg.element.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${cellElements[0].dataset.colId}"]`) as HTMLElement;
|
||||
}
|
||||
if (!tempElement) {
|
||||
return;
|
||||
|
@ -451,18 +451,18 @@ const updateCellValueByInput = (protyle: IProtyle, type: TAVCol, cellElements: H
|
|||
};
|
||||
|
||||
export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, value = "") => {
|
||||
const doOperations: IOperation[] = []
|
||||
const undoOperations: IOperation[] = []
|
||||
const doOperations: IOperation[] = [];
|
||||
const undoOperations: IOperation[] = [];
|
||||
|
||||
const avID = nodeElement.dataset.avId
|
||||
const id = nodeElement.dataset.nodeId
|
||||
let text = ''
|
||||
const avID = nodeElement.dataset.avId;
|
||||
const id = nodeElement.dataset.nodeId;
|
||||
let text = "";
|
||||
const cellElements: Element[] = Array.from(nodeElement.querySelectorAll(".av__cell--select")) || [];
|
||||
if (cellElements.length === 0) {
|
||||
nodeElement.querySelectorAll(".av__row--select:not(.av__row--header)").forEach(rowElement => {
|
||||
rowElement.querySelectorAll(".av__cell").forEach(cellElement => {
|
||||
cellElements.push(cellElement)
|
||||
})
|
||||
cellElements.push(cellElement);
|
||||
});
|
||||
});
|
||||
}
|
||||
cellElements.forEach((item: HTMLElement) => {
|
||||
|
@ -499,19 +499,19 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
|
|||
if (!hasClosestByClassName(cellElements[0], "custom-attr")) {
|
||||
updateAttrViewCellAnimation(item);
|
||||
}
|
||||
})
|
||||
});
|
||||
if (doOperations.length > 0) {
|
||||
doOperations.push({
|
||||
action: "doUpdateUpdated",
|
||||
id,
|
||||
data: dayjs().format("YYYYMMDDHHmmss"),
|
||||
})
|
||||
});
|
||||
undoOperations.push({
|
||||
action: "doUpdateUpdated",
|
||||
id,
|
||||
data: nodeElement.getAttribute("updated"),
|
||||
})
|
||||
});
|
||||
transaction(protyle, doOperations, undoOperations);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -90,9 +90,9 @@ export const insertAttrViewBlockAnimation = (blockElement: Element, srcIDs: stri
|
|||
</div>`;
|
||||
});
|
||||
previousElement.insertAdjacentHTML("afterend", html);
|
||||
const pageSize = parseInt(blockElement.getAttribute("data-page-size"))
|
||||
const pageSize = parseInt(blockElement.getAttribute("data-page-size"));
|
||||
if (pageSize) {
|
||||
const currentCount = blockElement.querySelectorAll(".av__row:not(.av__row--header)").length
|
||||
const currentCount = blockElement.querySelectorAll(".av__row:not(.av__row--header)").length;
|
||||
if (pageSize < currentCount) {
|
||||
blockElement.setAttribute("data-page-size", currentCount.toString());
|
||||
}
|
||||
|
@ -253,4 +253,4 @@ export const deleteRow = (blockElement: HTMLElement, protyle: IProtyle) => {
|
|||
});
|
||||
stickyRow(blockElement, protyle.contentElement.getBoundingClientRect(), "all");
|
||||
updateHeader(blockElement.querySelector(".av__row"));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -54,10 +54,10 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
|
|||
range.deleteContents();
|
||||
const text = readText();
|
||||
if (typeof text === "string") {
|
||||
processAV(range, text, protyle, blockElement)
|
||||
processAV(range, text, protyle, blockElement);
|
||||
} else {
|
||||
text.then((t) => {
|
||||
processAV(range, t, protyle, blockElement)
|
||||
processAV(range, t, protyle, blockElement);
|
||||
});
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -289,8 +289,8 @@ export class WYSIWYG {
|
|||
if (cellElements.length === 0) {
|
||||
nodeElement.querySelectorAll(".av__row--select:not(.av__row--header)").forEach(rowElement => {
|
||||
rowElement.querySelectorAll(".av__cell").forEach(cellElement => {
|
||||
cellElements.push(cellElement)
|
||||
})
|
||||
cellElements.push(cellElement);
|
||||
});
|
||||
});
|
||||
}
|
||||
cellElements.forEach((item: HTMLElement) => {
|
||||
|
|
|
@ -162,7 +162,7 @@ export const replaceFilterMenu = (config: ISearchOption) => {
|
|||
<span class="fn__space"></span>
|
||||
<input class="b3-switch fn__flex-center" data-type="${key}" type="checkbox"${config.replaceTypes[key] ? " checked" : ""}>
|
||||
</label>`;
|
||||
})
|
||||
});
|
||||
const filterDialog = new Dialog({
|
||||
title: window.siyuan.languages.type,
|
||||
content: `<div class="b3-dialog__content">${html}</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue