mirror of
https://github.com/laurent22/joplin.git
synced 2025-04-11 11:12:03 +02:00
Merge pull request #628 from Abijeet/master
Adds a shortcut to insert the date and time.
This commit is contained in:
commit
7e3a290939
@ -183,7 +183,7 @@ class Application extends BaseApplication {
|
||||
if (action.type == 'SETTING_UPDATE_ONE' && action.key == 'locale' || action.type == 'SETTING_UPDATE_ALL') {
|
||||
setLocale(Setting.value('locale'));
|
||||
// The bridge runs within the main process, with its own instance of locale.js
|
||||
// so it needs to be set too here.
|
||||
// so it needs to be set too here.
|
||||
bridge().setLocale(Setting.value('locale'));
|
||||
this.refreshMenu();
|
||||
}
|
||||
@ -362,7 +362,7 @@ class Application extends BaseApplication {
|
||||
}
|
||||
}, {
|
||||
label: _('New notebook'),
|
||||
accelerator: 'CommandOrControl+B',
|
||||
accelerator: 'CommandOrControl+Shift+B',
|
||||
screens: ['Main'],
|
||||
click: () => {
|
||||
this.dispatch({
|
||||
@ -442,6 +442,17 @@ class Application extends BaseApplication {
|
||||
name: 'textItalic',
|
||||
});
|
||||
},
|
||||
}, {
|
||||
label: _('Insert Date Time'),
|
||||
screens: ['Main'],
|
||||
visible: false,
|
||||
accelerator: 'CommandOrControl+Shift+T',
|
||||
click: () => {
|
||||
this.dispatch({
|
||||
type: 'WINDOW_COMMAND',
|
||||
name: 'insertDateTime',
|
||||
});
|
||||
},
|
||||
}, {
|
||||
type: 'separator',
|
||||
screens: ['Main'],
|
||||
|
@ -187,7 +187,7 @@ class NoteTextComponent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
return pos;
|
||||
return pos;
|
||||
}
|
||||
|
||||
textOffsetToCursorPosition(offset, body) {
|
||||
@ -597,8 +597,8 @@ class NoteTextComponent extends React.Component {
|
||||
const letters = ['F', 'T', 'P', 'Q', 'L', ','];
|
||||
for (let i = 0; i < letters.length; i++) {
|
||||
const l = letters[i];
|
||||
cancelledKeys.push('Ctrl+' + l);
|
||||
cancelledKeys.push('Command+' + l);
|
||||
cancelledKeys.push('Ctrl+' + l);
|
||||
cancelledKeys.push('Command+' + l);
|
||||
}
|
||||
|
||||
for (let i = 0; i < cancelledKeys.length; i++) {
|
||||
@ -751,6 +751,8 @@ class NoteTextComponent extends React.Component {
|
||||
this.commandTextBold();
|
||||
} else if (command.name === 'textItalic') {
|
||||
this.commandTextItalic();
|
||||
} else if (command.name === 'insertDateTime' ) {
|
||||
this.commandDateTime();
|
||||
} else if (command.name === 'commandStartExternalEditing') {
|
||||
this.commandStartExternalEditing();
|
||||
} else {
|
||||
@ -954,6 +956,10 @@ class NoteTextComponent extends React.Component {
|
||||
this.wrapSelectionWithStrings('*', '*', _('emphasized text'));
|
||||
}
|
||||
|
||||
commandDateTime() {
|
||||
this.wrapSelectionWithStrings(time.formatMsToLocal(new Date().getTime()));
|
||||
}
|
||||
|
||||
commandTextCode() {
|
||||
this.wrapSelectionWithStrings('`', '`');
|
||||
}
|
||||
@ -1046,7 +1052,7 @@ class NoteTextComponent extends React.Component {
|
||||
tooltip: _('Hyperlink'),
|
||||
iconName: 'fa-link',
|
||||
onClick: () => { return this.commandTextLink(); },
|
||||
});
|
||||
});
|
||||
|
||||
toolbarItems.push({
|
||||
tooltip: _('Code'),
|
||||
@ -1094,6 +1100,12 @@ class NoteTextComponent extends React.Component {
|
||||
onClick: () => { return this.commandTextHorizontalRule(); },
|
||||
});
|
||||
|
||||
toolbarItems.push({
|
||||
tooltip: _('Insert Date Time'),
|
||||
iconName: 'fa-calendar-plus-o',
|
||||
onClick: () => { return this.commandDateTime(); },
|
||||
});
|
||||
|
||||
toolbarItems.push({
|
||||
type: 'separator',
|
||||
});
|
||||
@ -1325,7 +1337,7 @@ class NoteTextComponent extends React.Component {
|
||||
editorProps={{$blockScrolling: true}}
|
||||
|
||||
// This is buggy (gets outside the container)
|
||||
highlightActiveLine={false}
|
||||
highlightActiveLine={false}
|
||||
/>
|
||||
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user