mobile: setup geckoview on android

This commit is contained in:
ammarahm-ed
2022-11-08 14:42:37 +05:00
parent 59e8de0f29
commit 10904d13c2
20 changed files with 210 additions and 2048 deletions

View File

@@ -45,6 +45,8 @@ import { useEditor } from "./tiptap/use-editor";
import { useEditorEvents } from "./tiptap/use-editor-events";
import { editorController } from "./tiptap/utils";
import { useLayoutEffect } from "react";
import GeckoView from "@ammarahmed/react-native-geckoview";
import { useSettingStore } from "../../stores/use-setting-store";
const style: ViewStyle = {
height: "100%",
@@ -84,6 +86,9 @@ const Editor = React.memo(
ref
) => {
const editor = useEditor(editorId || "", readonly, onChange, theme);
const useGeckoView = useSettingStore(
(state) => state.settings.useGeckoView
);
const onMessage = useEditorEvents(editor, {
readonly,
noToolbar,
@@ -115,6 +120,7 @@ const Editor = React.memo(
const onError = useCallback(() => {
editor.setLoading(true);
console.log("loading editor");
setTimeout(() => editor.setLoading(false), 10);
}, [editor]);
@@ -129,54 +135,76 @@ const Editor = React.memo(
useLayoutEffect(() => {
onLoad && onLoad();
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [onLoad]);
if (withController) {
editorController.current = editor;
}
return editor.loading ? null : (
<>
<WebView
testID={notesnook.editor.id}
ref={editor.ref}
onLoad={editor.onLoad}
onRenderProcessGone={onError}
nestedScrollEnabled
onError={onError}
injectedJavaScriptBeforeContentLoaded={`
{!useGeckoView || editorId !== "" ? (
<WebView
testID={notesnook.editor.id}
ref={editor.ref}
onLoad={editor.onLoad}
onRenderProcessGone={onError}
nestedScrollEnabled
onError={onError}
injectedJavaScriptBeforeContentLoaded={`
globalThis.readonly=${readonly};
globalThis.noToolbar=${noToolbar};
globalThis.noHeader=${noHeader};
`}
injectedJavaScript={`globalThis.sessionId="${editor.sessionId}";`}
javaScriptEnabled={true}
focusable={true}
setSupportMultipleWindows={false}
overScrollMode="never"
scrollEnabled={false}
keyboardDisplayRequiresUserAction={false}
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
cacheMode="LOAD_DEFAULT"
cacheEnabled={true}
domStorageEnabled={true}
bounces={false}
setBuiltInZoomControls={false}
setDisplayZoomControls={false}
allowFileAccess={true}
scalesPageToFit={true}
hideKeyboardAccessoryView={false}
allowFileAccessFromFileURLs={true}
allowUniversalAccessFromFileURLs={true}
originWhitelist={["*"]}
source={{
uri: EDITOR_URI
}}
style={style}
autoManageStatusBarEnabled={false}
onMessage={onMessage || undefined}
/>
injectedJavaScript={`globalThis.sessionId="${editor.sessionId}";`}
javaScriptEnabled={true}
focusable={true}
setSupportMultipleWindows={false}
overScrollMode="never"
scrollEnabled={false}
keyboardDisplayRequiresUserAction={false}
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
cacheMode="LOAD_DEFAULT"
cacheEnabled={true}
domStorageEnabled={true}
bounces={false}
setBuiltInZoomControls={false}
setDisplayZoomControls={false}
allowFileAccess={true}
scalesPageToFit={true}
hideKeyboardAccessoryView={false}
allowFileAccessFromFileURLs={true}
allowUniversalAccessFromFileURLs={true}
originWhitelist={["*"]}
source={{
uri: EDITOR_URI
}}
style={style}
autoManageStatusBarEnabled={false}
onMessage={onMessage || undefined}
/>
) : (
<GeckoView
//@ts-ignore
ref={editor.ref}
source={{
uri: EDITOR_URI
}}
onLoadingStart={(e) => {
console.log(e.nativeEvent);
}}
injectedJavaScript={`globalThis.sessionId="${editor.sessionId}";`}
style={style}
onLoadingFinish={editor.onLoad}
onMessagingDisconnected={() => {
//@ts-ignore
editor.ref?.connectMessagingPort();
}}
onLoadingError={onError}
onMessage={onMessage}
/>
)}
{editorId === "shareEditor" ? null : (
<AppSection editor={editor} editorId={editorId} />
)}

View File

@@ -27,6 +27,7 @@ import { Platform } from "react-native";
import { EdgeInsets } from "react-native-safe-area-context";
import WebView from "react-native-webview";
import { db } from "../../../common/database";
import SettingsService from "../../../services/settings";
import { sleep } from "../../../utils/time";
import { NoteType } from "../../../utils/types";
import { Settings } from "./types";
@@ -38,6 +39,7 @@ async function call(webview: RefObject<WebView | undefined>, action?: Action) {
if (!webview.current || !action) return;
setImmediate(() => webview.current?.injectJavaScript(action.job));
const response = await getResponse(action.id);
// if (!response) {
// console.warn("webview job failed", action.id);
// }
@@ -78,13 +80,18 @@ class Commands {
focus = async () => {
if (!this.ref.current) return;
if (Platform.OS === "android") {
//this.ref.current?.requestFocus();
setTimeout(async () => {
if (!this.ref) return;
textInput.current?.focus();
await this.doAsync("editor.commands.focus()");
this.ref?.current?.requestFocus();
}, 1);
const isGeckoView = SettingsService.get().useGeckoView;
setTimeout(
async () => {
if (!this.ref) return;
textInput.current?.focus();
setTimeout(async () => {
this.ref?.current?.requestFocus();
await this.doAsync("editor.commands.focus()");
}, 10);
},
isGeckoView ? 100 : 1
);
} else {
await sleep(200);
await this.doAsync("editor.commands.focus()");

View File

@@ -286,13 +286,20 @@ export const useEditorEvents = (
const onMessage = useCallback(
(event: WebViewMessageEvent) => {
const data = event.nativeEvent.data;
console.log(data);
if (data?.startsWith("Error")) {
console.log("WebView Error", data);
return;
}
const editorMessage = JSON.parse(data) as EditorMessage;
console.log(editorMessage.sessionId, editor.sessionId);
if (
editorMessage.sessionId !== editor.sessionId &&
editorMessage.type !== EditorEvents.status
) {
return;
}
console.log(editorMessage.type, "type");
switch (editorMessage.type) {
case EventTypes.logger:
logger.info("[WEBVIEW LOG]", editorMessage.value);

View File

@@ -36,7 +36,7 @@ import { useTagStore } from "../../../stores/use-tag-store";
import { ThemeStore, useThemeStore } from "../../../stores/use-theme-store";
import { eClearEditor, eOnLoadNote } from "../../../utils/events";
import { tabBarRef } from "../../../utils/global-refs";
import { timeConverter } from "../../../utils/time";
import { sleep, timeConverter } from "../../../utils/time";
import { NoteType } from "../../../utils/types";
import Commands from "./commands";
import { Content, EditorState, Note, SavePayload } from "./types";
@@ -51,6 +51,7 @@ import {
post
} from "./utils";
import { EVENTS } from "@notesnook/core/common";
import { useSettingStore } from "../../../stores/use-setting-store";
export const useEditor = (
editorId = "",
@@ -58,6 +59,7 @@ export const useEditor = (
onChange?: (html: string) => void,
theme?: ThemeStore["colors"]
) => {
const useGeckoView = useSettingStore((state) => state.settings.useGeckoView);
const [loading, setLoading] = useState(false);
const [sessionId, setSessionId] = useState<string>(makeSessionId());
const sessionIdRef = useRef(sessionId);
@@ -101,7 +103,6 @@ export const useEditor = (
const unsub = useThemeStore.subscribe((state) => {
postMessage(EditorEvents.theme, state.colors);
});
return () => {
unsub();
};
@@ -118,11 +119,12 @@ export const useEditor = (
);
const onReady = useCallback(async () => {
if (useGeckoView) await sleep(3000);
if (!(await isEditorLoaded(editorRef, sessionIdRef.current))) {
overlay(true);
setLoading(true);
}
}, [overlay]);
}, [overlay, useGeckoView]);
useEffect(() => {
state.current.saveCount = 0;

View File

@@ -75,6 +75,7 @@ export async function post<T>(
type: string,
value: T | null = null
) {
if (!sessionId) {
console.warn("post called without sessionId of type:", type);
return;

View File

@@ -824,6 +824,22 @@ export const settingsGroups: SettingSection[] = [
"Close and reopen the current opened note or restart the app for changes to take affect."
});
}
},
{
id: "experimental-features",
type: "screen",
name: "Experimental features",
description: "Use these features with caution",
sections: [
{
id: "use-gecko-view",
type: "switch",
property: "useGeckoView",
name: "Enable GeckoView",
description:
"If you edit large notes on your phone & have experienced lags & slow performance, you can use GeckoView for the editor which performs many times better than the default WebView."
}
]
}
]
},

View File

@@ -69,5 +69,5 @@ export const useEditorStore = create<EditorStore>((set, get) => ({
// }
// })();`
// );
}
},
}));

View File

@@ -63,6 +63,7 @@ export type Settings = {
sessionExpired: boolean;
version: string | null;
doubleSpacedLines?: boolean;
useGeckoView?:boolean
};
type DimensionsType = {

View File

@@ -285,12 +285,6 @@ android {
}
}
}
dependencies {

View File

@@ -69,5 +69,6 @@ allprojects {
maven { url 'https://www.jitpack.io' }
maven { url "https://maven.mozilla.org/maven2/" }
}
}

View File

@@ -19,7 +19,7 @@
"@sayem314/react-native-keep-awake": "^1.0.4",
"deprecated-react-native-prop-types": "^2.3.0",
"react": "18.0.0",
"react-native": "0.69.4",
"react-native": "0.69.7",
"react-native-background-actions": "^2.6.6",
"react-native-begin-background-task": "https://github.com/blockfirm/react-native-begin-background-task.git",
"react-native-bootsplash": "^4.1.4",
@@ -41,7 +41,7 @@
"react-native-orientation": "https://github.com/yamill/react-native-orientation.git",
"react-native-privacy-snapshot": "https://github.com/standardnotes/react-native-privacy-snapshot.git",
"react-native-push-notification": "github:ammarahm-ed/react-native-push-notification",
"react-native-reanimated": "2.9.1",
"react-native-reanimated": "2.12.0",
"react-native-safe-area-context": "^4.3.1",
"react-native-scoped-storage": "^1.9.3",
"react-native-screens": "^3.13.1",
@@ -54,7 +54,8 @@
"react-native-webview": "^11.14.1",
"rn-extensions-share": "^2.4.0",
"rn-fetch-blob": "^0.12.0",
"react-native-zip-archive": "6.0.8"
"react-native-zip-archive": "6.0.8",
"@ammarahmed/react-native-geckoview": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.12.9",

View File

@@ -1,21 +1,23 @@
{
"name": "@notesnook/mobile",
"version": "2.2.4",
"version": "2.2.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@notesnook/mobile",
"version": "2.2.4",
"version": "2.2.5",
"license": "GPL-3.0-or-later",
"workspaces": [
"native/",
"app/"
],
"dependencies": {
"@ammarahmed/react-native-geckoview": "^1.1.0",
"fflate": "^0.7.3",
"react-native-actions-shortcuts": "^1.0.1",
"react-native-fingerprint-scanner": "https://github.com/ammarahm-ed/react-native-fingerprint-scanner.git"
"react-native-fingerprint-scanner": "https://github.com/ammarahm-ed/react-native-fingerprint-scanner.git",
"react-native-reanimated": "2.12.0"
},
"devDependencies": {
"patch-package": "^6.4.7",
@@ -57,6 +59,7 @@
"version": "1.0.0",
"license": "GPL-3.0-or-later",
"dependencies": {
"@ammarahmed/react-native-geckoview": "^1.0.0",
"@callstack/repack": "^3.0.0",
"@react-native-clipboard/clipboard": "^1.9.0",
"@react-native-community/checkbox": "^0.5.8",
@@ -71,7 +74,7 @@
"@sayem314/react-native-keep-awake": "^1.0.4",
"deprecated-react-native-prop-types": "^2.3.0",
"react": "18.0.0",
"react-native": "0.69.4",
"react-native": "0.69.7",
"react-native-background-actions": "^2.6.6",
"react-native-begin-background-task": "https://github.com/blockfirm/react-native-begin-background-task.git",
"react-native-bootsplash": "^4.1.4",
@@ -93,7 +96,7 @@
"react-native-orientation": "https://github.com/yamill/react-native-orientation.git",
"react-native-privacy-snapshot": "https://github.com/standardnotes/react-native-privacy-snapshot.git",
"react-native-push-notification": "github:ammarahm-ed/react-native-push-notification",
"react-native-reanimated": "2.9.1",
"react-native-reanimated": "2.12.0",
"react-native-safe-area-context": "^4.3.1",
"react-native-scoped-storage": "^1.9.3",
"react-native-screens": "^3.13.1",
@@ -149,6 +152,15 @@
"webpack": "^5.74.0"
}
},
"node_modules/@ammarahmed/react-native-geckoview": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@ammarahmed/react-native-geckoview/-/react-native-geckoview-1.1.0.tgz",
"integrity": "sha512-WauG3obr0tjxRPxfh0CevB2KUpsNSjB2sh4P7f3GWVl3dvG4ksXNBEim2xxl1GOP4GH6K2EwP4NxcmX+cZ44Rw==",
"peerDependencies": {
"react": "*",
"react-native": "*"
}
},
"node_modules/@ampproject/remapping": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz",
@@ -734,6 +746,7 @@
"version": "7.18.9",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz",
"integrity": "sha512-k1NtHyOMvlDDFeb9G5PhUXuGj8m/wiwojgQVEhJ/fsVsMCpLyOP4h0uGEjYJKrRI+EVPlb5Jk+Gt9P97lOGwtA==",
"dev": true,
"dependencies": {
"@babel/helper-plugin-utils": "^7.18.9",
"@babel/plugin-syntax-export-namespace-from": "^7.8.3"
@@ -985,6 +998,7 @@
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz",
"integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==",
"dev": true,
"dependencies": {
"@babel/helper-plugin-utils": "^7.8.3"
},
@@ -17869,9 +17883,9 @@
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
"node_modules/react-native": {
"version": "0.69.4",
"resolved": "https://registry.npmjs.org/react-native/-/react-native-0.69.4.tgz",
"integrity": "sha512-rqNMialM/T4pHRKWqTIpOxA65B/9kUjtnepxwJqvsdCeMP9Q2YdSx4VASFR9RoEFYcPRU41yGf6EKrChNfns3g==",
"version": "0.69.7",
"resolved": "https://registry.npmjs.org/react-native/-/react-native-0.69.7.tgz",
"integrity": "sha512-T3z2utgRcE/+mMML3Wg4vvpnFoGWJcqWskq+8vdFS4ASM1zYg5Hab5vPlKZp9uncD8weYiGsYwkWXzrvZrsayQ==",
"dependencies": {
"@jest/create-cache-key-function": "^27.0.1",
"@react-native-community/cli": "^8.0.4",
@@ -17894,9 +17908,9 @@
"mkdirp": "^0.5.1",
"nullthrows": "^1.1.1",
"pretty-format": "^26.5.2",
"promise": "^8.0.3",
"promise": "^8.2.0",
"react-devtools-core": "4.24.0",
"react-native-codegen": "^0.69.1",
"react-native-codegen": "^0.69.2",
"react-native-gradle-plugin": "^0.0.7",
"react-refresh": "^0.4.0",
"react-shallow-renderer": "16.15.0",
@@ -18410,11 +18424,10 @@
}
},
"node_modules/react-native-reanimated": {
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.9.1.tgz",
"integrity": "sha512-309SIhDBwY4F1n6e5Mr5D1uPZm2ESIcmZsGXHUu8hpKX4oIOlZj2MilTk+kHhi05LjChoJkcpfkstotCJmPRPg==",
"version": "2.12.0",
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.12.0.tgz",
"integrity": "sha512-nrlPyw+Hx9u4iJhZk9PoTvDo/QmVAd+bo7OK9Tv3hveNEF9++5oig/g3Uv9V93shy9avTYGsUprUvAEt/xdzeQ==",
"dependencies": {
"@babel/plugin-proposal-export-namespace-from": "^7.17.12",
"@babel/plugin-transform-object-assign": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@types/invariant": "^2.2.35",
@@ -21457,6 +21470,11 @@
}
},
"dependencies": {
"@ammarahmed/react-native-geckoview": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@ammarahmed/react-native-geckoview/-/react-native-geckoview-1.1.0.tgz",
"integrity": "sha512-WauG3obr0tjxRPxfh0CevB2KUpsNSjB2sh4P7f3GWVl3dvG4ksXNBEim2xxl1GOP4GH6K2EwP4NxcmX+cZ44Rw=="
},
"@ampproject/remapping": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz",
@@ -21873,6 +21891,7 @@
"version": "7.18.9",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz",
"integrity": "sha512-k1NtHyOMvlDDFeb9G5PhUXuGj8m/wiwojgQVEhJ/fsVsMCpLyOP4h0uGEjYJKrRI+EVPlb5Jk+Gt9P97lOGwtA==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.18.9",
"@babel/plugin-syntax-export-namespace-from": "^7.8.3"
@@ -22034,6 +22053,7 @@
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz",
"integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.8.3"
}
@@ -24245,6 +24265,7 @@
"@notesnook/mobile-native": {
"version": "file:native",
"requires": {
"@ammarahmed/react-native-geckoview": "^1.0.0",
"@babel/core": "^7.12.9",
"@babel/eslint-parser": "^7.16.5",
"@babel/plugin-transform-named-capturing-groups-regex": "^7.16.5",
@@ -24290,7 +24311,7 @@
"metro-react-native-babel-preset": "^0.70.3",
"pixelmatch": "^5.3.0",
"react": "18.0.0",
"react-native": "0.69.4",
"react-native": "0.69.7",
"react-native-actions-shortcuts": "^1.0.1",
"react-native-background-actions": "^2.6.6",
"react-native-begin-background-task": "https://github.com/blockfirm/react-native-begin-background-task.git",
@@ -24315,7 +24336,7 @@
"react-native-orientation": "https://github.com/yamill/react-native-orientation.git",
"react-native-privacy-snapshot": "https://github.com/standardnotes/react-native-privacy-snapshot.git",
"react-native-push-notification": "github:ammarahm-ed/react-native-push-notification",
"react-native-reanimated": "2.9.1",
"react-native-reanimated": "2.12.0",
"react-native-safe-area-context": "^4.3.1",
"react-native-scoped-storage": "^1.9.3",
"react-native-screens": "^3.13.1",
@@ -34696,9 +34717,9 @@
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
"react-native": {
"version": "0.69.4",
"resolved": "https://registry.npmjs.org/react-native/-/react-native-0.69.4.tgz",
"integrity": "sha512-rqNMialM/T4pHRKWqTIpOxA65B/9kUjtnepxwJqvsdCeMP9Q2YdSx4VASFR9RoEFYcPRU41yGf6EKrChNfns3g==",
"version": "0.69.7",
"resolved": "https://registry.npmjs.org/react-native/-/react-native-0.69.7.tgz",
"integrity": "sha512-T3z2utgRcE/+mMML3Wg4vvpnFoGWJcqWskq+8vdFS4ASM1zYg5Hab5vPlKZp9uncD8weYiGsYwkWXzrvZrsayQ==",
"requires": {
"@jest/create-cache-key-function": "^27.0.1",
"@react-native-community/cli": "^8.0.4",
@@ -34721,9 +34742,9 @@
"mkdirp": "^0.5.1",
"nullthrows": "^1.1.1",
"pretty-format": "^26.5.2",
"promise": "^8.0.3",
"promise": "^8.2.0",
"react-devtools-core": "4.24.0",
"react-native-codegen": "^0.69.1",
"react-native-codegen": "^0.69.2",
"react-native-gradle-plugin": "^0.0.7",
"react-refresh": "^0.4.0",
"react-shallow-renderer": "16.15.0",
@@ -35081,11 +35102,10 @@
}
},
"react-native-reanimated": {
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.9.1.tgz",
"integrity": "sha512-309SIhDBwY4F1n6e5Mr5D1uPZm2ESIcmZsGXHUu8hpKX4oIOlZj2MilTk+kHhi05LjChoJkcpfkstotCJmPRPg==",
"version": "2.12.0",
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.12.0.tgz",
"integrity": "sha512-nrlPyw+Hx9u4iJhZk9PoTvDo/QmVAd+bo7OK9Tv3hveNEF9++5oig/g3Uv9V93shy9avTYGsUprUvAEt/xdzeQ==",
"requires": {
"@babel/plugin-proposal-export-namespace-from": "^7.17.12",
"@babel/plugin-transform-object-assign": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@types/invariant": "^2.2.35",

View File

@@ -27,10 +27,12 @@
"typescript": "^4.8.2"
},
"dependencies": {
"@ammarahmed/react-native-geckoview": "^1.1.0",
"@notesnook/core": "*",
"@notesnook/editor": "*",
"@notesnook/editor-mobile": "*",
"fflate": "^0.7.3",
"react-native-reanimated": "2.12.0",
"react-native-actions-shortcuts": "^1.0.1",
"react-native-fingerprint-scanner": "https://github.com/ammarahm-ed/react-native-fingerprint-scanner.git"
}

36
lerna-debug.log Normal file
View File

@@ -0,0 +1,36 @@
0 silly argv {
0 silly argv _: [ 'bootstrap' ],
0 silly argv '--': [ '--legacy-peer-deps', '--no-audit' ],
0 silly argv lernaVersion: '5.4.3',
0 silly argv '$0': '/Users/ammarahmed/Repos/notesnook/node_modules/.bin/lerna'
0 silly argv }
1 notice cli v5.4.3
2 verbose rootPath /Users/ammarahmed/Repos/notesnook
3 info versioning independent
4 silly npmConfig {
4 silly npmConfig registry: undefined,
4 silly npmConfig npmClient: 'npm',
4 silly npmConfig npmClientArgs: [ '--legacy-peer-deps', '--no-audit' ],
4 silly npmConfig mutex: undefined
4 silly npmConfig }
5 info Bootstrapping 10 packages
6 verbose lifecycle preinstall
7 silly lifecycle No script for "preinstall" in "@notesnook/crypto", continuing
8 silly lifecycle No script for "preinstall" in "@notesnook/logger", continuing
9 silly lifecycle No script for "preinstall" in "@notesnook/theme", continuing
10 silly lifecycle No script for "preinstall" in "@notesnook/core", continuing
11 silly lifecycle No script for "preinstall" in "@notesnook/crypto-worker", continuing
12 silly lifecycle No script for "preinstall" in "@notesnook/editor", continuing
13 silly lifecycle No script for "preinstall" in "@notesnook/streamable-fs", continuing
14 silly lifecycle No script for "preinstall" in "@notesnook/web", continuing
15 silly lifecycle No script for "preinstall" in "@notesnook/editor-mobile", continuing
16 silly lifecycle No script for "preinstall" in "@notesnook/mobile", continuing
17 silly hasDependencyInstalled @notesnook/editor-mobile @types/node
18 silly hasDependencyInstalled @notesnook/mobile patch-package
19 error JSONParseError: Unexpected token "}" (0x7D) in JSON at position 2780 while parsing near "...oview\": \"^1.0.0\",\n },\n \"devDependencie..."
19 error at /Users/ammarahmed/Repos/notesnook/node_modules/read-package-json-fast/index.js:11:61
19 error at async mapWorkspaces (/Users/ammarahmed/Repos/notesnook/node_modules/@npmcli/map-workspaces/lib/index.js:109:15)
19 error at async [loadWorkspaces] (/Users/ammarahmed/Repos/notesnook/node_modules/@npmcli/arborist/lib/arborist/load-workspaces.js:22:24)
19 error at async [loadActualActually] (/Users/ammarahmed/Repos/notesnook/node_modules/@npmcli/arborist/lib/arborist/load-actual.js:183:5)
19 error at async pMapSeries (/Users/ammarahmed/Repos/notesnook/node_modules/p-map-series/index.js:9:15)
19 error at async Promise.all (index 0)

View File

@@ -13202,8 +13202,7 @@
},
"jest-pnp-resolver": {
"version": "1.2.2",
"dev": true,
"requires": {}
"dev": true
},
"jest-regex-util": {
"version": "28.0.2",
@@ -13745,8 +13744,7 @@
"dependencies": {
"ws": {
"version": "8.9.0",
"dev": true,
"requires": {}
"dev": true
}
}
},
@@ -14657,8 +14655,7 @@
}
},
"ws": {
"version": "7.5.9",
"requires": {}
"version": "7.5.9"
},
"xml-name-validator": {
"version": "4.0.0",

View File

@@ -9,39 +9,17 @@
"version": "1.0.0",
"license": "GPL-3.0-or-later",
"dependencies": {
"@notesnook/crypto": "*",
"comlink": "^4.3.1"
},
"devDependencies": {
"typescript": "^4.8.2"
}
},
"node_modules/@notesnook/crypto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@notesnook/crypto/-/crypto-1.0.1.tgz",
"integrity": "sha512-DYwrkpX1Zo3imJD7rUCmhB7cnNYLs1mW1H8p2OPpjrXDYcBw7yGVRGiM3IwXmK0+PRpbQ2vf/PIbYYy/3f8aBQ==",
"dependencies": {
"libsodium-wrappers": "0.7.9"
}
},
"node_modules/comlink": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/comlink/-/comlink-4.3.1.tgz",
"integrity": "sha512-+YbhUdNrpBZggBAHWcgQMLPLH1KDF3wJpeqrCKieWQ8RL7atmgsgTQko1XEBK6PsecfopWNntopJ+ByYG1lRaA=="
},
"node_modules/libsodium": {
"version": "0.7.10",
"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz",
"integrity": "sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ=="
},
"node_modules/libsodium-wrappers": {
"version": "0.7.9",
"resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",
"integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==",
"dependencies": {
"libsodium": "^0.7.0"
}
},
"node_modules/typescript": {
"version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
@@ -57,32 +35,11 @@
}
},
"dependencies": {
"@notesnook/crypto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@notesnook/crypto/-/crypto-1.0.1.tgz",
"integrity": "sha512-DYwrkpX1Zo3imJD7rUCmhB7cnNYLs1mW1H8p2OPpjrXDYcBw7yGVRGiM3IwXmK0+PRpbQ2vf/PIbYYy/3f8aBQ==",
"requires": {
"libsodium-wrappers": "0.7.9"
}
},
"comlink": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/comlink/-/comlink-4.3.1.tgz",
"integrity": "sha512-+YbhUdNrpBZggBAHWcgQMLPLH1KDF3wJpeqrCKieWQ8RL7atmgsgTQko1XEBK6PsecfopWNntopJ+ByYG1lRaA=="
},
"libsodium": {
"version": "0.7.10",
"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz",
"integrity": "sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ=="
},
"libsodium-wrappers": {
"version": "0.7.9",
"resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",
"integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==",
"requires": {
"libsodium": "^0.7.0"
}
},
"typescript": {
"version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",

View File

@@ -13,6 +13,7 @@
body {
height: 100%;
font-family: "Open Sans";
background-color: var(--nn_bg);
}
p {

View File

@@ -16,6 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { ToolbarGroupDefinition } from "@notesnook/editor";
import { Editor } from "@notesnook/editor";
@@ -149,7 +150,10 @@ export function isReactNative(): boolean {
return !!window.ReactNativeWebView;
}
export function logger(type: "info" | "warn" | "error", ...logs: unknown[]):void {
export function logger(
type: "info" | "warn" | "error",
...logs: unknown[]
): void {
const logString = logs
.map((log) => {
return typeof log !== "string" ? JSON.stringify(log) : log;
@@ -162,7 +166,7 @@ export function logger(type: "info" | "warn" | "error", ...logs: unknown[]):void
export function post<T extends keyof typeof EventTypes>(
type: typeof EventTypes[T],
value?: unknown
):void {
): void {
if (isReactNative()) {
window.ReactNativeWebView.postMessage(
JSON.stringify({
@@ -172,6 +176,8 @@ export function post<T extends keyof typeof EventTypes>(
})
);
} else {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
console.log(type, value);
}
}

View File

@@ -9,7 +9,6 @@
"version": "1.0.0",
"license": "GPL-3.0-or-later",
"dependencies": {
"@notesnook/crypto": "*",
"localforage": "^1.10.0"
},
"devDependencies": {
@@ -17,14 +16,6 @@
"typescript": "^4.8.2"
}
},
"node_modules/@notesnook/crypto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@notesnook/crypto/-/crypto-1.0.1.tgz",
"integrity": "sha512-DYwrkpX1Zo3imJD7rUCmhB7cnNYLs1mW1H8p2OPpjrXDYcBw7yGVRGiM3IwXmK0+PRpbQ2vf/PIbYYy/3f8aBQ==",
"dependencies": {
"libsodium-wrappers": "0.7.9"
}
},
"node_modules/@types/localforage": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/localforage/-/localforage-0.0.34.tgz",
@@ -40,19 +31,6 @@
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
},
"node_modules/libsodium": {
"version": "0.7.10",
"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz",
"integrity": "sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ=="
},
"node_modules/libsodium-wrappers": {
"version": "0.7.9",
"resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",
"integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==",
"dependencies": {
"libsodium": "^0.7.0"
}
},
"node_modules/lie": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
@@ -84,14 +62,6 @@
}
},
"dependencies": {
"@notesnook/crypto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@notesnook/crypto/-/crypto-1.0.1.tgz",
"integrity": "sha512-DYwrkpX1Zo3imJD7rUCmhB7cnNYLs1mW1H8p2OPpjrXDYcBw7yGVRGiM3IwXmK0+PRpbQ2vf/PIbYYy/3f8aBQ==",
"requires": {
"libsodium-wrappers": "0.7.9"
}
},
"@types/localforage": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/localforage/-/localforage-0.0.34.tgz",
@@ -106,19 +76,6 @@
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
},
"libsodium": {
"version": "0.7.10",
"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz",
"integrity": "sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ=="
},
"libsodium-wrappers": {
"version": "0.7.9",
"resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",
"integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==",
"requires": {
"libsodium": "^0.7.0"
}
},
"lie": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",

File diff suppressed because it is too large Load Diff