mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 03:37:55 +01:00
editor(mobile): fix imports and make build cross platform
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
module.exports = {
|
||||
all: {
|
||||
DISABLE_ESLINT_PLUGIN: true,
|
||||
GENERATE_SOURCEMAP: true,
|
||||
BROWSER: "none"
|
||||
}
|
||||
};
|
||||
47
packages/editor-mobile/package-lock.json
generated
47
packages/editor-mobile/package-lock.json
generated
@@ -29,17 +29,16 @@
|
||||
"@playwright/test": "^1.37.1",
|
||||
"@types/react": "^18.2.39",
|
||||
"@types/react-dom": "^18.2.17",
|
||||
"env-cmd": "^10.1.0",
|
||||
"react-scripts": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"../editor": {
|
||||
"name": "@notesnook/editor",
|
||||
"version": "2.0.7",
|
||||
"version": "2.1.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@notesnook/core": "file:../core",
|
||||
"@notesnook/common": "file:../common",
|
||||
"@notesnook/theme": "file:../theme",
|
||||
"@notesnook/ui": "file:../ui",
|
||||
"@social-embed/lib": "^0.1.0-next.7",
|
||||
@@ -129,14 +128,14 @@
|
||||
},
|
||||
"../theme": {
|
||||
"name": "@notesnook/theme",
|
||||
"version": "2.0.7",
|
||||
"version": "2.1.1",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"devDependencies": {
|
||||
"@emotion/react": "11.11.1",
|
||||
"@theme-ui/color": "^0.16.1",
|
||||
"@theme-ui/components": "^0.16.1",
|
||||
"@theme-ui/core": "^0.16.1",
|
||||
"@trpc/server": "^10.31.0",
|
||||
"@trpc/server": "^10.45.2",
|
||||
"@types/react": "^18.2.39",
|
||||
"@types/tinycolor2": "^1.4.3",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
@@ -4382,7 +4381,7 @@
|
||||
"version": "15.7.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz",
|
||||
"integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==",
|
||||
"dev": true
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/@types/q": {
|
||||
"version": "1.5.8",
|
||||
@@ -4406,7 +4405,7 @@
|
||||
"version": "18.2.39",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.39.tgz",
|
||||
"integrity": "sha512-Oiw+ppED6IremMInLV4HXGbfbG6GyziY3kqAwJYOR0PNbkYDmLWQA3a95EhdSmamsvbkJN96ZNN+YD+fGjzSBA==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"@types/prop-types": "*",
|
||||
"@types/scheduler": "*",
|
||||
@@ -4441,7 +4440,7 @@
|
||||
"version": "0.16.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz",
|
||||
"integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==",
|
||||
"dev": true
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "7.5.6",
|
||||
@@ -7421,22 +7420,6 @@
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/env-cmd": {
|
||||
"version": "10.1.0",
|
||||
"resolved": "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz",
|
||||
"integrity": "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"commander": "^4.0.0",
|
||||
"cross-spawn": "^7.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"env-cmd": "bin/env-cmd.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/error-ex": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
|
||||
@@ -9742,7 +9725,7 @@
|
||||
"version": "9.0.21",
|
||||
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz",
|
||||
"integrity": "sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/immer"
|
||||
@@ -17828,6 +17811,20 @@
|
||||
"is-typedarray": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/unbox-primitive": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
"@playwright/test": "^1.37.1",
|
||||
"@types/react": "^18.2.39",
|
||||
"@types/react-dom": "^18.2.17",
|
||||
"env-cmd": "^10.1.0",
|
||||
"react-scripts": "^5.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "env-cmd -e all react-scripts start",
|
||||
"build": "env-cmd -e all react-scripts build && rm -rf build.bundle && rm -rf sourcemaps && mv build build.bundle && cp -r ./build.bundle/static/js/ sourcemaps && rm -r ./build.bundle/static/js/*.map",
|
||||
"start": "cross-env DISABLE_ESLINT_PLUGIN=true GENERATE_SOURCEMAP=true BROWSER=none react-scripts start",
|
||||
"build": "cross-env DISABLE_ESLINT_PLUGIN=true GENERATE_SOURCEMAP=true BROWSER=none react-scripts build",
|
||||
"postbuild": "node scripts/build.mjs",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject",
|
||||
"postinstall": "patch-package"
|
||||
|
||||
39
packages/editor-mobile/scripts/build.mjs
Normal file
39
packages/editor-mobile/scripts/build.mjs
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import { rm, cp, readdir } from "fs/promises";
|
||||
import path from "path";
|
||||
|
||||
await rm("build.bundle", { recursive: true, force: true });
|
||||
await rm("sourcemaps", { recursive: true, force: true });
|
||||
|
||||
await cp("build", "build.bundle", { recursive: true });
|
||||
await rm("build", { recursive: true, force: true });
|
||||
|
||||
await cp(path.join("build.bundle", "static", "js"), "sourcemaps", {
|
||||
recursive: true
|
||||
});
|
||||
|
||||
for (const dirent of await readdir(path.join("build.bundle", "static", "js"), {
|
||||
withFileTypes: true
|
||||
})) {
|
||||
if (dirent.isFile() && dirent.name.endsWith(".map")) {
|
||||
await rm(path.join("build.bundle", "static", "js", dirent.name));
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import "./polyfill";
|
||||
import { Global, css } from "@emotion/react";
|
||||
import {
|
||||
ScopedThemeProvider,
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
TiptapOptions,
|
||||
usePermissionHandler
|
||||
} from "@notesnook/editor";
|
||||
import { toBlobURL } from "@notesnook/editor/dist/utils/downloader";
|
||||
import { toBlobURL } from "@notesnook/editor";
|
||||
import { useThemeColors } from "@notesnook/theme";
|
||||
import FingerprintIcon from "mdi-react/FingerprintIcon";
|
||||
import {
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { getFontById } from "@notesnook/editor";
|
||||
import { replaceDateTime } from "@notesnook/editor/dist/extensions/date-time";
|
||||
import { replaceDateTime } from "@notesnook/editor";
|
||||
import React, { RefObject, useCallback, useEffect, useRef } from "react";
|
||||
import { EditorController } from "../hooks/useEditorController";
|
||||
import { useTabContext } from "../hooks/useTabStore";
|
||||
|
||||
24
packages/editor-mobile/src/polyfill.ts
Normal file
24
packages/editor-mobile/src/polyfill.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import { Buffer } from "buffer/";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
globalThis.Buffer = Buffer;
|
||||
Reference in New Issue
Block a user