mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
feat: duplicate/localOnly note
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user