From 3fafda96848ff0ee3e81a82a146c92311bb35e30 Mon Sep 17 00:00:00 2001 From: "Helmut K. C. Tessarek" Date: Mon, 10 Jun 2019 03:05:20 -0400 Subject: [PATCH] Desktop: Added menu item to format inline code (#1641) * Revert "Fix for #1426, aded backticks to auto-wrapping quotes." This reverts commit 7dee93076a3d10f116961eaa703c725531776255. * changes to backtick behavior - add shortcut ``` cmd+` ``` / ``` ctrl+` ``` - add menu item for `Inline code` * rename menu item Inline Code -> Code --- ElectronClient/app/app.js | 10 ++++++++++ ElectronClient/app/gui/NoteText.jsx | 5 ++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ElectronClient/app/app.js b/ElectronClient/app/app.js index 42ed6f9090..e76e2250df 100644 --- a/ElectronClient/app/app.js +++ b/ElectronClient/app/app.js @@ -668,6 +668,16 @@ class Application extends BaseApplication { name: 'textLink', }); }, + }, { + label: _('Code'), + screens: ['Main'], + accelerator: 'CommandOrControl+`', + click: () => { + this.dispatch({ + type: 'WINDOW_COMMAND', + name: 'textCode', + }); + }, }, { type: 'separator', screens: ['Main'], diff --git a/ElectronClient/app/gui/NoteText.jsx b/ElectronClient/app/gui/NoteText.jsx index caa3cb1e73..cef4293455 100644 --- a/ElectronClient/app/gui/NoteText.jsx +++ b/ElectronClient/app/gui/NoteText.jsx @@ -896,9 +896,6 @@ class NoteTextComponent extends React.Component { } return output; } - - //fixes #1426 but this is an Ace issue, so it can be removed if ace/brace is updated. - this.editor_.editor.getSession().getMode().$quotes = {'"': '"', "'": "'", "`": "`"}; // Disable Markdown auto-completion (eg. auto-adding a dash after a line with a dash. // https://github.com/ajaxorg/ace/issues/2754 @@ -1022,6 +1019,8 @@ class NoteTextComponent extends React.Component { fn = this.commandStartExternalEditing; } else if (command.name === 'showLocalSearch') { fn = this.commandShowLocalSearch; + } else if (command.name === 'textCode') { + fn = this.commandTextCode; } }