diff --git a/src/modules/reader.ts b/src/modules/reader.ts
index 71b6c33..b98f2e3 100644
--- a/src/modules/reader.ts
+++ b/src/modules/reader.ts
@@ -114,40 +114,6 @@ async function initializeReaderAnnotationButton(
},
];
- if (annotationItem.annotationType === "image") {
- annotationButtons.push({
- tag: "div",
- classList: ["icon"],
- properties: {
- innerHTML: ICONS.readerOCR,
- },
- listeners: [
- {
- type: "click",
- listener: (e) => {
- // TODO: OCR
- e.preventDefault();
- },
- },
- {
- type: "mouseover",
- listener: (e) => {
- (e.target as HTMLElement).style.backgroundColor = "#F0F0F0";
- },
- },
- {
- type: "mouseout",
- listener: (e) => {
- (e.target as HTMLElement).style.removeProperty(
- "background-color",
- );
- },
- },
- ],
- enableElementRecord: true,
- });
- }
-
ztoolkit.UI.insertElementBefore(
{
tag: "fragment",
@@ -224,168 +190,3 @@ async function createNoteFromAnnotation(
annotationItem.addTag(getNoteLink(note)!);
await annotationItem.saveTx();
}
-
-// async function OCRImageAnnotation(src: string, annotationItem: Zotero.Item) {
-// /*
-// message.content = {
-// params: { src: string, annotationItem: Zotero.Item }
-// }
-// */
-// let result: string;
-// let success: boolean;
-// const engine = Zotero.Prefs.get("Knowledge4Zotero.OCREngine");
-// if (engine === "mathpix") {
-// const xhr = await Zotero.HTTP.request(
-// "POST",
-// "https://api.mathpix.com/v3/text",
-// {
-// headers: {
-// "Content-Type": "application/json; charset=utf-8",
-// app_id: Zotero.Prefs.get("Knowledge4Zotero.OCRMathpix.Appid"),
-// app_key: Zotero.Prefs.get("Knowledge4Zotero.OCRMathpix.Appkey"),
-// },
-// body: JSON.stringify({
-// src: src,
-// math_inline_delimiters: ["$", "$"],
-// math_display_delimiters: ["$$", "$$"],
-// rm_spaces: true,
-// }),
-// responseType: "json",
-// }
-// );
-// this._Addon.toolkit.Tool.log(xhr);
-// if (xhr && xhr.status && xhr.status === 200 && xhr.response.text) {
-// result = xhr.response.text;
-// success = true;
-// } else {
-// result = xhr.status === 200 ? xhr.response.error : `${xhr.status} Error`;
-// success = false;
-// }
-// } else if (engine === "xunfei") {
-// /**
-// * 1.Doc:https://www.xfyun.cn/doc/words/formula-discern/API.html
-// * 2.Error code:https://www.xfyun.cn/document/error-code
-// * @author iflytek
-// */
-
-// const config = {
-// hostUrl: "https://rest-api.xfyun.cn/v2/itr",
-// host: "rest-api.xfyun.cn",
-// appid: Zotero.Prefs.get("Knowledge4Zotero.OCRXunfei.APPID"),
-// apiSecret: Zotero.Prefs.get("Knowledge4Zotero.OCRXunfei.APISecret"),
-// apiKey: Zotero.Prefs.get("Knowledge4Zotero.OCRXunfei.APIKey"),
-// uri: "/v2/itr",
-// };
-
-// let date = new Date().toUTCString();
-// let postBody = getPostBody();
-// let digest = getDigest(postBody);
-
-// const xhr = await Zotero.HTTP.request("POST", config.hostUrl, {
-// headers: {
-// "Content-Type": "application/json",
-// Accept: "application/json,version=1.0",
-// Host: config.host,
-// Date: date,
-// Digest: digest,
-// Authorization: getAuthStr(date, digest),
-// },
-// body: JSON.stringify(postBody),
-// responseType: "json",
-// });
-
-// if (xhr?.response?.code === 0) {
-// result = xhr.response.data.region
-// .filter((r) => r.type === "text")
-// .map((r) => r.recog.content)
-// .join(" ")
-// .replace(/ifly-latex-(begin)?(end)?/g, "$");
-// this._Addon.toolkit.Tool.log(xhr);
-// success = true;
-// } else {
-// result =
-// xhr.status === 200
-// ? `${xhr.response.code} ${xhr.response.message}`
-// : `${xhr.status} Error`;
-// success = false;
-// }
-
-// function getPostBody() {
-// let digestObj = {
-// common: {
-// app_id: config.appid,
-// },
-// business: {
-// ent: "teach-photo-print",
-// aue: "raw",
-// },
-// data: {
-// image: src.split(",").pop(),
-// },
-// };
-// return digestObj;
-// }
-
-// function getDigest(body) {
-// return (
-// "SHA-256=" +
-// CryptoJS.enc.Base64.stringify(CryptoJS.SHA256(JSON.stringify(body)))
-// );
-// }
-
-// function getAuthStr(date, digest) {
-// let signatureOrigin = `host: ${config.host}\ndate: ${date}\nPOST ${config.uri} HTTP/1.1\ndigest: ${digest}`;
-// let signatureSha = CryptoJS.HmacSHA256(signatureOrigin, config.apiSecret);
-// let signature = CryptoJS.enc.Base64.stringify(signatureSha);
-// let authorizationOrigin = `api_key="${config.apiKey}", algorithm="hmac-sha256", headers="host date request-line digest", signature="${signature}"`;
-// return authorizationOrigin;
-// }
-// } else if (engine === "bing") {
-// const xhr = await Zotero.HTTP.request(
-// "POST",
-// "https://www.bing.com/cameraexp/api/v1/getlatex",
-// {
-// headers: {
-// "Content-Type": "application/json",
-// },
-// body: JSON.stringify({
-// data: src.split(",").pop(),
-// inputForm: "Image",
-// clientInfo: { platform: "edge" },
-// }),
-// responseType: "json",
-// }
-// );
-// if (xhr && xhr.status && xhr.status === 200 && !xhr.response.isError) {
-// result = xhr.response.latex
-// ? `$${xhr.response.latex}$`
-// : xhr.response.ocrText;
-// success = true;
-// } else {
-// result =
-// xhr.status === 200 ? xhr.response.errorMessage : `${xhr.status} Error`;
-// success = false;
-// }
-// } else {
-// result = "OCR Engine Not Found";
-// success = false;
-// }
-// if (success) {
-// annotationItem.annotationComment = `${
-// annotationItem.annotationComment
-// ? `${annotationItem.annotationComment}\n`
-// : ""
-// }${result}`;
-// await annotationItem.saveTx();
-// this._Addon.ZoteroViews.showProgressWindow(
-// "Better Notes OCR",
-// `OCR Result: ${result}`
-// );
-// } else {
-// this._Addon.ZoteroViews.showProgressWindow(
-// "Better Notes OCR",
-// result,
-// "fail"
-// );
-// }
-// }
diff --git a/src/utils/config.ts b/src/utils/config.ts
index e1593ea..a20d7a9 100644
--- a/src/utils/config.ts
+++ b/src/utils/config.ts
@@ -148,15 +148,6 @@ export const ICONS = {
workspace_notes_collapsed: `w`,
workspace_notes_open: ``,
readerQuickNote: ``,
- readerOCR: ``,
- // old
- addCitation: ``,
- notMainKnowledge: ``,
- isMainKnowledge: ``,
- openAttachment: ``,
- switchEditor: ``,
- export: ``,
- close: ``,
embedLinkContent: ``,
updateLinkText: ``,
openInNewWindow: ``,