Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: use text exporter from core

ammarahm-ed9cfaa9023290
diff --git a/apps/mobile/app/hooks/use-actions.js b/apps/mobile/app/hooks/use-actions.js
index aeec775ea..0b8efb67b 100644
--- a/apps/mobile/app/hooks/use-actions.js
+++ b/apps/mobile/app/hooks/use-actions.js
@@ -171,8 +171,8 @@ export const useActions = ({ close = () => null, item }) => {
return;
}
if (item.locked) return;
- let html = await db.notes.note(item.id).content();
- let text = await toTXT(item);
+ let text = await toTXT(item, false);
+ let html = text.replace(/\n/g, "<br />");
Notifications.displayNotification({
title: item.title,
message: item.headline || text,
@@ -520,6 +520,7 @@ export const useActions = ({ close = () => null, item }) => {
}
async function exportNote() {
+ if (item.locked) return;
ExportNotesSheet.present([item]);
}
diff --git a/apps/mobile/app/utils/index.js b/apps/mobile/app/utils/index.js
index 241786f6b..1fd892d4b 100755
--- a/apps/mobile/app/utils/index.js
+++ b/apps/mobile/app/utils/index.js
@@ -145,19 +145,12 @@ export function getTotalNotes(item) {
return db.notebooks.notebook(item.id)?.totalNotes || 0;
}
-export async function toTXT(note, notitle) {
+export async function toTXT(note, template = true) {
let text;
if (note.locked) {
- text = note.content.data;
+ text = await db.notes.note(note.id).export("txt", note.content, template);
} else {
- text = await db.notes.note(note.id).content();
- }
- htmlToText = htmlToText || require("html-to-text");
- text = htmlToText.convert(text, {
- selectors: [{ selector: "img", format: "skip" }]
- });
- if (!notitle) {
- text = `${note.title}\n \n ${text}`;
+ text = await db.notes.note(note.id).export("txt", undefined, template);
}
return text;
}