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 support for setting note title form quick note widget
Ammar Ahmedf1b8275b4b5e
diff --git a/apps/mobile/share/share.js b/apps/mobile/share/share.jsindex 4bb1f09be..9494b8f13 100644--- a/apps/mobile/share/share.js+++ b/apps/mobile/share/share.js@@ -33,6 +33,7 @@ import {SafeAreaView,ScrollView,Text,+ TextInput,TouchableOpacity,View,useWindowDimensions@@ -115,12 +116,14 @@ const ShareView = () => {const appendNoteId = useShareStore((state) => state.appendNote);const [note, setNote] = useState({ ...defaultNote });const noteContent = useRef("");+ const noteTitle = useRef("");const [loading, setLoading] = useState(false);const [loadingExtension, setLoadingExtension] = useState(true);const [rawData, setRawData] = useState({type: null,value: null});+ const inputRef = useRef(null);const [mode, setMode] = useState(1);const keyboardHeight = useRef(0);const { width, height } = useWindowDimensions();@@ -207,6 +210,7 @@ const ShareView = () => {if (!key) continue;if (key.includes("TITLE") || key.includes("SUBJECT")) {note.title = item[key];+ noteTitle.current = note.title;console.log("Note title will be", note.title);}}@@ -275,7 +279,7 @@ const ShareView = () => {const onPress = async () => {setLoading(true);- if (!noteContent.current && rawFiles.length === 0) {+ if (!noteContent.current && rawFiles.length === 0 && !noteTitle.current) {setLoading(false);return;}@@ -298,12 +302,14 @@ const ShareView = () => {type: "tiptap"},id: note.id,- sessionId: Date.now()+ sessionId: Date.now(),+ title: noteTitle.current};} else {noteData = { ...note };noteData.content.data = noteContent.current;noteData.sessionId = Date.now();+ noteData.title = noteTitle.current;}try {@@ -471,7 +477,24 @@ const ShareView = () => {paddingHorizontal: 12}}>- <Heading size={SIZE.lg}>Save to Notesnook</Heading>+ <TextInput+ placeholder="Enter note title"+ ref={inputRef}+ style={{+ flexShrink: 1,+ fontFamily: "OpenSans-SemiBold",+ fontSize: SIZE.lg,+ paddingBottom: 0,+ paddingTop: 0+ }}+ onChangeText={(value) => {+ noteTitle.current = value;+ }}+ blurOnSubmit={false}+ onSubmitEditing={() => {+ editorRef.current.focus();+ }}+ /><Buttontitle="Done"type="accent"@@ -626,13 +649,15 @@ const ShareView = () => {}}>{!loadingExtension && !loadingPage ? (- <Editor- editorRef={editorRef}- onLoad={onLoadEditor}- onChange={(html) => {- noteContent.current = html;- }}- />+ <>+ <Editor+ editorRef={editorRef}+ onLoad={onLoadEditor}+ onChange={(html) => {+ noteContent.current = html;+ }}+ />+ </>) : (<>{loadingPage ? (@@ -646,7 +671,19 @@ const ShareView = () => {</SafeAreaProvider></View>- {appendNoteId ? <AppendNote id={appendNoteId} /> : null}+ {appendNoteId ? (+ <AppendNote+ id={appendNoteId}+ onLoad={(title) => {+ if (!noteTitle.current) {+ noteTitle.current = title;+ inputRef.current?.setNativeProps({+ text: noteTitle.current+ });+ }+ }}+ />+ ) : null}<Viewstyle={{@@ -766,10 +803,16 @@ const ShareView = () => {);};-const AppendNote = ({ id }) => {+const AppendNote = ({ id, onLoad }) => {const { colors } = useThemeColors();const [item] = useDBItem(id, "note");+ useEffect(() => {+ if (item?.title) {+ onLoad?.(item.title);+ }+ }, [item?.title, onLoad]);+return !item ? null : (<Paragraphsize={SIZE.xs}