mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
fix adding notebook.
This commit is contained in:
@@ -105,10 +105,20 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
addNewNotebook = async () => {
|
addNewNotebook = async () => {
|
||||||
|
if (this.currentInputValue) {
|
||||||
|
this.onSubmit();
|
||||||
|
}
|
||||||
|
setTimeout(async () => {
|
||||||
let {topics} = this.state;
|
let {topics} = this.state;
|
||||||
let {toEdit} = this.props;
|
let {toEdit} = this.props;
|
||||||
if (!this.title)
|
if (!this.title)
|
||||||
return ToastEvent.show('Title is required', 'error', 3000, () => {}, '');
|
return ToastEvent.show(
|
||||||
|
'Title is required',
|
||||||
|
'error',
|
||||||
|
3000,
|
||||||
|
() => {},
|
||||||
|
'',
|
||||||
|
);
|
||||||
|
|
||||||
let id = toEdit && toEdit.id ? toEdit.id : null;
|
let id = toEdit && toEdit.id ? toEdit.id : null;
|
||||||
|
|
||||||
@@ -122,6 +132,7 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
updateEvent({type: ACTIONS.NOTEBOOKS});
|
updateEvent({type: ACTIONS.NOTEBOOKS});
|
||||||
this.close();
|
this.close();
|
||||||
ToastEvent.show('New notebook added', 'success', 3000, () => {}, '');
|
ToastEvent.show('New notebook added', 'success', 3000, () => {}, '');
|
||||||
|
}, 200);
|
||||||
};
|
};
|
||||||
|
|
||||||
onSubmit = () => {
|
onSubmit = () => {
|
||||||
@@ -337,6 +348,7 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
|
this.onSubmit();
|
||||||
this.setState({
|
this.setState({
|
||||||
topicInputFoused: false,
|
topicInputFoused: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -21,8 +21,15 @@ import {db, DDS} from '../../../App';
|
|||||||
|
|
||||||
export const NotesList = ({isGrouped = false}) => {
|
export const NotesList = ({isGrouped = false}) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors, selectionMode, currentEditingNote, loading, keyword} = state;
|
const {
|
||||||
const notes = [...state.notes];
|
colors,
|
||||||
|
selectionMode,
|
||||||
|
currentEditingNote,
|
||||||
|
loading,
|
||||||
|
keyword,
|
||||||
|
notes,
|
||||||
|
} = state;
|
||||||
|
|
||||||
const searchResults = [...state.searchResults];
|
const searchResults = [...state.searchResults];
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user