Vanessa 2025-03-18 11:57:08 +08:00
parent 7f4853043e
commit 0440b832ba
3 changed files with 7 additions and 8 deletions

View file

@ -155,7 +155,7 @@ export const image = {
<svg><use xlink:href="#iconTrashcan"></use></svg> <svg><use xlink:href="#iconTrashcan"></use></svg>
</span>`; </span>`;
} }
const isM = isMobile() const isM = isMobile();
data.forEach((item) => { data.forEach((item) => {
const idx = item.indexOf("assets/"); const idx = item.indexOf("assets/");
const dataPath = item.substr(idx); const dataPath = item.substr(idx);

View file

@ -25,7 +25,6 @@ import {App} from "../index";
import {saveScroll} from "../protyle/scroll/saveScroll"; import {saveScroll} from "../protyle/scroll/saveScroll";
import {isInAndroid, isInHarmony, isInIOS, setStorageVal} from "../protyle/util/compatibility"; import {isInAndroid, isInHarmony, isInIOS, setStorageVal} from "../protyle/util/compatibility";
import {Plugin} from "../plugin"; import {Plugin} from "../plugin";
import {blockRender} from "../protyle/render/blockRender";
const updateTitle = (rootID: string, tab: Tab, protyle?: IProtyle) => { const updateTitle = (rootID: string, tab: Tab, protyle?: IProtyle) => {
fetchPost("/api/block/getDocInfo", { fetchPost("/api/block/getDocInfo", {

View file

@ -264,16 +264,16 @@ const promiseTransaction = () => {
const updateEmbed = (protyle: IProtyle, operation: IOperation) => { const updateEmbed = (protyle: IProtyle, operation: IOperation) => {
let updatedEmbed = false; let updatedEmbed = false;
let html = operation.data; let html = operation.data;
const updateEmbedElements = Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-type="NodeBlockQueryEmbed"] [data-node-id="${operation.id}"]`)) const updateEmbedElements = Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-type="NodeBlockQueryEmbed"] [data-node-id="${operation.id}"]`));
if (updateEmbedElements.length === 0) { if (updateEmbedElements.length === 0) {
const tempElement = document.createElement("template"); const tempElement = document.createElement("template");
tempElement.innerHTML = operation.data; tempElement.innerHTML = operation.data;
protyle.wysiwyg.element.querySelectorAll('[data-type="NodeBlockQueryEmbed"]').forEach((item) => { protyle.wysiwyg.element.querySelectorAll('[data-type="NodeBlockQueryEmbed"]').forEach((item) => {
item.querySelectorAll(`.protyle-wysiwyg__embed`).forEach(embedBlockItem => { item.querySelectorAll(".protyle-wysiwyg__embed").forEach(embedBlockItem => {
const newTempElement = tempElement.content.querySelector(`[data-node-id="${embedBlockItem.getAttribute("data-id")}"]`) const newTempElement = tempElement.content.querySelector(`[data-node-id="${embedBlockItem.getAttribute("data-id")}"]`);
if (newTempElement) { if (newTempElement) {
updateEmbedElements.push(embedBlockItem.querySelector('[data-node-id]')) updateEmbedElements.push(embedBlockItem.querySelector("[data-node-id]"));
html = newTempElement.outerHTML html = newTempElement.outerHTML;
} }
}); });
}); });
@ -472,7 +472,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
if (operation.action === "update") { if (operation.action === "update") {
// 缩放后仅更新局部 https://github.com/siyuan-note/siyuan/issues/14326 // 缩放后仅更新局部 https://github.com/siyuan-note/siyuan/issues/14326
if (updateElements.length === 0) { if (updateElements.length === 0) {
const newUpdateElement = protyle.wysiwyg.element.querySelector('[data-node-id]'); const newUpdateElement = protyle.wysiwyg.element.querySelector("[data-node-id]");
const newUpdateId = newUpdateElement.getAttribute("data-node-id"); const newUpdateId = newUpdateElement.getAttribute("data-node-id");
const tempElement = document.createElement("template"); const tempElement = document.createElement("template");
tempElement.innerHTML = operation.data; tempElement.innerHTML = operation.data;