A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
update toTXT function
ammarahm-edf4a4f2e52064
diff --git a/apps/mobile/src/utils/index.js b/apps/mobile/src/utils/index.jsindex 46980c70a..2331d9a0f 100755--- a/apps/mobile/src/utils/index.js+++ b/apps/mobile/src/utils/index.js@@ -10,6 +10,7 @@ import {useSettingStore} from '../provider/stores';import {eSendEvent} from '../services/EventManager';import Navigation from '../services/Navigation';import * as ackeeTracker from './ackee';+import { db } from './database';import {refreshNotesPage} from './Events';import {MMKV} from './mmkv';import {tabBarRef} from './Refs';@@ -333,13 +334,23 @@ export const BUTTON_TYPES = {}};-let he;-export function toTXT(html) {- let text = html.replace(/<br[^>]*>/gi, '\n').replace(/<[^>]+>/g, '');- if (!he) {- he = require('he');+let htmlToText;+export async function toTXT(note) {+ let text;+ if (note.locked) {+ text = note.content.data;+ } else {+ text = await db.notes.note(note.id).content();}- return he.decode(text);+ console.log(text);++ htmlToText = htmlToText || require('html-to-text');+ console.log(htmlToText);+ text = htmlToText.convert(text, {+ selectors: [{selector: 'img', format: 'skip'}]+ });+ text = `${note.title}\n \n ${text}`;+ return text;}export const TOOLTIP_POSITIONS = {