mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +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 {
|
import {
|
||||||
hasClosestBlock,
|
hasClosestBlock,
|
||||||
hasClosestByAttribute,
|
hasClosestByAttribute,
|
||||||
hasClosestByClassName, hasClosestByTag,
|
hasClosestByClassName,
|
||||||
hasTopClosestByClassName, isInEmbedBlock
|
hasClosestByTag,
|
||||||
|
hasTopClosestByClassName,
|
||||||
|
isInEmbedBlock
|
||||||
} from "../protyle/util/hasClosest";
|
} from "../protyle/util/hasClosest";
|
||||||
import {MenuItem} from "./Menu";
|
import {MenuItem} from "./Menu";
|
||||||
import {focusBlock, focusByRange, focusByWbr, getEditorRange, selectAll,} from "../protyle/util/selection";
|
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 {openMenu} from "./commonMenuItem";
|
||||||
import {fetchPost, fetchSyncPost} from "../util/fetch";
|
import {fetchPost, fetchSyncPost} from "../util/fetch";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
import {
|
import {copyPlainText, readClipboard, setStorageVal, updateHotkeyTip, writeText} from "../protyle/util/compatibility";
|
||||||
copyPlainText,
|
|
||||||
readClipboard,
|
|
||||||
setStorageVal,
|
|
||||||
updateHotkeyTip,
|
|
||||||
writeText
|
|
||||||
} from "../protyle/util/compatibility";
|
|
||||||
import {preventScroll} from "../protyle/scroll/preventScroll";
|
import {preventScroll} from "../protyle/scroll/preventScroll";
|
||||||
import {onGet} from "../protyle/util/onGet";
|
import {onGet} from "../protyle/util/onGet";
|
||||||
import {getAllModels} from "../layout/getAll";
|
import {getAllModels} from "../layout/getAll";
|
||||||
|
|
@ -1087,6 +1083,10 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
||||||
const imgElement = assetElement.querySelector("img");
|
const imgElement = assetElement.querySelector("img");
|
||||||
const titleElement = assetElement.querySelector(".protyle-action__title span") as HTMLElement;
|
const titleElement = assetElement.querySelector(".protyle-action__title span") as HTMLElement;
|
||||||
const html = nodeElement.outerHTML;
|
const html = nodeElement.outerHTML;
|
||||||
|
let src = imgElement.getAttribute("src");
|
||||||
|
if (!src) {
|
||||||
|
src = ""
|
||||||
|
}
|
||||||
if (!protyle.disabled) {
|
if (!protyle.disabled) {
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
id: "imageUrlAndTitleAndTooltipText",
|
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}">
|
<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>
|
<svg><use xlink:href="#iconCopy"></use></svg>
|
||||||
</span>
|
</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__flex-center">${window.siyuan.languages.title}</span>
|
||||||
<span class="fn__space"></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}">
|
<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
|
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{}{
|
ret.Data = map[string]interface{}{
|
||||||
"text": util.GetAssetText(path),
|
"text": util.GetAssetText(path),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue