diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 2f1c10a18..2f88f74d1 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -1,8 +1,10 @@ import { hasClosestBlock, hasClosestByAttribute, - hasClosestByClassName, hasClosestByTag, - hasTopClosestByClassName, isInEmbedBlock + hasClosestByClassName, + hasClosestByTag, + hasTopClosestByClassName, + isInEmbedBlock } from "../protyle/util/hasClosest"; import {MenuItem} from "./Menu"; import {focusBlock, focusByRange, focusByWbr, getEditorRange, selectAll,} from "../protyle/util/selection"; @@ -24,13 +26,7 @@ import {transaction, updateTransaction} from "../protyle/wysiwyg/transaction"; import {openMenu} from "./commonMenuItem"; import {fetchPost, fetchSyncPost} from "../util/fetch"; import {Constants} from "../constants"; -import { - copyPlainText, - readClipboard, - setStorageVal, - updateHotkeyTip, - writeText -} from "../protyle/util/compatibility"; +import {copyPlainText, readClipboard, setStorageVal, updateHotkeyTip, writeText} from "../protyle/util/compatibility"; import {preventScroll} from "../protyle/scroll/preventScroll"; import {onGet} from "../protyle/util/onGet"; import {getAllModels} from "../layout/getAll"; @@ -1087,6 +1083,10 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme const imgElement = assetElement.querySelector("img"); const titleElement = assetElement.querySelector(".protyle-action__title span") as HTMLElement; const html = nodeElement.outerHTML; + let src = imgElement.getAttribute("src"); + if (!src) { + src = "" + } if (!protyle.disabled) { window.siyuan.menus.menu.append(new MenuItem({ id: "imageUrlAndTitleAndTooltipText", @@ -1098,7 +1098,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme -