mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 00:20:12 +01:00
🚨
This commit is contained in:
parent
75a8ee13bd
commit
5f44965ef3
12 changed files with 28 additions and 28 deletions
|
|
@ -485,10 +485,10 @@ export const openCardByData = async (app: App, cardsData: ICardData, cardType: T
|
||||||
dialog
|
dialog
|
||||||
});
|
});
|
||||||
dialog.editor = editor;
|
dialog.editor = editor;
|
||||||
const focusElement = dialog.element.querySelector('.b3-button[data-type="-1"]') as HTMLButtonElement
|
const focusElement = dialog.element.querySelector('.b3-button[data-type="-1"]') as HTMLButtonElement;
|
||||||
focusElement.focus();
|
focusElement.focus();
|
||||||
const range = document.createRange()
|
const range = document.createRange();
|
||||||
range.selectNodeContents(focusElement)
|
range.selectNodeContents(focusElement);
|
||||||
focusByRange(range);
|
focusByRange(range);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ export const showDiff = (app: App, data: { id: string, time: string }[]) => {
|
||||||
rightEditor = undefined;
|
rightEditor = undefined;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialog.element.setAttribute("data-key", Constants.DIALOG_HISTORYCOMPARE)
|
dialog.element.setAttribute("data-key", Constants.DIALOG_HISTORYCOMPARE);
|
||||||
dialog.element.addEventListener("click", (event) => {
|
dialog.element.addEventListener("click", (event) => {
|
||||||
if (typeof event.detail === "string") {
|
if (typeof event.detail === "string") {
|
||||||
renderCompare(app, dialog.element.querySelector(".history__diff .b3-list-item--focus"));
|
renderCompare(app, dialog.element.querySelector(".history__diff .b3-list-item--focus"));
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import {Dialog} from "../dialog";
|
import {Dialog} from "../dialog";
|
||||||
|
|
||||||
export const historyKeydown = (event: KeyboardEvent, dialog: Dialog) => {
|
export const historyKeydown = (event: KeyboardEvent, dialog: Dialog) => {
|
||||||
let currentItem = dialog.element.querySelector(".history__diff .b3-list-item--focus")
|
let currentItem = dialog.element.querySelector(".history__diff .b3-list-item--focus");
|
||||||
const items = Array.from(dialog.element.querySelectorAll(".history__diff .b3-list-item[data-id]"))
|
const items = Array.from(dialog.element.querySelectorAll(".history__diff .b3-list-item[data-id]"));
|
||||||
if (items.length < 2) {
|
if (items.length < 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -11,9 +11,9 @@ export const historyKeydown = (event: KeyboardEvent, dialog: Dialog) => {
|
||||||
} else {
|
} else {
|
||||||
currentItem.classList.remove("b3-list-item--focus");
|
currentItem.classList.remove("b3-list-item--focus");
|
||||||
if (event.key === "Home") {
|
if (event.key === "Home") {
|
||||||
currentItem = items[0]
|
currentItem = items[0];
|
||||||
} else if (event.key === "End") {
|
} else if (event.key === "End") {
|
||||||
currentItem = items[items.length - 1]
|
currentItem = items[items.length - 1];
|
||||||
} else {
|
} else {
|
||||||
items.find((item, index) => {
|
items.find((item, index) => {
|
||||||
if (item.isSameNode(currentItem)) {
|
if (item.isSameNode(currentItem)) {
|
||||||
|
|
@ -32,7 +32,7 @@ export const historyKeydown = (event: KeyboardEvent, dialog: Dialog) => {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentItem.classList.add("b3-list-item--focus");
|
currentItem.classList.add("b3-list-item--focus");
|
||||||
|
|
@ -44,9 +44,9 @@ export const historyKeydown = (event: KeyboardEvent, dialog: Dialog) => {
|
||||||
const historyDiffElement = dialog.element.querySelector(".history__diff");
|
const historyDiffElement = dialog.element.querySelector(".history__diff");
|
||||||
const historyDiffRect = historyDiffElement.getBoundingClientRect();
|
const historyDiffRect = historyDiffElement.getBoundingClientRect();
|
||||||
if (currentItemRect.bottom > historyDiffRect.bottom) {
|
if (currentItemRect.bottom > historyDiffRect.bottom) {
|
||||||
currentItem.scrollIntoView(false)
|
currentItem.scrollIntoView(false);
|
||||||
} else if (currentItemRect.top < historyDiffRect.top) {
|
} else if (currentItemRect.top < historyDiffRect.top) {
|
||||||
currentItem.scrollIntoView()
|
currentItem.scrollIntoView();
|
||||||
}
|
}
|
||||||
dialog.element.dispatchEvent(new CustomEvent("click", {detail: event.key.toLowerCase()}));
|
dialog.element.dispatchEvent(new CustomEvent("click", {detail: event.key.toLowerCase()}));
|
||||||
}
|
};
|
||||||
|
|
|
||||||
|
|
@ -875,7 +875,7 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.
|
||||||
item.element.style.minWidth = "";
|
item.element.style.minWidth = "";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let lastItem: HTMLElement
|
let lastItem: HTMLElement;
|
||||||
while (layout.element.scrollWidth > layout.element.clientWidth) {
|
while (layout.element.scrollWidth > layout.element.clientWidth) {
|
||||||
layout.children.find((item: Layout | Wnd) => {
|
layout.children.find((item: Layout | Wnd) => {
|
||||||
if (item.element.style.width && item.element.style.width !== "0px") {
|
if (item.element.style.width && item.element.style.width !== "0px") {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export const showAccountInfo = () => {
|
||||||
});
|
});
|
||||||
userTitlesHTML += "</div>";
|
userTitlesHTML += "</div>";
|
||||||
}
|
}
|
||||||
let subscriptionHTML = ""
|
let subscriptionHTML = "";
|
||||||
if (window.siyuan.user.userSiYuanProExpireTime === -1) {
|
if (window.siyuan.user.userSiYuanProExpireTime === -1) {
|
||||||
// 终身会员
|
// 终身会员
|
||||||
subscriptionHTML = `<div class="b3-chip b3-chip--secondary">${Constants.SIYUAN_IMAGE_VIP}${window.siyuan.languages.account12}</div>`;
|
subscriptionHTML = `<div class="b3-chip b3-chip--secondary">${Constants.SIYUAN_IMAGE_VIP}${window.siyuan.languages.account12}</div>`;
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ export class Protyle {
|
||||||
if (item.protyleOptions) {
|
if (item.protyleOptions) {
|
||||||
pluginsOptions = merge(pluginsOptions, item.protyleOptions);
|
pluginsOptions = merge(pluginsOptions, item.protyleOptions);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
const getOptions = new Options(pluginsOptions);
|
const getOptions = new Options(pluginsOptions);
|
||||||
const mergedOptions = getOptions.merge();
|
const mergedOptions = getOptions.merge();
|
||||||
this.protyle = {
|
this.protyle = {
|
||||||
|
|
|
||||||
|
|
@ -103,12 +103,12 @@ export const updateAssetCell = (options: {
|
||||||
const colId = options.cellElements[0].dataset.colId;
|
const colId = options.cellElements[0].dataset.colId;
|
||||||
const cellDoOperations: IOperation[] = [];
|
const cellDoOperations: IOperation[] = [];
|
||||||
const cellUndoOperations: IOperation[] = [];
|
const cellUndoOperations: IOperation[] = [];
|
||||||
let mAssetValue: IAVCellAssetValue[]
|
let mAssetValue: IAVCellAssetValue[];
|
||||||
options.cellElements.forEach((item, elementIndex) => {
|
options.cellElements.forEach((item, elementIndex) => {
|
||||||
if (!options.blockElement.contains(item)) {
|
if (!options.blockElement.contains(item)) {
|
||||||
const rowElement = hasClosestByClassName(item, "av__row");
|
const rowElement = hasClosestByClassName(item, "av__row");
|
||||||
if (rowElement) {
|
if (rowElement) {
|
||||||
item = options.cellElements[elementIndex] = options.blockElement.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${item.dataset.colId}"]`) as HTMLElement
|
item = options.cellElements[elementIndex] = options.blockElement.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${item.dataset.colId}"]`) as HTMLElement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const cellValue = genCellValueByElement(getTypeByCellElement(item) || item.dataset.type as TAVCol, item);
|
const cellValue = genCellValueByElement(getTypeByCellElement(item) || item.dataset.type as TAVCol, item);
|
||||||
|
|
@ -144,9 +144,9 @@ export const updateAssetCell = (options: {
|
||||||
} else {
|
} else {
|
||||||
cellValue.mAsset = options.replaceValue;
|
cellValue.mAsset = options.replaceValue;
|
||||||
}
|
}
|
||||||
mAssetValue = cellValue.mAsset
|
mAssetValue = cellValue.mAsset;
|
||||||
} else {
|
} else {
|
||||||
cellValue.mAsset = mAssetValue
|
cellValue.mAsset = mAssetValue;
|
||||||
}
|
}
|
||||||
cellDoOperations.push({
|
cellDoOperations.push({
|
||||||
action: "updateAttrViewCell",
|
action: "updateAttrViewCell",
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Eleme
|
||||||
contentElement.scrollTop = contentElement.scrollTop + cellRect.top - avHeaderRect.bottom;
|
contentElement.scrollTop = contentElement.scrollTop + cellRect.top - avHeaderRect.bottom;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const footerElement = blockElement.querySelector(".av__row--footer")
|
const footerElement = blockElement.querySelector(".av__row--footer");
|
||||||
if (footerElement.querySelector(".av__calc--ashow")) {
|
if (footerElement.querySelector(".av__calc--ashow")) {
|
||||||
const avFooterRect = footerElement.getBoundingClientRect();
|
const avFooterRect = footerElement.getBoundingClientRect();
|
||||||
if (avFooterRect.top < cellRect.bottom) {
|
if (avFooterRect.top < cellRect.bottom) {
|
||||||
|
|
@ -557,7 +557,7 @@ export const renderCell = (cellValue: IAVCellValue, wrap: boolean) => {
|
||||||
} else if (cellValue.type === "checkbox") {
|
} else if (cellValue.type === "checkbox") {
|
||||||
text += `<svg class="av__checkbox"><use xlink:href="#icon${cellValue?.checkbox?.checked ? "Check" : "Uncheck"}"></use></svg>`;
|
text += `<svg class="av__checkbox"><use xlink:href="#icon${cellValue?.checkbox?.checked ? "Check" : "Uncheck"}"></use></svg>`;
|
||||||
} else if (cellValue.type === "rollup") {
|
} else if (cellValue.type === "rollup") {
|
||||||
cellValue?.rollup?.contents?.forEach((item, index) => {
|
cellValue?.rollup?.contents?.forEach((item) => {
|
||||||
const rollupText = ["select", "mSelect", "mAsset", "checkbox", "relation"].includes(item.type) ? renderCell(item, wrap) : renderRollup(item);
|
const rollupText = ["select", "mSelect", "mAsset", "checkbox", "relation"].includes(item.type) ? renderCell(item, wrap) : renderRollup(item);
|
||||||
if (rollupText) {
|
if (rollupText) {
|
||||||
text += rollupText + ", ";
|
text += rollupText + ", ";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {fetchPost} from "../../../util/fetch";
|
import {fetchPost} from "../../../util/fetch";
|
||||||
import {getColIconByType} from "./col";
|
import {getColIconByType} from "./col";
|
||||||
import {Constants} from "../../../constants";
|
import {Constants} from "../../../constants";
|
||||||
import {popTextCell, renderCell} from "./cell";
|
import {renderCell} from "./cell";
|
||||||
import {unicode2Emoji} from "../../../emoji";
|
import {unicode2Emoji} from "../../../emoji";
|
||||||
import {focusBlock} from "../../util/selection";
|
import {focusBlock} from "../../util/selection";
|
||||||
import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
|
import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
|
||||||
|
|
@ -264,7 +264,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, data.colum
|
||||||
const refreshTimeouts: {
|
const refreshTimeouts: {
|
||||||
[key: string]: number;
|
[key: string]: number;
|
||||||
} = {};
|
} = {};
|
||||||
export const refreshAV = (protyle: IProtyle, operation: IOperation, isUndo: boolean) => {
|
export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
||||||
if (operation.action === "setAttrViewName") {
|
if (operation.action === "setAttrViewName") {
|
||||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.id}"]`)).forEach((item: HTMLElement) => {
|
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.id}"]`)).forEach((item: HTMLElement) => {
|
||||||
const titleElement = item.querySelector(".av__title") as HTMLElement;
|
const titleElement = item.querySelector(".av__title") as HTMLElement;
|
||||||
|
|
|
||||||
|
|
@ -108,14 +108,14 @@ export const insertAttrViewBlockAnimation = (protyle: IProtyle, blockElement: El
|
||||||
const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;
|
const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;
|
||||||
currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`).innerHTML =
|
currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`).innerHTML =
|
||||||
renderCell(genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement), sideRowCellElement.dataset.wrap === "true");
|
renderCell(genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement), sideRowCellElement.dataset.wrap === "true");
|
||||||
})
|
});
|
||||||
response.data.sorts.forEach((item: IAVSort) => {
|
response.data.sorts.forEach((item: IAVSort) => {
|
||||||
const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;
|
const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;
|
||||||
currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`).innerHTML =
|
currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`).innerHTML =
|
||||||
renderCell(genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement), sideRowCellElement.dataset.wrap === "true");
|
renderCell(genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement), sideRowCellElement.dataset.wrap === "true");
|
||||||
})
|
});
|
||||||
popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block");
|
popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block");
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block");
|
popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1294,7 +1294,7 @@ export class Toolbar {
|
||||||
</div>`;
|
</div>`;
|
||||||
const listElement = this.subElement.querySelector(".b3-list");
|
const listElement = this.subElement.querySelector(".b3-list");
|
||||||
const previewElement = this.subElement.firstElementChild.lastElementChild;
|
const previewElement = this.subElement.firstElementChild.lastElementChild;
|
||||||
let previewPath: string
|
let previewPath: string;
|
||||||
listElement.addEventListener("mouseover", (event) => {
|
listElement.addEventListener("mouseover", (event) => {
|
||||||
const target = event.target as HTMLElement;
|
const target = event.target as HTMLElement;
|
||||||
const hoverItemElement = hasClosestByClassName(target, "b3-list-item");
|
const hoverItemElement = hasClosestByClassName(target, "b3-list-item");
|
||||||
|
|
|
||||||
|
|
@ -725,7 +725,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
|
||||||
"replaceAttrViewBlock", "updateAttrViewColTemplate", "setAttrViewColPin", "addAttrViewView",
|
"replaceAttrViewBlock", "updateAttrViewColTemplate", "setAttrViewColPin", "addAttrViewView",
|
||||||
"removeAttrViewView", "setAttrViewViewName", "setAttrViewViewIcon", "duplicateAttrViewView", "sortAttrViewView",
|
"removeAttrViewView", "setAttrViewViewName", "setAttrViewViewIcon", "duplicateAttrViewView", "sortAttrViewView",
|
||||||
"updateAttrViewColRelation", "setAttrViewPageSize", "updateAttrViewColRollup"].includes(operation.action)) {
|
"updateAttrViewColRelation", "setAttrViewPageSize", "updateAttrViewColRollup"].includes(operation.action)) {
|
||||||
refreshAV(protyle, operation, isUndo);
|
refreshAV(protyle, operation);
|
||||||
} else if (operation.action === "doUpdateUpdated") {
|
} else if (operation.action === "doUpdateUpdated") {
|
||||||
updateElements.forEach(item => {
|
updateElements.forEach(item => {
|
||||||
item.setAttribute("updated", operation.data);
|
item.setAttribute("updated", operation.data);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue