From eb733fdb6f9ab7420d7cc9bb61d56a857e26095d Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 11 Mar 2015 12:54:35 -0400 Subject: [PATCH] toggle preview button on composer --- public/src/modules/composer.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 98ab0407a5..3bfb17b31a 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -348,6 +348,7 @@ define('composer', [ resize.handleResize(postContainer); handleHelp(postContainer); + handleToggle(postContainer); $(window).trigger('action:composer.loaded', { post_uuid: post_uuid @@ -376,6 +377,23 @@ define('composer', [ }); } + function handleToggle(postContainer) { + var showBtn = postContainer.find('.write-container .toggle-preview'), + hideBtn = postContainer.find('.preview-container .toggle-preview'); + + hideBtn.on('click', function() { + $('.preview-container').addClass('hide'); + $('.write-container').addClass('maximized'); + showBtn.removeClass('hide'); + }); + + showBtn.on('click', function() { + $('.preview-container').removeClass('hide'); + $('.write-container').removeClass('maximized'); + showBtn.addClass('hide'); + }); + } + function updateTitle(postData, postContainer) { var titleEl = postContainer.find('.title');