Skip to content

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

add fullscreen icon in header

ammarahm-ed74cef09981e7
diff --git a/packages/editor-mobile/package-lock.json b/packages/editor-mobile/package-lock.json
index 38dfeaa5e..7e0fad8d9 100644
--- a/packages/editor-mobile/package-lock.json
+++ b/packages/editor-mobile/package-lock.json
@@ -7,6 +7,7 @@
"": {
"name": "tiptap",
"version": "1.0.0",
+ "hasInstallScript": true,
"dependencies": {
"@notesnook/theme": "git+https://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:[email protected]/streetwriters/themeprovider.git",
"framer-motion": "^4.1.17",
@@ -37,6 +38,7 @@
"@_ueberdosis/prosemirror-tables": "^1.1.3",
"@mdi/js": "^6.9.96",
"@mdi/react": "^1.6.0",
+ "@notesnook/theme": "github:streetwriters/themeprovider",
"@rebass/forms": "^4.0.6",
"@social-embed/lib": "^0.0.1-next.12",
"@tiptap/core": "^2.0.0-beta.181",
@@ -97,7 +99,6 @@
"web-vitals": "^2.1.4"
},
"peerDependencies": {
- "@notesnook/theme": "github:streetwriters/themeprovider",
"framer-motion": "^4.1.17"
}
},
@@ -32824,6 +32825,7 @@
"@_ueberdosis/prosemirror-tables": "^1.1.3",
"@mdi/js": "^6.9.96",
"@mdi/react": "^1.6.0",
+ "@notesnook/theme": "github:streetwriters/themeprovider",
"@rebass/forms": "^4.0.6",
"@social-embed/lib": "^0.0.1-next.12",
"@tiptap/core": "^2.0.0-beta.181",
diff --git a/packages/editor-mobile/src/components/header.tsx b/packages/editor-mobile/src/components/header.tsx
index 94da85304..ebe268aee 100644
--- a/packages/editor-mobile/src/components/header.tsx
+++ b/packages/editor-mobile/src/components/header.tsx
@@ -4,6 +4,7 @@ import CrownIcon from "mdi-react/CrownIcon";
import DotsHorizontalIcon from "mdi-react/DotsHorizontalIcon";
import ArrowULeftTopIcon from "mdi-react/ArrowULeftTopIcon";
import ArrowURightTopIcon from "mdi-react/ArrowURightTopIcon";
+import FullscreenIcon from "mdi-react/FullscreenIcon";
import MagnifyIcon from "mdi-react/MagnifyIcon";
import React from "react";
import { useSafeArea } from "../hooks/useSafeArea";
@@ -35,42 +36,45 @@ const Button = ({
);
};
-export default React.memo(
- function Header({
- noHeader,
- settings,
- hasUndo,
- hasRedo
- }: {
- noHeader: boolean;
- settings: Settings;
- hasUndo: boolean;
- hasRedo: boolean;
- }) {
- const insets = useSafeArea();
- return (
- <div
- style={{
- display: "flex",
- alignItems: "center",
- height: noHeader ? `${insets.top}px` : `${50 + insets.top}px`,
- backgroundColor: "var(--nn_bg)",
- position: "sticky",
- width: "100vw"
- }}
- >
- {noHeader ? null : (
- <div
- style={{
- display: "flex",
- width: "100%",
- justifyContent: "space-between",
- flexDirection: "row",
- paddingTop: insets.top,
- height: 50,
- alignItems: "center"
- }}
- >
+export default function Header({
+ noHeader,
+ settings,
+ hasUndo,
+ hasRedo
+}: {
+ noHeader: boolean;
+ settings: Settings;
+ hasUndo: boolean;
+ hasRedo: boolean;
+}) {
+ const insets = useSafeArea();
+ logger("info", settings.deviceMode, settings.fullscreen);
+ return (
+ <div
+ style={{
+ display: "flex",
+ alignItems: "center",
+ height: noHeader ? `${insets.top}px` : `${50 + insets.top}px`,
+ backgroundColor: "var(--nn_bg)",
+ position: "sticky",
+ width: "100vw"
+ }}
+ >
+ {noHeader ? null : (
+ <div
+ style={{
+ display: "flex",
+ width: "100%",
+ justifyContent: "space-between",
+ flexDirection: "row",
+ paddingTop: insets.top,
+ height: 50,
+ alignItems: "center"
+ }}
+ >
+ {settings.deviceMode !== "mobile" && !settings.fullscreen ? (
+ <div />
+ ) : (
<Button
onPress={() => {
post(EventTypes.back);
@@ -98,44 +102,72 @@ export default React.memo(
color="var(--nn_pri)"
/>
</Button>
+ )}
- <div
+ <div
+ style={{
+ display: "flex",
+ alignItems: "center",
+ flexDirection: "row"
+ }}
+ >
+ <Button
+ onPress={() => {
+ editor?.commands.undo();
+ }}
style={{
+ borderWidth: 0,
+ borderRadius: 100,
+ color: "var(--nn_icon)",
+ marginRight: 10,
+ width: 39,
+ height: 39,
display: "flex",
+ justifyContent: "center",
alignItems: "center",
- flexDirection: "row"
+ position: "relative"
}}
>
- <Button
- onPress={() => {
- editor?.commands.undo();
- }}
+ <ArrowULeftTopIcon
+ color={!hasUndo ? "var(--nn_nav)" : "var(--nn_pri)"}
+ size={25}
style={{
- borderWidth: 0,
- borderRadius: 100,
- color: "var(--nn_icon)",
- marginRight: 10,
- width: 39,
- height: 39,
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- position: "relative"
+ position: "absolute"
}}
- >
- <ArrowULeftTopIcon
- color={!hasUndo ? "var(--nn_nav)" : "var(--nn_pri)"}
- size={25}
- style={{
- position: "absolute"
- }}
- />
- </Button>
+ />
+ </Button>
+ <Button
+ onPress={() => {
+ editor?.commands.redo();
+ }}
+ style={{
+ borderWidth: 0,
+ borderRadius: 100,
+ color: "var(--nn_icon)",
+ marginRight: 10,
+ width: 39,
+ height: 39,
+ display: "flex",
+ justifyContent: "center",
+ alignItems: "center",
+ position: "relative"
+ }}
+ >
+ <ArrowURightTopIcon
+ color={!hasRedo ? "var(--nn_nav)" : "var(--nn_pri)"}
+ size={25}
+ style={{
+ position: "absolute"
+ }}
+ />
+ </Button>
+ {!settings.premium && (
<Button
onPress={() => {
- editor?.commands.redo();
+ post(EventTypes.pro);
}}
+ preventDefault={false}
style={{
borderWidth: 0,
borderRadius: 100,
@@ -149,70 +181,72 @@ export default React.memo(
position: "relative"
}}
>
- <ArrowURightTopIcon
- color={!hasRedo ? "var(--nn_nav)" : "var(--nn_pri)"}
+ <CrownIcon
size={25}
style={{
position: "absolute"
}}
+ color="orange"
/>
</Button>
- {!settings.premium && (
- <Button
- onPress={() => {
- post(EventTypes.pro);
- }}
- preventDefault={false}
- style={{
- borderWidth: 0,
- borderRadius: 100,
- color: "var(--nn_icon)",
- marginRight: 10,
- width: 39,
- height: 39,
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- position: "relative"
- }}
- >
- <CrownIcon
- size={25}
- style={{
- position: "absolute"
- }}
- color="orange"
- />
- </Button>
- )}
- <Button
- onPress={() => {
- editor?.commands.startSearch();
+ )}
+
+ <Button
+ onPress={() => {
+ editor?.commands.startSearch();
+ }}
+ style={{
+ borderWidth: 0,
+ borderRadius: 100,
+ color: "var(--nn_icon)",
+ marginRight: 10,
+ width: 39,
+ height: 39,
+ display: "flex",
+ justifyContent: "center",
+ alignItems: "center",
+ position: "relative"
+ }}
+ >
+ <MagnifyIcon
+ size={25}
+ style={{
+ position: "absolute"
}}
+ color="var(--nn_pri)"
+ />
+ </Button>
+ <Button
+ onPress={() => {
+ post(EventTypes.monograph);
+ }}
+ preventDefault={false}
+ style={{
+ borderWidth: 0,
+ borderRadius: 100,
+ color: "var(--nn_icon)",
+ marginRight: 10,
+ width: 39,
+ height: 39,
+ display: "flex",
+ justifyContent: "center",
+ alignItems: "center",
+ position: "relative"
+ }}
+ >
+ <CloudUploadOutlineIcon
+ size={25}
style={{
- borderWidth: 0,
- borderRadius: 100,
- color: "var(--nn_icon)",
- marginRight: 10,
- width: 39,
- height: 39,
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- position: "relative"
+ position: "absolute"
}}
- >
- <MagnifyIcon
- size={25}
- style={{
- position: "absolute"
- }}
- color="var(--nn_pri)"
- />
- </Button>
+ color="var(--nn_pri)"
+ />
+ </Button>
+
+ {settings.deviceMode !== "mobile" && !settings.fullscreen ? (
<Button
onPress={() => {
- post(EventTypes.monograph);
+ post(EventTypes.fullscreen);
}}
preventDefault={false}
style={{
@@ -228,7 +262,7 @@ export default React.memo(
position: "relative"
}}
>
- <CloudUploadOutlineIcon
+ <FullscreenIcon
size={25}
style={{
position: "absolute"
@@ -236,48 +270,37 @@ export default React.memo(
color="var(--nn_pri)"
/>
</Button>
+ ) : null}
- <Button
- onPress={() => {
- post(EventTypes.properties);
- }}
- preventDefault={false}
+ <Button
+ onPress={() => {
+ post(EventTypes.properties);
+ }}
+ preventDefault={false}
+ style={{
+ borderWidth: 0,
+ borderRadius: 100,
+ color: "var(--nn_icon)",
+ marginRight: 12,
+ width: 39,
+ height: 39,
+ display: "flex",
+ justifyContent: "center",
+ alignItems: "center",
+ position: "relative"
+ }}
+ >
+ <DotsHorizontalIcon
+ size={25}
style={{
- borderWidth: 0,
- borderRadius: 100,
- color: "var(--nn_icon)",
- marginRight: 12,
- width: 39,
- height: 39,
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- position: "relative"
+ position: "absolute"
}}
- >
- <DotsHorizontalIcon
- size={25}
- style={{
- position: "absolute"
- }}
- color="var(--nn_pri)"
- />
- </Button>
- </div>
+ color="var(--nn_pri)"
+ />
+ </Button>
</div>
- )}
- </div>
- );
- },
- (prev, next) => {
- if (
- prev.noHeader !== next.noHeader ||
- prev.settings.premium !== next.settings.premium ||
- prev.hasRedo !== next.hasRedo ||
- prev.hasUndo !== next.hasUndo
- )
- return false;
-
- return true;
- }
-);
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/packages/editor-mobile/src/hooks/useSettings.ts b/packages/editor-mobile/src/hooks/useSettings.ts
index bd34a6727..9f223e28c 100644
--- a/packages/editor-mobile/src/hooks/useSettings.ts
+++ b/packages/editor-mobile/src/hooks/useSettings.ts
@@ -9,12 +9,12 @@ const initialState = {
tools: getDefaultPresets().default,
noToolbar: global.noToolbar,
noHeader: global.noHeader,
- readonly: global.readonly,
+ readonly: global.readonly
};
global.settingsController = {
update: (settings) => {
- const nextSettings = { ...settingsController.previous, ...settings };
+ const nextSettings = settings;
if (global.settingsController.set)
global.settingsController.set(nextSettings);
if (settings) {
@@ -24,12 +24,12 @@ global.settingsController = {
}
settingsController.previous = { ...nextSettings };
},
- previous: settingsJson ? JSON.parse(settingsJson) : { ...initialState },
+ previous: settingsJson ? JSON.parse(settingsJson) : { ...initialState }
};
export const useSettings = () => {
const [settings, setSettings] = useState({
- ...global.settingsController.previous,
+ ...global.settingsController.previous
});
global.settingsController.set = setSettings;
diff --git a/packages/editor-mobile/src/utils/index.ts b/packages/editor-mobile/src/utils/index.ts
index 14df62e05..dd1d2b7aa 100644
--- a/packages/editor-mobile/src/utils/index.ts
+++ b/packages/editor-mobile/src/utils/index.ts
@@ -120,6 +120,7 @@ export const EventTypes = {
pro: "editor-event:pro",
monograph: "editor-event:monograph",
properties: "editor-event:properties",
+ fullscreen: "editor-event:fullscreen"
};
export function isReactNative(): boolean {
@@ -143,7 +144,7 @@ export function post(type: string, value?: unknown) {
//@ts-ignore
type: EventTypes[type] || type,
value: value,
- sessionId: global.sessionId,
+ sessionId: global.sessionId
})
);
} else {