mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
remove import()
This commit is contained in:
@@ -117,7 +117,7 @@ const Input = ({
|
||||
break;
|
||||
case 'phonenumber':
|
||||
// eslint-disable-next-line no-case-declarations
|
||||
const phone = await (await import('phone')).default;
|
||||
const phone = require('phone').default;
|
||||
// eslint-disable-next-line no-case-declarations
|
||||
let result = phone(value, {
|
||||
strictDetection: true,
|
||||
|
||||
@@ -3,44 +3,49 @@ import filesystem from '../filesystem';
|
||||
import EventSource from '../sse/even-source-ios';
|
||||
import AndroidEventSource from '../sse/event-source';
|
||||
import Storage from './storage';
|
||||
import Database from 'notes-core/api/index';
|
||||
|
||||
/**
|
||||
* @type {import("notes-core/api/index").default}
|
||||
*/
|
||||
export var db;
|
||||
export var db = new Database(
|
||||
Storage,
|
||||
Platform.OS === 'ios' ? EventSource : AndroidEventSource,
|
||||
filesystem
|
||||
);
|
||||
|
||||
db.host(
|
||||
__DEV__
|
||||
? {
|
||||
API_HOST: 'https://api.notesnook.com',
|
||||
AUTH_HOST: 'https://auth.streetwriters.co',
|
||||
SSE_HOST: 'https://events.streetwriters.co',
|
||||
SUBSCRIPTIONS_HOST: 'https://subscriptions.streetwriters.co',
|
||||
ISSUES_HOST: 'https://issues.streetwriters.co'
|
||||
// API_HOST: 'http://192.168.10.29:5264',
|
||||
// AUTH_HOST: 'http://192.168.10.29:8264',
|
||||
// SSE_HOST: 'http://192.168.10.29:7264',
|
||||
// SUBSCRIPTIONS_HOST: 'http://192.168.10.29:9264',
|
||||
// ISSUES_HOST: 'http://192.168.10.29:2624'
|
||||
}
|
||||
: {
|
||||
API_HOST: 'https://api.notesnook.com',
|
||||
AUTH_HOST: 'https://auth.streetwriters.co',
|
||||
SSE_HOST: 'https://events.streetwriters.co',
|
||||
SUBSCRIPTIONS_HOST: 'https://subscriptions.streetwriters.co',
|
||||
ISSUES_HOST: 'https://issues.streetwriters.co'
|
||||
}
|
||||
);
|
||||
|
||||
let DB = null;
|
||||
export async function loadDatabase() {
|
||||
if (!DB) {
|
||||
let module = await import(/* webpackChunkName: "notes-core" */ 'notes-core/api/index');
|
||||
DB = module.default;
|
||||
}
|
||||
db = new DB(Storage, Platform.OS === 'ios' ? EventSource : AndroidEventSource, filesystem);
|
||||
//@ts-ignore
|
||||
if (DOMParser) {
|
||||
//@ts-ignore
|
||||
await DOMParser.prepare();
|
||||
}
|
||||
db.host(
|
||||
__DEV__
|
||||
? {
|
||||
API_HOST: 'https://api.notesnook.com',
|
||||
AUTH_HOST: 'https://auth.streetwriters.co',
|
||||
SSE_HOST: 'https://events.streetwriters.co',
|
||||
SUBSCRIPTIONS_HOST: 'https://subscriptions.streetwriters.co',
|
||||
ISSUES_HOST: 'https://issues.streetwriters.co'
|
||||
// API_HOST: 'http://192.168.10.29:5264',
|
||||
// AUTH_HOST: 'http://192.168.10.29:8264',
|
||||
// SSE_HOST: 'http://192.168.10.29:7264',
|
||||
// SUBSCRIPTIONS_HOST: 'http://192.168.10.29:9264',
|
||||
// ISSUES_HOST: 'http://192.168.10.29:2624'
|
||||
}
|
||||
: {
|
||||
API_HOST: 'https://api.notesnook.com',
|
||||
AUTH_HOST: 'https://auth.streetwriters.co',
|
||||
SSE_HOST: 'https://events.streetwriters.co',
|
||||
SUBSCRIPTIONS_HOST: 'https://subscriptions.streetwriters.co',
|
||||
ISSUES_HOST: 'https://issues.streetwriters.co'
|
||||
}
|
||||
);
|
||||
// if (!DB) {
|
||||
// let module = await import(/* webpackChunkName: "notes-core" */ 'notes-core/api/index');
|
||||
// DB = module.default;
|
||||
// }
|
||||
// db = new DB(Storage, Platform.OS === 'ios' ? EventSource : AndroidEventSource, filesystem);
|
||||
// //@ts-ignore
|
||||
// if (DOMParser) {
|
||||
// //@ts-ignore
|
||||
// await DOMParser.prepare();
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ export async function toTXT(note, notitle) {
|
||||
} else {
|
||||
text = await db.notes.note(note.id).content();
|
||||
}
|
||||
htmlToText = htmlToText || (await import('html-to-text'));
|
||||
htmlToText = htmlToText || require('html-to-text');
|
||||
text = htmlToText.convert(text, {
|
||||
selectors: [{ selector: 'img', format: 'skip' }]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user