diff --git a/CHANGELOG.md b/CHANGELOG.md index 456c6c29..a8f92f4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # PrivateBin version history ## 1.7.6 (not yet released) +* CHANGED: Allow toggling tab-key-support using `[Ctrl]+[m]` or `[Esc]` in textarea for keyboard navigation (#1386) ## 1.7.5 (2024-11-16) * ADDED: Allow non persistent SQL connections, if configured (#1394) diff --git a/i18n/en.json b/i18n/en.json index abc2e80a..9d0eaa25 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -151,7 +151,7 @@ "server error or not responding": "server error or not responding", "Could not post comment: %s": "Could not post comment: %s", "Sending paste…": "Sending paste…", - "Your paste is %s (Hit [Ctrl]+[c] to copy)": "Your paste is %s (Hit [Ctrl]+[c] to copy)", + "Your paste is %s (Hit Ctrl+c to copy)": "Your paste is %s (Hit Ctrl+c to copy)", "Delete data": "Delete data", "Could not create paste: %s": "Could not create paste: %s", "Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)": "Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)", @@ -220,5 +220,7 @@ "Dark Mode": "Dark Mode", "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.", "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.", - "Start over": "Start over" + "Start over": "Start over", + "Paste text": "Paste text", + "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)" } diff --git a/js/dark-mode-switch.js b/js/dark-mode-switch.js index 07288ee6..e60bedb5 100644 --- a/js/dark-mode-switch.js +++ b/js/dark-mode-switch.js @@ -68,7 +68,7 @@ } else { delStoredPrettifyTheme() } - const toggle = document.querySelector('#bd-theme') + const toggle = document.getElementById('bd-theme') const theme = getStoredPreferredTheme() setTheme(theme) toggle.checked = (theme === 'dark') diff --git a/js/privatebin.js b/js/privatebin.js index 8167d805..7e07d2ca 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2092,7 +2092,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { { I18n._( $('#pastelink'), - 'Your paste is %s (Hit [Ctrl]+[c] to copy)', + 'Your paste is %s (Hit Ctrl+c to copy)', url, url ); // save newly created element @@ -2394,7 +2394,8 @@ jQuery.PrivateBin = (function($, RawDeflate) { $messagePreview, $messagePreviewParent, $message, - isPreview = false; + isPreview = false, + isTabSupported = true; /** * support input of tab character @@ -2406,9 +2407,14 @@ jQuery.PrivateBin = (function($, RawDeflate) { */ function supportTabs(event) { - const keyCode = event.keyCode || event.which; + // support disabling tab support using [Esc] and [Ctrl]+[m] + if (event.key === 'Escape' || (event.ctrlKey && event.key === 'm')) { + toggleTabSupport(); + document.getElementById('message-tab').checked = isTabSupported; + event.preventDefault(); + } // tab was pressed - if (keyCode === 9) { + else if (isTabSupported && event.key === 'Tab') { // get caret position & selection const val = this.value, start = this.selectionStart, @@ -2422,6 +2428,18 @@ jQuery.PrivateBin = (function($, RawDeflate) { } } + /** + * toggle tab support in message textarea + * + * @name Editor.toggleTabSupport + * @private + * @function + */ + function toggleTabSupport() + { + isTabSupported = !isTabSupported; + } + /** * view the Editor tab * @@ -2599,6 +2617,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { // bind events $message.keydown(supportTabs); + $('#message-tab').change(toggleTabSupport); // bind click events to tab switchers (a), and save parents (li) $messageEdit = $('#messageedit').click(viewEditor); @@ -3768,7 +3787,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { /** * Clear the password input in the top navigation - * + * * @name TopNav.clearPasswordInput * @function */ diff --git a/lib/Configuration.php b/lib/Configuration.php index 634209a5..7fca5f52 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -108,7 +108,7 @@ class Configuration 'js/kjua-0.9.0.js' => 'sha512-CVn7af+vTMBd9RjoS4QM5fpLFEOtBCoB0zPtaqIDC7sF4F8qgUSRFQQpIyEDGsr6yrjbuOLzdf20tkHHmpaqwQ==', 'js/legacy.js' => 'sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==', 'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==', - 'js/privatebin.js' => 'sha512-JUj/Sbl/bMHlIoIUT1U9e89JU33fDBxCxLSGxwwaeydBFXOBHyfdF7hwSIjgbPxb4d9CO7CSe4meouTIRMy8Vg==', + 'js/privatebin.js' => 'sha512-V0coVhQkhG/bSJcZAMOoR+9Ztak1hElXiOtcrR4zZYm4MwScgytYHPVeZa6ZVKf+Mxp5TtIvM+NcYixP33Yliw==', 'js/purify-3.1.7.js' => 'sha512-LegvqULiMtOfboJZw9MpETN/b+xnLRXZI90gG7oIFHW+yAeHmKvRtEUbiMFx2WvUqQoL9XB3gwU+hWXUT0X+8A==', 'js/rawinflate-0.3.js' => 'sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==', 'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==', diff --git a/tpl/bootstrap5.php b/tpl/bootstrap5.php index 22909352..9d85da48 100644 --- a/tpl/bootstrap5.php +++ b/tpl/bootstrap5.php @@ -88,7 +88,7 @@ endif;
@@ -249,7 +249,7 @@ if ($PASSWORD) : ?>+ + +