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
minor improvements
ammarahm-ed12192ebf5270
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.jsindex 78d64e026..7a4fbd84f 100644--- a/apps/mobile/src/components/ActionSheetComponent/index.js+++ b/apps/mobile/src/components/ActionSheetComponent/index.js@@ -30,7 +30,6 @@ let tagsInputRef;export const ActionSheetComponent = ({close = () => {},item,- setWillRefresh = value => {},hasColors = false,hasTags = false,rowItems = [],@@ -144,7 +143,7 @@ export const ActionSheetComponent = ({}};- const localRefresh = type => {+ const localRefresh = (type, nodispatch = false) => {if (!note || !note.dateCreated) return;let toAdd;switch (type) {@@ -161,8 +160,9 @@ export const ActionSheetComponent = ({break;}}-- dispatch({type: type});+ if (!nodispatch) {+ dispatch({type: type});+ }setNote({...toAdd});};@@ -476,6 +476,9 @@ export const ActionSheetComponent = ({return (<View+ onLayout={() => {+ localRefresh(item.type, true);+ }}style={{paddingBottom: 15,backgroundColor: colors.bg,diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.jsindex f576cc7b0..1bfa83588 100644--- a/apps/mobile/src/components/NoteItem/index.js+++ b/apps/mobile/src/components/NoteItem/index.js@@ -16,11 +16,6 @@ export default class NoteItem extends React.Component {this.cipher = {value: false,};- this.state = {- unlockNote: false,- vaultDialog: false,- isPerm: false,- };this.actionSheet;this.show = null;this.setMenuRef = {};@@ -50,7 +45,6 @@ export default class NoteItem extends React.Component {}render() {- let {unlock, vaultDialog, isPerm, visible} = this.state;let {colors,item,@@ -144,6 +138,7 @@ export default class NoteItem extends React.Component {width: '100%',}}><Text+ numberOfLines={4}style={{fontSize: SIZE.xs + 1,color: colors.pri,diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex 9bbeb907d..4336da3b9 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -6,16 +6,14 @@ import {Linking,Platform,StatusBar,- TextInput,TouchableOpacity,View,} from 'react-native';import * as Animatable from 'react-native-animatable';import Icon from 'react-native-vector-icons/Feather';import WebView from 'react-native-webview';-import {useIsFocused} from 'react-navigation-hooks';import {db, DDS} from '../../../App';-import {SIZE, WEIGHT} from '../../common/common';+import {SIZE} from '../../common/common';import {ActionSheetEvent,simpleDialogEvent,@@ -43,7 +41,6 @@ const Editor = ({navigation}) => {const updateDB = () => {};// Local State- const [isOpen, setOpen] = useState(false);const [sidebar, setSidebar] = useState(DDS.isTab ? true : false);const [noteProps, setNoteProps] = useState({@@ -65,11 +62,31 @@ const Editor = ({navigation}) => {content = rawData;} else {title = rawData.value;- console.log(title);}}};+ const _onMessage = evt => {+ if (evt.nativeEvent.data !== '') {+ clearTimeout(timer);+ timer = null;+ onChange(evt.nativeEvent.data);+ timer = setTimeout(() => {+ saveNote(noteProps, true);+ console.log('saved');+ }, 1000);+ }+ };++ const _onShouldStartLoadWithRequest = request => {+ if (request.url.includes('https')) {+ Linking.openURL(request.url);+ return false;+ } else {+ return true;+ }+ };+const saveNote = async (noteProps = {}, lockNote = true) => {if (!content) {content = {@@ -79,7 +96,6 @@ const Editor = ({navigation}) => {}timestamp = await db.addNote({- ...noteProps,title,content: {text: content.text,@@ -119,22 +135,10 @@ const Editor = ({navigation}) => {}),);title = note.title;- //titleRef.setNativeProps({- // text: title,- // });timestamp = note.dateCreated;content = note.content;};- const onTitleTextChange = value => {- title = value;- clearTimeout(timer);- timer = null;- timer = setTimeout(() => {- saveNote(noteProps, true);- }, 1000);- };-const params = 'platform=' + Platform.OS;const sourceUri =(Platform.OS === 'android' ? 'file:///android_asset/' : '') +@@ -154,122 +158,100 @@ const Editor = ({navigation}) => {}}><Viewstyle={{- height: '100%',+ marginTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight,+ }}+ />+ <TouchableOpacity+ onPress={() => {+ simpleDialogEvent(TEMPLATE_EXIT('Editor'));+ }}+ style={{+ width: '12.5%',+ height: 50,+ justifyContent: 'center',+ alignItems: 'flex-start',+ position: 'absolute',+ left: 0,+ top: 0,+ marginTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight,+ paddingLeft: 12,+ zIndex: 999,}}>- <View+ <Iconstyle={{- marginTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight,+ marginLeft: -7,}}+ name="chevron-left"+ color={colors.icon}+ size={SIZE.xxxl - 3}/>- <TouchableOpacity- onPress={() => {- simpleDialogEvent(TEMPLATE_EXIT('Editor'));- }}- style={{- width: '12.5%',- height: 50,- justifyContent: 'center',- alignItems: 'flex-start',- position: 'absolute',- left: 0,- top: 0,- marginTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight,- paddingLeft: 12,- zIndex: 999,- }}>- <Icon+ </TouchableOpacity>++ <TouchableOpacity+ onPress={() => {+ DDS.isTab+ ? setSidebar(!sidebar)+ : ActionSheetEvent(+ note,+ true,+ true,+ ['Add to', 'Share', 'Export', 'Delete'],+ ['Dark Mode', 'Add to Vault', 'Pin', 'Favorite'],+ );+ }}+ style={{+ width: '12.5%',+ height: 50,+ justifyContent: 'center',+ alignItems: 'flex-end',+ position: 'absolute',+ right: 0,+ top: 0,+ marginTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight,+ paddingRight: 12,+ zIndex: 999,+ }}>+ <Icon name="more-horizontal" color={colors.icon} size={SIZE.xxxl} />+ </TouchableOpacity>++ <WebView+ ref={ref => (EditorWebView = ref)}+ onError={error => console.log(error)}+ onLoad={onWebViewLoad}+ javaScriptEnabled+ onShouldStartLoadWithRequest={_onShouldStartLoadWithRequest}+ renderLoading={() => (+ <Viewstyle={{- marginLeft: -7,+ width: '100%',+ height: '100%',+ backgroundColor: 'transparent',}}- name="chevron-left"- color={colors.icon}- size={SIZE.xxxl - 3}/>- </TouchableOpacity>-- <TouchableOpacity- onPress={() => {- DDS.isTab- ? setSidebar(!sidebar)- : ActionSheetEvent(- note,- true,- true,- ['Add to', 'Share', 'Export', 'Delete'],- ['Dark Mode', 'Add to Vault', 'Pin', 'Favorite'],- );- }}- style={{- width: '12.5%',- height: 50,- justifyContent: 'center',- alignItems: 'flex-end',- position: 'absolute',- right: 0,- top: 0,- marginTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight,- paddingRight: 12,- zIndex: 999,- }}>- <Icon name="more-horizontal" color={colors.icon} size={SIZE.xxxl} />- </TouchableOpacity>-- <WebView- ref={ref => (EditorWebView = ref)}- onError={error => console.log(error)}- onLoad={onWebViewLoad}- javaScriptEnabled- onShouldStartLoadWithRequest={request => {- if (request.url.includes('https')) {- Linking.openURL(request.url);- return false;- } else {- return true;- }- }}- renderLoading={() => (- <View- style={{- width: '100%',- height: '100%',- backgroundColor: 'transparent',- }}- />- )}- cacheEnabled={true}- domStorageEnabled- scrollEnabled={false}- bounces={true}- allowFileAccess={true}- scalesPageToFit={true}- originWhitelist={'*'}- injectedJavaScript={Platform.OS === 'ios' ? injectedJS : null}- source={- Platform.OS === 'ios'- ? {uri: sourceUri}- : {- uri: 'file:///android_asset/texteditor.html',- baseUrl: 'baseUrl:"file:///android_asset/',- }- }- style={{- height: '100%',- maxHeight: '100%',- backgroundColor: 'transparent',- }}- onMessage={evt => {- if (evt.nativeEvent.data !== '') {- clearTimeout(timer);- timer = null;- onChange(evt.nativeEvent.data);- timer = setTimeout(() => {- saveNote(noteProps, true);- console.log('saved');- }, 1000);- }- }}- />- </View>+ )}+ cacheEnabled={true}+ domStorageEnabled+ scrollEnabled={false}+ bounces={true}+ allowFileAccess={true}+ scalesPageToFit={true}+ originWhitelist={'*'}+ injectedJavaScript={Platform.OS === 'ios' ? injectedJS : null}+ source={+ Platform.OS === 'ios'+ ? {uri: sourceUri}+ : {+ uri: 'file:///android_asset/texteditor.html',+ baseUrl: 'baseUrl:"file:///android_asset/',+ }+ }+ style={{+ height: '100%',+ maxHeight: '100%',+ backgroundColor: 'transparent',+ }}+ onMessage={_onMessage}+ /></KeyboardAvoidingView>);};@@ -304,22 +286,17 @@ const Editor = ({navigation}) => {EditorWebView.reload();}, [colors]);- return DDS.isTab ? (- <View+ return (+ <AnimatedSafeAreaView+ transition={['backgroundColor', 'width']}+ duration={300}style={{- flexDirection: 'row',- width: '100%',+ flex: 1,+ backgroundColor: colors.bg,+ height: '100%',+ width: sidebar ? '70%' : '100%',}}>- <AnimatedSafeAreaView- transition={['backgroundColor', 'width']}- duration={300}- style={{- height: '100%',- backgroundColor: colors.bg,- width: sidebar ? '70%' : '100%',- }}>- {_renderEditor()}- </AnimatedSafeAreaView>+ {_renderEditor()}<Animatable.Viewtransition={['width', 'opacity']}duration={300}@@ -327,35 +304,9 @@ const Editor = ({navigation}) => {width: sidebar ? '30%' : '0%',opacity: sidebar ? 1 : 0,}}>- <EditorMenu- hide={false}- noteProps={noteProps}- updateProps={props => {- setNoteProps(props);- }}- close={() => {- setTimeout(() => {- setOpen(args);- }, 500);- }}- />+ {DDS.isTab ? <EditorMenu hide={false} /> : null}</Animatable.View>- </View>- ) : (- <Animatable.View- transition="backgroundColor"- duration={300}- style={{- backgroundColor: colors.bg,- flex: 1,- }}>- <AnimatedSafeAreaView- transition="backgroundColor"- duration={300}- style={{height: '100%', backgroundColor: colors.bg}}>- {_renderEditor()}- </AnimatedSafeAreaView>- </Animatable.View>+ </AnimatedSafeAreaView>);};diff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.jsindex 71faa037c..3582e59ac 100644--- a/apps/mobile/src/views/Folders/index.js+++ b/apps/mobile/src/views/Folders/index.js@@ -71,202 +71,187 @@ export const Folders = ({navigation}) => {offsetY = y;};- if (!isFocused) {- console.log('block rerender');- return <></>;- } else {- return (- <Container- bottomButtonText="Add a new notebook"- bottomButtonOnPress={() => {- setAddNotebook(true);+ return (+ <Container+ bottomButtonText="Add a new notebook"+ bottomButtonOnPress={() => {+ //setAddNotebook(true);+ }}>+ <SelectionHeader />++ <Animatable.View+ transition={['backgroundColor', 'opacity', 'height']}+ duration={300}+ style={{+ position: 'absolute',+ backgroundColor: colors.bg,+ height: selectionMode ? 0 : null,+ opacity: selectionMode ? 0 : 1,+ zIndex: 20,+ width: '100%',}}>- <AddNotebookDialog- visible={addNotebook}- close={newNotes => {- setAddNotebook(false);- if (newNotes) {- dispatch({type: ACTIONS.NOTEBOOKS});- }+ <Header+ hide={hideHeader}+ menu={params.canGoBack ? false : true}+ preventDefaultMargins={preventDefaultMargins}+ navigation={navigation}+ showSearch={() => {+ setHideHeader(false);+ countUp = 0;+ countDown = 0;}}+ colors={colors}+ heading={params.title}+ canGoBack={params.canGoBack}/>+ {notebooks.length == 0 ? null : (+ <Search placeholder="Search your notebook" hide={hideHeader} />+ )}+ </Animatable.View>- <SelectionHeader />-- <Animatable.View- transition={['backgroundColor', 'opacity', 'height']}- duration={300}- style={{- position: 'absolute',- backgroundColor: colors.bg,- height: selectionMode ? 0 : null,- opacity: selectionMode ? 0 : 1,- zIndex: 20,- width: '100%',- }}>- <Header- hide={hideHeader}- menu={params.canGoBack ? false : true}- preventDefaultMargins={preventDefaultMargins}- navigation={navigation}- showSearch={() => {- setHideHeader(false);- countUp = 0;- countDown = 0;- }}- colors={colors}- heading={params.title}- canGoBack={params.canGoBack}- />- {notebooks.length == 0 ? null : (- <Search placeholder="Search your notebook" hide={hideHeader} />- )}- </Animatable.View>-- <FlatList- style={{- width: '100%',- }}- onScroll={onScroll}- ListHeaderComponent={- <View- style={{- marginTop:- Platform.OS == 'ios'- ? notebooks[0] && !selectionMode- ? 135- : 135 - 60- : notebooks[0] && !selectionMode- ? 155- : 155 - 60,- }}>- {pinned && pinned.length > 0 ? (- <>- <FlatList- data={pinned}- keyExtractor={(item, index) => item.dateCreated.toString()}- renderItem={({item, index}) =>- item.type === 'notebook' ? (- <SelectionWrapper item={item}>- <NotebookItem- hideMore={params.hideMore}- customStyle={{- width: selectionMode ? w - 74 : '100%',- marginHorizontal: 0,- }}- isMove={params.isMove}- onLongPress={() => {- dispatch({- type: ACTIONS.SELECTION_MODE,- enabled: !selectionMode,- });- dispatch({- type: ACTIONS.SELECTED_ITEMS,- item: item,- });- }}- noteToMove={params.note}- item={item}- pinned={true}- index={index}- colors={colors}- />- </SelectionWrapper>- ) : null- }- />- </>- ) : null}- </View>- }- ListEmptyComponent={- pinned && pinned.length > 0 ? null : (- <View- style={{- height: '80%',- width: '100%',- alignItems: 'center',- alignSelf: 'center',- justifyContent: 'center',- opacity: 0.8,- }}>- <NotebookPlaceHolder animation={slideRight} colors={colors} />- <NotebookPlaceHolder animation={slideLeft} colors={colors} />- <NotebookPlaceHolder animation={slideRight} colors={colors} />-- <Text- style={{- color: colors.icon,- fontSize: SIZE.md,- fontFamily: WEIGHT.regular,- marginTop: 20,- }}>- Notebooks you add will appear here- </Text>- <Text- style={{- fontSize: SIZE.sm,- color: colors.icon,- marginTop: 20,- }}>- No Notebooks found- </Text>- </View>- )- }- contentContainerStyle={{- width: '100%',- alignSelf: 'center',- }}- ListFooterComponent={+ <FlatList+ style={{+ width: '100%',+ }}+ onScroll={onScroll}+ ListHeaderComponent={+ <View+ style={{+ marginTop:+ Platform.OS == 'ios'+ ? notebooks[0] && !selectionMode+ ? 135+ : 135 - 60+ : notebooks[0] && !selectionMode+ ? 155+ : 155 - 60,+ }}>+ {pinned && pinned.length > 0 ? (+ <>+ <FlatList+ data={pinned}+ keyExtractor={(item, index) => item.dateCreated.toString()}+ renderItem={({item, index}) =>+ item.type === 'notebook' ? (+ <SelectionWrapper item={item}>+ <NotebookItem+ hideMore={params.hideMore}+ customStyle={{+ width: selectionMode ? w - 74 : '100%',+ marginHorizontal: 0,+ }}+ isMove={params.isMove}+ onLongPress={() => {+ dispatch({+ type: ACTIONS.SELECTION_MODE,+ enabled: !selectionMode,+ });+ dispatch({+ type: ACTIONS.SELECTED_ITEMS,+ item: item,+ });+ }}+ noteToMove={params.note}+ item={item}+ pinned={true}+ index={index}+ colors={colors}+ />+ </SelectionWrapper>+ ) : null+ }+ />+ </>+ ) : null}+ </View>+ }+ ListEmptyComponent={+ pinned && pinned.length > 0 ? null : (<Viewstyle={{- height: 150,+ height: '80%',+ width: '100%',alignItems: 'center',+ alignSelf: 'center',justifyContent: 'center',+ opacity: 0.8,}}>+ <NotebookPlaceHolder animation={slideRight} colors={colors} />+ <NotebookPlaceHolder animation={slideLeft} colors={colors} />+ <NotebookPlaceHolder animation={slideRight} colors={colors} />+<Textstyle={{- color: colors.navbg,- fontSize: SIZE.sm,+ color: colors.icon,+ fontSize: SIZE.md,fontFamily: WEIGHT.regular,+ marginTop: 20,}}>- - End -+ Notebooks you add will appear here+ </Text>+ <Text+ style={{+ fontSize: SIZE.sm,+ color: colors.icon,+ marginTop: 20,+ }}>+ No Notebooks found</Text></View>- }- data={notebooks}- keyExtractor={(item, index) => item.dateCreated.toString()}- renderItem={({item, index}) => (- <SelectionWrapper item={item}>- <NotebookItem- hideMore={params.hideMore}- navigation={navigation}- customStyle={{- width: selectionMode ? w - 74 : '100%',- marginHorizontal: 0,- }}- isMove={params.isMove}- onLongPress={() => {- dispatch({- type: ACTIONS.SELECTION_MODE,- enabled: !selectionMode,- });- dispatch({- type: ACTIONS.SELECTED_ITEMS,- item: item,- });- }}- noteToMove={params.note}- item={item}- index={index}- />- </SelectionWrapper>- )}- />- </Container>- );- }+ )+ }+ contentContainerStyle={{+ width: '100%',+ alignSelf: 'center',+ }}+ ListFooterComponent={+ <View+ style={{+ height: 150,+ alignItems: 'center',+ justifyContent: 'center',+ }}>+ <Text+ style={{+ color: colors.navbg,+ fontSize: SIZE.sm,+ fontFamily: WEIGHT.regular,+ }}>+ - End -+ </Text>+ </View>+ }+ data={notebooks}+ keyExtractor={(item, index) => item.dateCreated.toString()}+ renderItem={({item, index}) => (+ <SelectionWrapper item={item}>+ <NotebookItem+ hideMore={params.hideMore}+ navigation={navigation}+ customStyle={{+ width: selectionMode ? w - 74 : '100%',+ marginHorizontal: 0,+ }}+ isMove={params.isMove}+ onLongPress={() => {+ dispatch({+ type: ACTIONS.SELECTION_MODE,+ enabled: !selectionMode,+ });+ dispatch({+ type: ACTIONS.SELECTED_ITEMS,+ item: item,+ });+ }}+ noteToMove={params.note}+ item={item}+ index={index}+ />+ </SelectionWrapper>+ )}+ />+ </Container>+ );};Folders.navigationOptions = {