dblclick for new note; immediately-cancellable notes
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
import nanoid from '../nanoid.min.js';
|
||||
import api from '../api.js';
|
||||
|
||||
const preventDblClickSelection = function(e){
|
||||
// as per [https://stackoverflow.com/a/43321596]
|
||||
if(e.detail>1){
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
const load_notes = function(state, dispatch){
|
||||
api.post('/load-notes', {bin_id: state.bin_id})
|
||||
.then(res=>{
|
||||
@@ -88,7 +94,8 @@ const choose_bin_handler = function(state, dispatch, bin_id){
|
||||
});
|
||||
};
|
||||
|
||||
export {new_note_handler,
|
||||
export {preventDblClickSelection,
|
||||
new_note_handler,
|
||||
new_note_by_dblclick_handler,
|
||||
search_term_change_handler,
|
||||
sorting_change_handler,
|
||||
|
||||
@@ -3,8 +3,14 @@ import api from '../api.js';
|
||||
const edit_handler = function(note_state, dispatch){
|
||||
dispatch('update-note-editing', {id: note_state.note_id, is_editing: true});
|
||||
};
|
||||
const cancel_handler = function(note_state, dispatch){
|
||||
dispatch('update-note-editing', {id: note_state.note_id, is_editing: false});
|
||||
const cancel_handler = function(state, note_state, dispatch){
|
||||
// TODO: this `if` may cause glitches; keep in mind
|
||||
if(note_state.is_new===true){
|
||||
dispatch('immediately-cancel-note', note_state.note_id);
|
||||
}
|
||||
else{
|
||||
dispatch('update-note-editing', {id: note_state.note_id, is_editing: false});
|
||||
}
|
||||
};
|
||||
const text_change_handler = function(note_state, dispatch, e){
|
||||
note_state.temp_text = e.target.value;
|
||||
|
||||
Reference in New Issue
Block a user