This commit is contained in:
Vanessa 2025-03-16 11:57:00 +08:00
parent 4b56408095
commit 7cff7ce704
9 changed files with 21 additions and 22 deletions

View file

@ -65,12 +65,12 @@ export const exportImage = (id: string) => {
setStorageVal(Constants.LOCAL_EXPORTIMG, window.siyuan.storage[Constants.LOCAL_EXPORTIMG]);
setTimeout(() => {
addScript("/stage/protyle/js/html-to-image.min.js?v=1.11.13", "protyleHtml2image").then(async () => {
let blob = await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"))
let blob = await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"));
if (isIPhone() || isSafari()) {
await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"))
await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"))
await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"))
blob = await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"))
await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"));
await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"));
await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"));
blob = await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"));
}
const formData = new FormData();
formData.append("file", blob, btnsElement[1].getAttribute("data-title"));

View file

@ -79,7 +79,7 @@ export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement)
if (colType === "block" && textElement.dataset.id) {
cellValue.block.id = textElement.dataset.id;
if (textElement.previousElementSibling?.classList.contains("b3-menu__avemoji")) {
const unicode = textElement.previousElementSibling.getAttribute("data-unicode")
const unicode = textElement.previousElementSibling.getAttribute("data-unicode");
if (unicode) {
cellValue.block.icon = unicode;
}

View file

@ -205,12 +205,12 @@ export const bindAVPanelKeydown = (event: KeyboardEvent) => {
if (avPanelElement && window.siyuan.menus.menu.element.classList.contains("fn__none")) {
if ((avPanelElement.querySelector('[data-type="goSearchRollupCol"]') && !avPanelElement.querySelector(".b3-text-field")) ||
avPanelElement.querySelector('[data-type="addAssetExist"]')) {
const menuElement = avPanelElement.querySelector(".b3-menu__items")
const menuElement = avPanelElement.querySelector(".b3-menu__items");
if (event.key === "Enter") {
const currentElement = menuElement.querySelector(".b3-menu__item--current");
if (currentElement) {
const editElement = currentElement.querySelector('[data-type="editAssetItem"]')
const uploadElement = currentElement.querySelector(".b3-form__upload")
const editElement = currentElement.querySelector('[data-type="editAssetItem"]');
const uploadElement = currentElement.querySelector(".b3-form__upload");
if (editElement) {
avPanelElement.dispatchEvent(new CustomEvent("click", {
detail: {
@ -219,7 +219,7 @@ export const bindAVPanelKeydown = (event: KeyboardEvent) => {
}
}));
} else if (uploadElement) {
uploadElement.dispatchEvent(new MouseEvent('click', {bubbles: true}));
uploadElement.dispatchEvent(new MouseEvent("click", {bubbles: true}));
} else {
avPanelElement.dispatchEvent(new CustomEvent("click", {
detail: {
@ -232,10 +232,10 @@ export const bindAVPanelKeydown = (event: KeyboardEvent) => {
} else if (event.key === "Escape") {
avPanelElement.dispatchEvent(new CustomEvent("click", {detail: "close"}));
} else {
upDownHint(menuElement, event, "b3-menu__item--current", menuElement.firstElementChild)
upDownHint(menuElement, event, "b3-menu__item--current", menuElement.firstElementChild);
}
return true;
}
}
return false;
}
};

View file

@ -32,7 +32,7 @@ export const chartRender = (element: Element, cdn = Constants.PROTYLE_CDN) => {
}
const renderElement = e.firstElementChild.nextElementSibling as HTMLElement;
try {
const chartInstance = window.echarts.getInstanceById(renderElement.getAttribute("_echarts_instance_"))
const chartInstance = window.echarts.getInstanceById(renderElement.getAttribute("_echarts_instance_"));
const option = await looseJsonParse(Lute.UnEscapeHTMLStr(e.getAttribute("data-content")));
if (chartInstance && chartInstance.getOption().series[0]?.type !== option.series[0]?.type) {
chartInstance.clear();

View file

@ -31,7 +31,7 @@ export const genRenderFrame = (renderElement: Element) => {
} else if (type==="NodeMathBlock") {
renderElement.firstElementChild.innerHTML = `<span></span><span class="protyle-cursor">${Constants.ZWSP}</span>`;
}
}
};
export const processClonePHElement = (item: Element) => {
if (item.getAttribute("data-type") === "NodeHTMLBlock") {

View file

@ -153,7 +153,7 @@ export const getEditorRange = (element: Element): Range => {
}
if (element.classList.contains("li") || element.classList.contains("list")) {
const childElement = element.querySelector("[data-node-id]")
const childElement = element.querySelector("[data-node-id]");
if (childElement) {
return getEditorRange(childElement);
}

View file

@ -457,15 +457,15 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
if (operation.action === "update") {
// 缩放后仅更新局部 https://github.com/siyuan-note/siyuan/issues/14326
if (updateElements.length === 0) {
const newUpdateElement = protyle.wysiwyg.element.firstElementChild
const newUpdateId = newUpdateElement.getAttribute("data-node-id")
const newUpdateElement = protyle.wysiwyg.element.firstElementChild;
const newUpdateId = newUpdateElement.getAttribute("data-node-id");
const tempElement = document.createElement("template");
tempElement.innerHTML = operation.data;
const newTempElement = tempElement.content.querySelector(`[data-node-id="${newUpdateId}"]`);
if (newTempElement) {
updateElements.push(newUpdateElement)
operation.data = newTempElement.outerHTML
operation.id = newUpdateId
updateElements.push(newUpdateElement);
operation.data = newTempElement.outerHTML;
operation.id = newUpdateId;
}
}
if (updateElements.length > 0) {

View file

@ -13,7 +13,6 @@ import {replaceFileName, validateName} from "../editor/rename";
import {hideElements} from "../protyle/ui/hideElements";
import {openMobileFileById} from "../mobile/editor";
import {App} from "../index";
import {escapeHtml} from "./escape";
export const getNewFilePath = (useSavePath: boolean) => {
let notebookId = "";

View file

@ -62,7 +62,7 @@ class App {
break;
case "reloadEmbedBlock":
reloadEmbedBlock(data.data);
break
break;
case "reloadPlugin":
reloadPlugin(this, data.data);
break;