mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 06:30:14 +01:00
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
1a56f872be
commit
5d015b516c
2 changed files with 19 additions and 11 deletions
|
|
@ -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
|
|||
<span data-action="copy" class="block__icon block__icon--show b3-tooltips b3-tooltips__e fn__flex-center" aria-label="${window.siyuan.languages.copy}">
|
||||
<svg><use xlink:href="#iconCopy"></use></svg>
|
||||
</span>
|
||||
</div><textarea spellcheck="false" style="margin:4px 0;width: ${isMobile() ? "100%" : "360px"}" rows="1" class="b3-text-field">${imgElement.getAttribute("src")}</textarea><div class="fn__hr"></div><div class="fn__flex">
|
||||
</div><textarea spellcheck="false" style="margin:4px 0;width: ${isMobile() ? "100%" : "360px"}" rows="1" class="b3-text-field">${src}</textarea><div class="fn__hr"></div><div class="fn__flex">
|
||||
<span class="fn__flex-center">${window.siyuan.languages.title}</span>
|
||||
<span class="fn__space"></span>
|
||||
<span data-action="copy" class="block__icon block__icon--show b3-tooltips b3-tooltips__e fn__flex-center" aria-label="${window.siyuan.languages.copy}">
|
||||
|
|
|
|||
|
|
@ -113,7 +113,15 @@ func getImageOCRText(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
path := arg["path"].(string)
|
||||
var path string
|
||||
if nil == arg["path"] {
|
||||
ret.Data = map[string]interface{}{
|
||||
"text": "",
|
||||
}
|
||||
return
|
||||
} else {
|
||||
path = arg["path"].(string)
|
||||
}
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"text": util.GetAssetText(path),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue