feat: duplicate/localOnly note

This commit is contained in:
ammarahm-ed
2022-03-14 16:28:54 +05:00
parent 60a46f8b27
commit 28d7c80083
2 changed files with 37 additions and 0 deletions

View File

@@ -453,6 +453,16 @@ export const useActions = ({ close = () => {}, item }) => {
eSendEvent(eOpenExportDialog, [item]);
}
async function toggleLocalOnly() {
db.notes.note(item.id).localOnly();
Navigation.setRoutesToUpdate([
Navigation.routeNames.NotesPage,
Navigation.routeNames.Favorites,
Navigation.routeNames.Notes
]);
close();
}
const toggleReadyOnlyMode = async () => {
await db.notes.note(item.id).readonly();
let current = db.notes.note(item.id).data.readonly;
@@ -468,6 +478,16 @@ export const useActions = ({ close = () => {}, item }) => {
close();
};
const duplicateNote = async () => {
await db.notes.note(item.id).duplicate();
Navigation.setRoutesToUpdate([
Navigation.routeNames.NotesPage,
Navigation.routeNames.Favorites,
Navigation.routeNames.Notes
]);
close();
};
const actions = [
{
name: 'Add to notebook',
@@ -631,12 +651,26 @@ export const useActions = ({ close = () => {}, item }) => {
func: toggleReadyOnlyMode,
on: item.readonly
},
{
name: 'Local only',
title: 'Local only',
icon: 'sync-off',
func: toggleLocalOnly,
on: item.localOnly
},
{
name: 'History',
title: 'History',
icon: 'history',
func: openHistory
},
{
name: 'Duplicate',
title: 'Duplicate',
icon: 'content-duplicate',
func: duplicateNote
},
{
name: 'Dark Mode',
title: 'Dark mode',