Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/11757

Vanessab3b641913fa2
diff --git a/app/src/protyle/wysiwyg/commonHotkey.ts b/app/src/protyle/wysiwyg/commonHotkey.ts
index 2a5d3e9ae9..9af51bc754 100644
--- a/app/src/protyle/wysiwyg/commonHotkey.ts
+++ b/app/src/protyle/wysiwyg/commonHotkey.ts
@@ -311,29 +311,7 @@ export const goEnd = (protyle: IProtyle) => {
export const alignImgCenter = (protyle: IProtyle, nodeElement: Element, assetElements: Element[], id: string, html: string) => {
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
assetElements.forEach((item: HTMLElement) => {
- item.style.display = "block";
- let nextSibling = item.nextSibling;
- while (nextSibling) {
- if (nextSibling.textContent === "") {
- nextSibling = nextSibling.nextSibling;
- } else if (nextSibling.textContent === Constants.ZWSP) {
- nextSibling.textContent = "";
- break;
- } else {
- break;
- }
- }
- let previous = item.previousSibling;
- while (previous) {
- if (previous.textContent === "") {
- previous = previous.previousSibling;
- } else if (previous.textContent === Constants.ZWSP) {
- previous.textContent = "";
- break;
- } else {
- break;
- }
- }
+ item.style.minWidth = "calc(100% - 0.1em)";
});
updateTransaction(protyle, id, nodeElement.outerHTML, html);
};
@@ -341,13 +319,8 @@ export const alignImgCenter = (protyle: IProtyle, nodeElement: Element, assetEle
export const alignImgLeft = (protyle: IProtyle, nodeElement: Element, assetElements: Element[], id: string, html: string) => {
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
assetElements.forEach((item: HTMLElement) => {
+ item.style.minWidth = "";
item.style.display = "";
- if (!hasNextSibling(item)) {
- item.insertAdjacentText("afterend", Constants.ZWSP);
- }
- if (!hasPreviousSibling(item)) {
- item.insertAdjacentText("beforebegin", Constants.ZWSP);
- }
});
updateTransaction(protyle, id, nodeElement.outerHTML, html);
};