From 7f6474b269a5cfa454d28c0c0da969490c9eb33e Mon Sep 17 00:00:00 2001 From: Jared Deckard Date: Tue, 26 Jul 2016 22:32:10 -0500 Subject: Restore comments lost when converting CoffeeScript to JavaScript --- app/assets/javascripts/zen_mode.js | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'app/assets/javascripts/zen_mode.js') diff --git a/app/assets/javascripts/zen_mode.js b/app/assets/javascripts/zen_mode.js index 71236c6a27d..777b32b41c9 100644 --- a/app/assets/javascripts/zen_mode.js +++ b/app/assets/javascripts/zen_mode.js @@ -1,21 +1,34 @@ - +// Zen Mode (full screen) textarea +// /*= provides zen_mode:enter */ - - /*= provides zen_mode:leave */ - - +// /*= require jquery.scrollTo */ - - /*= require dropzone */ - - /*= require mousetrap */ - - /*= require mousetrap/pause */ +// +// ### Events +// +// `zen_mode:enter` +// +// Fired when the "Edit in fullscreen" link is clicked. +// +// **Synchronicity** Sync +// **Bubbles** Yes +// **Cancelable** No +// **Target** a.js-zen-enter +// +// `zen_mode:leave` +// +// Fired when the "Leave Fullscreen" link is clicked. +// +// **Synchronicity** Sync +// **Bubbles** Yes +// **Cancelable** No +// **Target** a.js-zen-leave +// (function() { this.ZenMode = (function() { function ZenMode() { @@ -40,6 +53,7 @@ }; })(this)); $(document).on('keydown', function(e) { + // Esc if (e.keyCode === 27) { e.preventDefault(); return $(document).trigger('zen_mode:leave'); @@ -52,6 +66,7 @@ this.active_backdrop = $(backdrop); this.active_backdrop.addClass('fullscreen'); this.active_textarea = this.active_backdrop.find('textarea'); + // Prevent a user-resized textarea from persisting to fullscreen this.active_textarea.removeAttr('style'); return this.active_textarea.focus(); }; -- cgit v1.2.3