mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-16 00:50:56 +08:00
This commit is contained in:
parent
e91e65ed34
commit
e05e01bfd7
@ -33,7 +33,7 @@ import {lineNumberRender} from "../protyle/markdown/highlightRender";
|
|||||||
import * as dayjs from "dayjs";
|
import * as dayjs from "dayjs";
|
||||||
import {blockRender} from "../protyle/markdown/blockRender";
|
import {blockRender} from "../protyle/markdown/blockRender";
|
||||||
import {renameAsset} from "../editor/rename";
|
import {renameAsset} from "../editor/rename";
|
||||||
import {hasNextSibling} from "../protyle/wysiwyg/getBlock";
|
import {hasNextSibling, hasPreviousSibling} from "../protyle/wysiwyg/getBlock";
|
||||||
import {electronUndo} from "../protyle/undo";
|
import {electronUndo} from "../protyle/undo";
|
||||||
import {pushBack} from "../mobile/util/MobileBackFoward";
|
import {pushBack} from "../mobile/util/MobileBackFoward";
|
||||||
import {exportAsset} from "./util";
|
import {exportAsset} from "./util";
|
||||||
@ -640,6 +640,17 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let previous = assetElement.previousSibling;
|
||||||
|
while (previous) {
|
||||||
|
if (previous.textContent === "") {
|
||||||
|
previous = previous.previousSibling;
|
||||||
|
} else if (previous.textContent === Constants.ZWSP) {
|
||||||
|
previous.textContent = "";
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
@ -653,6 +664,9 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||||||
if (!hasNextSibling(assetElement)) {
|
if (!hasNextSibling(assetElement)) {
|
||||||
assetElement.insertAdjacentText("afterend", Constants.ZWSP);
|
assetElement.insertAdjacentText("afterend", Constants.ZWSP);
|
||||||
}
|
}
|
||||||
|
if (!hasPreviousSibling(assetElement)) {
|
||||||
|
assetElement.insertAdjacentText("beforebegin", Constants.ZWSP);
|
||||||
|
}
|
||||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
|
Loading…
Reference in New Issue
Block a user