mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-15 08:30:42 +08:00
This commit is contained in:
parent
62f02d9c90
commit
b3b641913f
@ -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);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user