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
mobile: add back undo/redo buttons
Ammar Ahmed00568ae839e5
diff --git a/apps/mobile/app/components/list/card.tsx b/apps/mobile/app/components/list/card.tsxindex f951324a9..667b92ade 100644--- a/apps/mobile/app/components/list/card.tsx+++ b/apps/mobile/app/components/list/card.tsx@@ -49,7 +49,8 @@ export const Card = ({ color }: { color?: string }) => {flexDirection: "row",alignItems: "center",justifyContent: "space-between",- paddingHorizontal: 0+ paddingHorizontal: 0,+ width: "100%"}}><View@@ -91,7 +92,6 @@ export const Card = ({ color }: { color?: string }) => {<Viewstyle={{marginLeft: 10,- flexShrink: 1,marginRight: 10}}>diff --git a/apps/mobile/app/components/ui/button/index.tsx b/apps/mobile/app/components/ui/button/index.tsxindex 76f35743e..c69e4a378 100644--- a/apps/mobile/app/components/ui/button/index.tsx+++ b/apps/mobile/app/components/ui/button/index.tsx@@ -25,7 +25,8 @@ import {DimensionValue,TextStyle,View,- ViewStyle+ ViewStyle,+ useWindowDimensions} from "react-native";import Icon from "react-native-vector-icons/MaterialCommunityIcons";import { useUserStore } from "../../../stores/use-user-store";@@ -92,6 +93,9 @@ export const Button = ({});const textColor = buttonType?.text ? buttonType.text : text;+ const { fontScale } = useWindowDimensions();+ const growFactor = 1 + (fontScale - 1) / 10;+const Component = bold ? Heading : Paragraph;return (@@ -117,8 +121,11 @@ export const Button = ({customOpacity={buttonType?.opacity}customAlpha={buttonType?.alpha}style={{- height: height,- width: (width as DimensionValue) || undefined,+ height: typeof height === "number" ? height * growFactor : height,+ width:+ typeof width === "number"+ ? width * growFactor+ : (width as DimensionValue) || undefined,paddingHorizontal: 12,borderRadius: 5,alignSelf: "center",diff --git a/apps/mobile/app/components/ui/pressable/index.tsx b/apps/mobile/app/components/ui/pressable/index.tsxindex ecfe77dea..ee967442f 100644--- a/apps/mobile/app/components/ui/pressable/index.tsx+++ b/apps/mobile/app/components/ui/pressable/index.tsx@@ -21,11 +21,12 @@ import { VariantsWithStaticColors, useThemeColors } from "@notesnook/theme";import React, { RefObject, useCallback } from "react";import {ColorValue,+ PressableStateCallbackType,Pressable as RNPressable,PressableProps as RNPressableProps,- PressableStateCallbackType,View,- ViewStyle+ ViewStyle,+ useWindowDimensions} from "react-native";import {RGB_Linear_Shade,@@ -256,6 +257,8 @@ export const Pressable = ({? 1: colorOpacity;const alpha = customAlpha ? customAlpha : isDark ? 0.03 : -0.03;+ const { fontScale } = useWindowDimensions();+ const growFactor = 1 + (fontScale - 1) / 8;const getStyle = useCallback(({ pressed }: PressableStateCallbackType): ViewStyle | ViewStyle[] => [@@ -276,7 +279,13 @@ export const Pressable = ({: borderColor || "transparent",borderWidth: borderWidth},- style+ style,+ {+ height:+ typeof style.height === "number"+ ? style.height * growFactor+ : style.height+ }],[alpha,@@ -288,7 +297,8 @@ export const Pressable = ({borderSelectedColor,borderColor,borderWidth,- style+ style,+ growFactor]);diff --git a/packages/editor-mobile/src/components/header.tsx b/packages/editor-mobile/src/components/header.tsxindex 87cdaffa7..52c3c7262 100644--- a/packages/editor-mobile/src/components/header.tsx+++ b/packages/editor-mobile/src/components/header.tsx@@ -165,33 +165,69 @@ function Header({flexDirection: "row"}}>- {!settings.premium && (- <Button- onPress={() => {- post(EventTypes.pro);- }}- preventDefault={false}- style={{- borderWidth: 0,- borderRadius: 100,- color: "var(--nn_primary_icon)",- marginRight: 10,- width: 39,- height: 39,- display: "flex",- justifyContent: "center",- alignItems: "center",- position: "relative"- }}- >- <CrownIcon- size={25 * settings.fontScale}+ {tab.locked ? null : (+ <>+ <Button+ onPress={() => {+ editor?.commands.undo();+ }}style={{- position: "absolute"+ borderWidth: 0,+ borderRadius: 100,+ color: "var(--nn_primary_icon)",+ marginRight: 10,+ width: 39,+ height: 39,+ display: "flex",+ justifyContent: "center",+ alignItems: "center",+ position: "relative"}}- color="orange"- />- </Button>+ >+ <ArrowULeftTopIcon+ color={+ !hasUndo+ ? "var(--nn_secondary_border)"+ : "var(--nn_primary_icon)"+ }+ size={25 * settings.fontScale}+ style={{+ position: "absolute"+ }}+ />+ </Button>++ <Button+ onPress={() => {+ if (tab.locked) return;+ editor?.commands.redo();+ }}+ style={{+ borderWidth: 0,+ borderRadius: 100,+ color: "var(--nn_primary_icon)",+ marginRight: 10,+ width: 39,+ height: 39,+ display: "flex",+ justifyContent: "center",+ alignItems: "center",+ position: "relative"+ }}+ >+ <ArrowURightTopIcon+ color={+ !hasRedo+ ? "var(--nn_secondary_border)"+ : "var(--nn_primary_icon)"+ }+ size={25 * settings.fontScale}+ style={{+ position: "absolute"+ }}+ />+ </Button>+ </>)}{settings.deviceMode !== "mobile" && !settings.fullscreen ? (@@ -304,7 +340,11 @@ function Header({<ButtonfwdRef={btnRef}onPress={() => {- setOpen(!isOpen);+ if (tab.locked) {+ post(EventTypes.properties, undefined, tab.id, tab.noteId);+ } else {+ setOpen(!isOpen);+ }}}preventDefault={false}style={{@@ -320,13 +360,23 @@ function Header({position: "relative"}}>- <DotsVerticalIcon- size={25 * settings.fontScale}- style={{- position: "absolute"- }}- color="var(--nn_primary_icon)"- />+ {tab.locked ? (+ <DotsHorizontalIcon+ size={25 * settings.fontScale}+ style={{+ position: "absolute"+ }}+ color="var(--nn_primary_icon)"+ />+ ) : (+ <DotsVerticalIcon+ size={25 * settings.fontScale}+ style={{+ position: "absolute"+ }}+ color="var(--nn_primary_icon)"+ />+ )}</Button><ControlledMenu@@ -351,6 +401,9 @@ function Header({tab.noteId);break;+ case "search":+ editor?.commands.startSearch();+ break;case "properties":logger("info", "post properties...");post(EventTypes.properties, undefined, tab.id, tab.noteId);@@ -360,127 +413,66 @@ function Header({}}}>- <div+ <MenuItem+ value="search"style={{display: "flex",- flexDirection: "row",- alignItems: "center",- justifyContent: "center",- width: "100%"+ gap: 10,+ alignItems: "center"}}>- <Button- onPress={() => {- editor?.commands.undo();- }}- style={{- borderWidth: 0,- borderRadius: 100,- color: "var(--nn_primary_icon)",- marginRight: 10,- width: 39,- height: 39,- display: "flex",- justifyContent: "center",- alignItems: "center",- position: "relative"- }}- >- <ArrowULeftTopIcon- color={- !hasUndo- ? "var(--nn_secondary_border)"- : "var(--nn_primary_icon)"- }- size={25 * settings.fontScale}- style={{- position: "absolute"- }}- />- </Button>-- <Button- onPress={() => {- editor?.commands.redo();- }}- style={{- borderWidth: 0,- borderRadius: 100,- color: "var(--nn_primary_icon)",- marginRight: 10,- width: 39,- height: 39,- display: "flex",- justifyContent: "center",- alignItems: "center",- position: "relative"- }}- >- <ArrowURightTopIcon- color={- !hasRedo- ? "var(--nn_secondary_border)"- : "var(--nn_primary_icon)"- }- size={25 * settings.fontScale}- style={{- position: "absolute"- }}- />- </Button>-- <Button- onPress={() => {- editor?.commands.startSearch();- }}+ <MagnifyIcon+ size={22 * settings.fontScale}+ color="var(--nn_primary_icon)"+ />+ <spanstyle={{- borderWidth: 0,- borderRadius: 100,- color: "var(--nn_primary_icon)",- marginRight: 10,- width: 39,- height: 39,- display: "flex",- justifyContent: "center",- alignItems: "center",- position: "relative"+ color: "var(--nn_primary_paragraph)"}}>- <MagnifyIcon- size={28 * settings.fontScale}- style={{- position: "absolute"- }}- color="var(--nn_primary_icon)"- />- </Button>- </div>+ Search+ </span>+ </MenuItem><MenuItemvalue="toc"style={{display: "flex",- gap: 10+ gap: 10,+ alignItems: "center"}}><TableOfContentsIconsize={22 * settings.fontScale}color="var(--nn_primary_icon)"/>- Table of contents+ <span+ style={{+ color: "var(--nn_primary_paragraph)"+ }}+ >+ Table of contents+ </span></MenuItem><MenuItemvalue="properties"style={{display: "flex",- gap: 10+ gap: 10,+ alignItems: "center"}}><DotsHorizontalIconsize={22 * settings.fontScale}color="var(--nn_primary_icon)"/>- Note Properties+ <span+ style={{+ color: "var(--nn_primary_paragraph)"+ }}+ >+ Properties+ </span></MenuItem></ControlledMenu></div>