forked from laurent22/joplin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mobile: Fixes laurent22#11539: Fix missing "Insert Time" button
- Loading branch information
1 parent
9e80e2e
commit 422a473
Showing
6 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/app-mobile/components/screens/Note/commands/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/app-mobile/components/screens/Note/commands/insertDateTime.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/services/CommandService'; | ||
import { _ } from '@joplin/lib/locale'; | ||
import { CommandRuntimeProps } from '../types'; | ||
import time from '@joplin/lib/time'; | ||
|
||
export const declaration: CommandDeclaration = { | ||
name: 'insertDateTime', | ||
label: () => _('Insert time'), | ||
iconName: 'material calendar-plus', | ||
}; | ||
|
||
export const runtime = (props: CommandRuntimeProps): CommandRuntime => { | ||
return { | ||
execute: async (_context: CommandContext) => { | ||
props.insertText(time.formatDateToLocal(new Date())); | ||
}, | ||
|
||
enabledCondition: '!noteIsReadOnly', | ||
}; | ||
}; |