Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: Improve image OCR copying and editing https://github.com/siyuan-note/siyuan/issues/19977

Danielb70736e718a6
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100744-br924ar.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100744-br924ar.sy
index 57c5141013..17f121152d 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100744-br924ar.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100744-br924ar.sy
@@ -6,7 +6,7 @@
"id": "20200924100744-br924ar",
"title": "Assets",
"type": "doc",
- "updated": "20260930085927"
+ "updated": "20260930090802"
},
"Children": [
{
@@ -1328,6 +1328,20 @@
"Data": "After the adjustment, you need to manually rebuild the asset content index."
}
]
+ },
+ {
+ "ID": "20260930090802-3zn8sf9",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260930090802-3zn8sf9",
+ "updated": "20260930090802"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "The image OCR icon copies recognized text with one click; double-click it to open a draggable editor with the original image beside the text. You can also copy OCR text or open the result editor from the image menu. Click Save to keep edits or Cancel to discard them; clicking outside the editor does not close it."
+ }
+ ]
}
]
}
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200915214115-42b8zma.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200915214115-42b8zma.sy
index 76a2d44923..429be664d7 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200915214115-42b8zma.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200915214115-42b8zma.sy
@@ -6,7 +6,7 @@
"id": "20200915214115-42b8zma",
"title": "资源文件",
"type": "doc",
- "updated": "20260930085927"
+ "updated": "20260930090802"
},
"Children": [
{
@@ -1337,6 +1337,20 @@
"Data": "调整完以后需要手动重建资源文件索引。"
}
]
+ },
+ {
+ "ID": "20260930090802-qkecuzx",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260930090802-qkecuzx",
+ "updated": "20260930090802"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "单击图片上的 OCR 图标可复制识别文本,双击可打开可拖动的编辑窗口,对照旁边的原图修改文本。也可通过图片菜单复制 OCR 文本或打开结果编辑窗口。点击保存确认修改,点击取消放弃修改;点击窗口外不会关闭编辑窗口。"
+ }
+ ]
}
]
}
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123038-4umgpxy.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123038-4umgpxy.sy
index f2031f8c50..ceaba382ac 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123038-4umgpxy.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123038-4umgpxy.sy
@@ -6,7 +6,7 @@
"id": "20211226123038-4umgpxy",
"title": "資料文件",
"type": "doc",
- "updated": "20260930085927"
+ "updated": "20260930090802"
},
"Children": [
{
@@ -1322,6 +1322,20 @@
"Data": "調整完以後需要手動重建資源檔案索引。"
}
]
+ },
+ {
+ "ID": "20260930090802-ffpq13r",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260930090802-ffpq13r",
+ "updated": "20260930090802"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "按一下圖片上的 OCR 圖示可複製辨識文字,按兩下可開啟可拖曳的編輯視窗,對照旁邊的原圖修改文字。也可透過圖片選單複製 OCR 文字或開啟結果編輯視窗。按儲存確認修改,按取消放棄修改;按視窗外不會關閉編輯視窗。"
+ }
+ ]
}
]
}
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-1m5un7l.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-1m5un7l.sy
index 6dc65a5523..3c92e10aaa 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-1m5un7l.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-1m5un7l.sy
@@ -7,7 +7,7 @@
"id": "20240530101000-1m5un7l",
"title": "アセット",
"type": "doc",
- "updated": "20260930085927"
+ "updated": "20260930090802"
},
"Children": [
{
@@ -1400,6 +1400,20 @@
"ID": "20240530101000-8x52yt3",
"id": "20240530101000-52fjbe1"
}
+ },
+ {
+ "ID": "20260930090802-fdfc9yh",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260930090802-fdfc9yh",
+ "updated": "20260930090802"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "画像の OCR アイコンをクリックすると認識テキストをコピーでき、ダブルクリックすると元画像とテキストを並べた移動可能な編集ウィンドウが開きます。画像メニューからも OCR テキストのコピーや結果の編集ができます。保存で変更を確定し、キャンセルで破棄します。ウィンドウの外側をクリックしても閉じません。"
+ }
+ ]
}
]
}
diff --git a/app/src/asset/imageOCR.test.ts b/app/src/asset/imageOCR.test.ts
new file mode 100644
index 0000000000..082a6f7de5
--- /dev/null
+++ b/app/src/asset/imageOCR.test.ts
@@ -0,0 +1,114 @@
+import * as assert from "node:assert/strict";
+import {execFile} from "node:child_process";
+import {mkdtempSync, readFileSync, rmSync, writeFileSync} from "node:fs";
+import {tmpdir} from "node:os";
+import * as path from "node:path";
+import {test} from "node:test";
+import {promisify} from "node:util";
+import {ScriptTarget, transpileModule} from "typescript";
+
+const browserCases = async (source: string, actionsSource: string) => {
+ const check: typeof assert = require("node:assert/strict");
+ const copied: string[] = [];
+ const saved: {path: string, text: string}[] = [];
+ let dialog: {element: HTMLElement, destroy: () => void};
+ let receive: (response: {data: {text: string}}) => void;
+ Object.assign(window, {siyuan: {languages: {copy: "Copy", save: "Save", cancel: "Cancel", ocrResult: "OCR",
+ copied: "Copied", doubleClick: "Double click"}}});
+ const dependencies = {
+ Dialog: class {
+ element: HTMLElement;
+ constructor(options: {content: string, disableClose: boolean}) {
+ check.equal(options.disableClose, true);
+ this.element = document.createElement("div");
+ this.element.innerHTML = options.content;
+ document.body.append(this.element);
+ dialog = this;
+ }
+ destroy() { this.element.remove(); }
+ },
+ fetchPost: (_url: string, _body: {path: string}, callback: typeof receive) => { receive = callback; },
+ fetchSyncPost: async (_url: string, body: {path: string, text: string}) => {
+ saved.push(body);
+ return {code: 0};
+ },
+ writeText: (text: string) => copied.push(text), showMessage: () => {},
+ };
+ const api = new Function(...Object.keys(dependencies), source + "\nreturn {openImageOCR, copyImageOCRText};")(...Object.values(dependencies));
+ api.openImageOCR("assets/first.png");
+ let textarea = dialog.element.querySelector("textarea");
+ check.equal(textarea.disabled, true);
+ receive({data: {text: "recognized"}});
+ textarea.value = "corrected";
+ (dialog.element.querySelector('[data-action="copy"]') as HTMLElement).click();
+ check.deepEqual(copied, ["corrected"]);
+ (dialog.element.querySelector('[data-action="cancel"]') as HTMLElement).click();
+ check.equal(saved.length, 0);
+ api.openImageOCR("assets/second.png");
+ textarea = dialog.element.querySelector("textarea");
+ receive({data: {text: "original"}});
+ textarea.value = "updated";
+ (dialog.element.querySelector('[data-action="save"]') as HTMLElement).click();
+ await new Promise(resolve => setTimeout(resolve, 0));
+ check.deepEqual(saved, [{path: "assets/second.png", text: "updated"}]);
+ check.equal(dialog.element.isConnected, false);
+ let opens = 0;
+ let copies = 0;
+ const render = new Function("Constants", "copyImageOCRText", "openImageOCR", "isEncryptedBox", actionsSource +
+ "\nreturn renderImageActions;")({TIMEOUT_DBLCLICK: 20}, () => copies++, () => opens++, () => false);
+ const root = document.createElement("div");
+ root.className = "protyle-wysiwyg";
+ root.innerHTML = '<span class="img"><span></span><span><span class="protyle-icons"><span class="protyle-icon--only"></span></span><img data-src="assets/image.png"></span></span>';
+ document.body.append(root);
+ render(root);
+ render(root);
+ check.equal(root.querySelectorAll(".protyle-action__ocr").length, 1);
+ const action = root.querySelector<HTMLElement>(".protyle-action__ocr");
+ action.click();
+ await new Promise(resolve => setTimeout(resolve, 30));
+ check.equal(copies, 1);
+ action.click();
+ action.click();
+ action.dispatchEvent(new MouseEvent("dblclick", {bubbles: true}));
+ await new Promise(resolve => setTimeout(resolve, 30));
+ check.equal(copies, 1);
+ check.equal(opens, 1);
+ root.setAttribute("data-readonly", "true");
+ action.dispatchEvent(new MouseEvent("dblclick", {bubbles: true}));
+ check.equal(opens, 1);
+ return "Image OCR cases passed";
+};
+
+test("image OCR copying, explicit saving and double-click editing", {
+ skip: process.platform === "linux" && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY,
+ timeout: 45000,
+}, async () => {
+ const compile = (file: string) => transpileModule(readFileSync(path.resolve(__dirname, file), "utf8")
+ .replace(/^import [\s\S]*?;\r?\n/gm, "").replace(/^export /gm, ""),
+ {compilerOptions: {target: ScriptTarget.ES2021}}).outputText;
+ const temporary = mkdtempSync(path.join(tmpdir(), "siyuan-image-ocr-test-"));
+ const script = path.join(temporary, "run.cjs");
+ const code = "const __name = value => value; (" + browserCases.toString() + ")(" +
+ JSON.stringify(compile("imageOCR.ts")) + "," + JSON.stringify(compile("../protyle/render/imageActions.ts")) + ")";
+ writeFileSync(script, `const {app, BrowserWindow} = require("electron");
+app.setPath("userData", ${JSON.stringify(path.join(temporary, "profile"))});
+app.whenReady().then(async () => {
+ const win = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true, contextIsolation: false}});
+ try {
+ await win.loadURL("data:text/html,<html><body></body></html>");
+ console.log(await win.webContents.executeJavaScript(${JSON.stringify(code)}));
+ app.exit(0);
+ } catch (error) { console.error(error); app.exit(1); }
+});`, "utf8");
+ const env = {...process.env};
+ delete env.ELECTRON_RUN_AS_NODE;
+ try {
+ const result = await promisify(execFile)(require("electron") as unknown as string, [script],
+ {env, windowsHide: true, timeout: 40000});
+ assert.match(result.stdout, /Image OCR cases passed/);
+ } finally {
+ if (path.dirname(path.resolve(temporary)) === path.resolve(tmpdir()) && path.basename(temporary).startsWith("siyuan-image-ocr-test-")) {
+ rmSync(temporary, {recursive: true, force: true});
+ }
+ }
+});
diff --git a/app/src/asset/imageOCR.ts b/app/src/asset/imageOCR.ts
new file mode 100644
index 0000000000..742f13a620
--- /dev/null
+++ b/app/src/asset/imageOCR.ts
@@ -0,0 +1,89 @@
+import {Dialog} from "../dialog";
+import {showMessage} from "../dialog/message";
+import {fetchPost, fetchSyncPost} from "../util/fetch";
+import {writeText} from "../protyle/util/compatibility";
+
+export const copyImageOCRText = (path: string) => {
+ fetchPost("/api/asset/getImageOCRText", {path}, (response) => {
+ writeText(response.data.text);
+ showMessage(window.siyuan.languages.copied);
+ });
+};
+
+export const openImageOCR = (path: string) => {
+ let closed = false;
+ let originalText = "";
+ const controller = new AbortController();
+ const dialog = new Dialog({
+ title: window.siyuan.languages.ocrResult,
+ transparent: true,
+ disableClose: true,
+ width: "min(900px, 88vw)",
+ height: "min(620px, 80vh)",
+ content: `<div class="b3-dialog__content image-ocr">
+ <div class="image-ocr__preview"><img></div>
+ <textarea class="b3-text-field image-ocr__text" spellcheck="false" disabled></textarea>
+</div>
+<div class="b3-dialog__action">
+ <button class="b3-button b3-button--text" data-action="copy" disabled>${window.siyuan.languages.copy}</button>
+ <div class="fn__flex-1"></div>
+ <button class="b3-button b3-button--cancel" data-action="cancel">${window.siyuan.languages.cancel}</button>
+ <span class="fn__space"></span>
+ <button class="b3-button b3-button--text" data-action="save" disabled>${window.siyuan.languages.save}</button>
+</div>`,
+ destroyCallback: () => {
+ closed = true;
+ controller.abort();
+ }
+ });
+ const textarea = dialog.element.querySelector("textarea");
+ const copy = dialog.element.querySelector<HTMLButtonElement>('[data-action="copy"]');
+ const save = dialog.element.querySelector<HTMLButtonElement>('[data-action="save"]');
+ const close = () => {
+ closed = true;
+ controller.abort();
+ dialog.destroy();
+ };
+ dialog.element.querySelector("img").src = path;
+ textarea.placeholder = window.siyuan.languages.loading;
+ textarea.setAttribute("aria-label", window.siyuan.languages.ocrResult);
+ copy.addEventListener("click", () => {
+ writeText(textarea.value);
+ showMessage(window.siyuan.languages.copied);
+ });
+ dialog.element.querySelector('[data-action="cancel"]').addEventListener("click", close);
+ save.addEventListener("click", async () => {
+ if (textarea.value === originalText) {
+ close();
+ return;
+ }
+ save.disabled = true;
+ try {
+ const response = await fetchSyncPost("/api/asset/setImageOCRText", {path, text: textarea.value});
+ if (!closed && response.code === 0) {
+ close();
+ }
+ } finally {
+ save.disabled = false;
+ }
+ });
+ dialog.element.addEventListener("keydown", (event: KeyboardEvent) => {
+ if (event.key === "Escape" && !event.isComposing) {
+ close();
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ });
+ fetchPost("/api/asset/getImageOCRText", {path}, (response) => {
+ if (closed) {
+ return;
+ }
+ originalText = response.data.text;
+ textarea.value = originalText;
+ textarea.placeholder = window.siyuan.languages.ocrResult;
+ textarea.disabled = false;
+ copy.disabled = false;
+ save.disabled = false;
+ textarea.focus();
+ }, undefined, undefined, controller.signal);
+};
diff --git a/app/src/assets/scss/protyle/_protyle.scss b/app/src/assets/scss/protyle/_protyle.scss
index 345ee1d496..9f1a6c4084 100644
--- a/app/src/assets/scss/protyle/_protyle.scss
+++ b/app/src/assets/scss/protyle/_protyle.scss
@@ -1400,3 +1400,32 @@ table + .protyle-action__table {
pointer-events: none;
}
}
+.image-ocr {
+ display: flex;
+ gap: 16px;
+ min-height: 0;
+
+ &__preview {
+ flex: 1;
+ min-width: 0;
+ overflow: auto;
+
+ img {
+ max-width: 100%;
+ }
+ }
+
+ &__text {
+ flex: 1;
+ min-width: 0;
+ resize: none;
+ }
+
+ @media (max-width: 600px) {
+ flex-direction: column;
+
+ &__text {
+ min-height: 160px;
+ }
+ }
+}
diff --git a/app/src/config/entryVisibility/catalog.test.ts b/app/src/config/entryVisibility/catalog.test.ts
index 914f50af27..63b82d99c7 100644
--- a/app/src/config/entryVisibility/catalog.test.ts
+++ b/app/src/config/entryVisibility/catalog.test.ts
@@ -38,6 +38,14 @@ import {
} from "./catalog";
import {getBuiltinProfileEntryVisibility} from "./profile";
+test("image OCR actions retain their configurable paths and order", () => {
+ assert.deepEqual(getEntryCatalogChildren("inline.image.ocr").map(item => item.key), [
+ "ocrResult", "copyOCRText", "separator_reOCR", "reOCR",
+ ]);
+ assert.equal(getEntryCatalogNode("inline.image.ocr.copyOCRText").simple, false);
+ assert.equal(getEntryParentPath("inline.image.ocr.copyOCRText"), "inline.image.ocr");
+});
+
test("remove list leads single and multiple block conversion menus", () => {
for (const path of ["gutter.single.turnInto", "gutter.multi.turnInto"]) {
assert.deepEqual(getEntryCatalogChildren(path).slice(0, 2).map(item => item.key), ["removeList", "list"]);
diff --git a/app/src/config/entryVisibility/catalog.ts b/app/src/config/entryVisibility/catalog.ts
index dc76bb7e5c..f9199b5577 100644
--- a/app/src/config/entryVisibility/catalog.ts
+++ b/app/src/config/entryVisibility/catalog.ts
@@ -953,6 +953,7 @@ export const entryCatalog: IEntryCatalogSection[] = [
node("rename", lang("rename")),
node("ocr", literal("OCR"), false, [
node("ocrResult", lang("ocrResult"), false),
+ node("copyOCRText", () => `${window.siyuan.languages.copy} OCR`, false),
separator("separator_reOCR"),
node("reOCR", lang("reOCR"), false),
]),
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index a53317c881..90cda527ca 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -82,6 +82,7 @@ import {getParentDocumentID} from "../protyle/util/parentDocument";
import {prepareInlineElementBoundaryMutation} from "../protyle/util/inlineElementBoundary";
import {getZoomFocusScrollAttr, shouldFocusAfterZoom} from "../protyle/util/focusRestore";
import {scrollCenter} from "../util/highlightById";
+import {copyImageOCRText, openImageOCR} from "../asset/imageOCR";
import {
getSemanticInlineVisibleText,
normalizeSemanticInlineElement,
@@ -1367,18 +1368,17 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
label: "OCR",
submenu: [{
id: "ocrResult",
- iconHTML: "",
- type: "readonly",
- label: `<textarea spellcheck="false" data-type="ocr" style="margin: 4px 0" rows="1" class="b3-text-field fn__block" placeholder="${window.siyuan.languages.ocrResult}"></textarea>`,
- bind(element) {
- element.style.maxWidth = "none";
- fetchPost("/api/asset/getImageOCRText", {
- path: imgElement.getAttribute("src")
- }, (response) => {
- const textarea = element.querySelector("textarea");
- textarea.value = response.data.text;
- textarea.dataset.ocrText = response.data.text;
- });
+ icon: "iconEdit",
+ label: window.siyuan.languages.ocrResult,
+ click() {
+ openImageOCR(imgElement.getAttribute("data-src"));
+ }
+ }, {
+ id: "copyOCRText",
+ icon: "iconCopy",
+ label: `${window.siyuan.languages.copy} OCR`,
+ click() {
+ copyImageOCRText(imgElement.getAttribute("data-src"));
}
}, {
id: "separator_reOCR",
@@ -1607,13 +1607,6 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
}
}
- const ocrElement = window.siyuan.menus.menu.element.querySelector('[data-type="ocr"]') as HTMLTextAreaElement;
- if (ocrElement && ocrElement.dataset.ocrText !== ocrElement.value) {
- fetchPost("/api/asset/setImageOCRText", {
- path: imgElement.getAttribute("src"),
- text: ocrElement.value
- });
- }
imgElement.setAttribute("alt", textElements[2].value.replace(/\n|\r\n|\r|\u2028|\u2029/g, ""));
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, nodeElement, html);
diff --git a/app/src/protyle/render/imageActions.ts b/app/src/protyle/render/imageActions.ts
new file mode 100644
index 0000000000..61468692b9
--- /dev/null
+++ b/app/src/protyle/render/imageActions.ts
@@ -0,0 +1,50 @@
+import {Constants} from "../../constants";
+import {copyImageOCRText, openImageOCR} from "../../asset/imageOCR";
+import {isEncryptedBox} from "../../util/pathName";
+
+export const renderImageActions = (root: Element) => {
+ root.querySelectorAll<HTMLImageElement>(".img img").forEach(image => {
+ const actions = image.parentElement.querySelector(".protyle-icons");
+ if (!actions || actions.querySelector(".protyle-action__ocr") || window.siyuan.isPublish ||
+ !image.closest(".protyle-wysiwyg") || !image.getAttribute("data-src")?.startsWith("assets/") ||
+ isEncryptedBox(image.closest("[data-notebook-id]")?.getAttribute("data-notebook-id"))) {
+ return;
+ }
+ const action = document.createElement("span");
+ action.className = "protyle-icon protyle-icon--first protyle-action__ocr ariaLabel";
+ action.tabIndex = 0;
+ action.setAttribute("role", "button");
+ action.setAttribute("aria-label", `${window.siyuan.languages.copy} OCR / ${window.siyuan.languages.doubleClick} ${window.siyuan.languages.ocrResult}`);
+ action.setAttribute("data-position", "north");
+ action.innerHTML = '<svg><use xlink:href="#iconCopy"></use></svg>';
+ let timer: number;
+ action.addEventListener("click", event => {
+ event.stopPropagation();
+ event.preventDefault();
+ clearTimeout(timer);
+ timer = window.setTimeout(() => {
+ if (image.isConnected) {
+ copyImageOCRText(image.getAttribute("data-src"));
+ }
+ }, Constants.TIMEOUT_DBLCLICK);
+ });
+ action.addEventListener("dblclick", event => {
+ event.stopPropagation();
+ event.preventDefault();
+ clearTimeout(timer);
+ if (image.closest(".protyle-wysiwyg")?.getAttribute("data-readonly") !== "true") {
+ openImageOCR(image.getAttribute("data-src"));
+ }
+ });
+ action.addEventListener("keydown", (event: KeyboardEvent) => {
+ if ((event.key === "Enter" || event.key === " ") && !event.isComposing) {
+ copyImageOCRText(image.getAttribute("data-src"));
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ });
+ const more = actions.querySelector(".protyle-icon--only");
+ more?.classList.replace("protyle-icon--only", "protyle-icon--last");
+ actions.prepend(action);
+ });
+};
diff --git a/app/src/protyle/util/processCode.ts b/app/src/protyle/util/processCode.ts
index aa91cf1565..7923842f3b 100644
--- a/app/src/protyle/util/processCode.ts
+++ b/app/src/protyle/util/processCode.ts
@@ -14,6 +14,7 @@ import {renderTableCellRichElements} from "../render/tableCellRich";
import {renderEmbedHeadings} from "../render/embedHeading";
import {normalizeInlineElementBoundaries} from "./inlineElementBoundary";
import {renderLongTextRuns} from "./longTextWrap";
+import {renderImageActions} from "../render/imageActions";
export const processPasteCode = (html: string, text: string, originalTextHTML: string, protyle: IProtyle) => {
const tempElement = document.createElement("div");
@@ -63,6 +64,7 @@ const RENDER_MAP: Record<string, (previewPanel: Element) => void> = {
};
export const processRender = (previewPanel: Element) => {
+ renderImageActions(previewPanel);
normalizeInlineElementBoundaries(previewPanel);
renderLongTextRuns(previewPanel);
renderEmbedHeadings(previewPanel);