Merge remote-tracking branch 'origin/master'

This commit is contained in:
Martin Mahner 2019-06-13 15:41:03 +02:00
commit e669357f2d
2 changed files with 5 additions and 4 deletions

View file

@ -5,6 +5,7 @@ Changelog
------------- -------------
- "Edit Snippet" panel is now hidden by default to remove visual noise. - "Edit Snippet" panel is now hidden by default to remove visual noise.
- Linux/Unix browsers now use Ctrl+Enter as a shortcut to submit the form.
- Added a dedicated "Copy Snippet" button to copy the content to the clipboard. - Added a dedicated "Copy Snippet" button to copy the content to the clipboard.
- Added "View Raw" option to optionally render the 'raw' snippet content with a - Added "View Raw" option to optionally render the 'raw' snippet content with a
template rather served as plain text. This was added to hinder abuse. template rather served as plain text. This was added to hinder abuse.

View file

@ -3,8 +3,8 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Add data-platform to the body tag to show platform related shortcuts // Add data-platform to the body tag to show platform related shortcuts
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
const isWindows = navigator.appVersion.indexOf('Win') !== -1; const isMac = navigator.platform.indexOf('Mac') !== -1;
document.body.dataset.platform = isWindows ? 'win' : 'mac'; document.body.dataset.platform = isMac ? 'mac' : 'win';
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Autofocus the content field on the homepage // Autofocus the content field on the homepage
@ -18,7 +18,7 @@ if (af !== null) {
// Cmd+Enter or Ctrl+Enter submits the form // Cmd+Enter or Ctrl+Enter submits the form
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
document.body.onkeydown = function(e) { document.body.onkeydown = function(e) {
const metaKey = isWindows ? e.ctrlKey : e.metaKey; const metaKey = isMac ? e.metaKey : e.ctrlKey;
const form = document.querySelector('.snippet-form'); const form = document.querySelector('.snippet-form');
if (form && e.keyCode === 13 && metaKey) { if (form && e.keyCode === 13 && metaKey) {