From d5f101118e7c4caf75b2753339773b5966ab0d0b Mon Sep 17 00:00:00 2001 From: Luke Pacholski Date: Fri, 20 Nov 2015 11:20:47 -0800 Subject: [PATCH] Fullscreen preview mode --- README.md | 2 ++ src/bramble/client/main.js | 8 ++++++++ .../default/bramble/lib/RemoteCommandHandler.js | 6 ++++++ src/extensions/default/bramble/lib/UI.js | 10 ++++++++++ src/styles/bramble_overrides.css | 8 ++++++++ 5 files changed, 34 insertions(+) diff --git a/README.md b/README.md index b88e482b53d..e808d1fc3c7 100644 --- a/README.md +++ b/README.md @@ -336,6 +336,8 @@ to be notified when the action completes: * `refreshPreview([callback])` - reloads the preview with the latest content in the editor and filesystem * `useMobilePreview([callback])` - uses a Mobile view in the preview, as it would look on a smartphone * `useDesktopPreview([callback])` - uses a Desktop view in the preview, as it would look on a desktop computer (default) +* `enableFullscreenPreview([callback])` - shows a fullscreen preview of the current file +* `disableFullscreenPreview([callback])` - turns off the fullscreen preview of the curent file * `enableJavaScript([callback])` - turns on JavaScript execution for the preview (default) * `disableJavaScript([callback])` - turns off JavaScript execution for the preview * `enableWordWrap([callback])` - turns on word wrap for the editor (default) diff --git a/src/bramble/client/main.js b/src/bramble/client/main.js index 56b5596f179..e7cec109b5a 100644 --- a/src/bramble/client/main.js +++ b/src/bramble/client/main.js @@ -806,6 +806,14 @@ define([ this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_DESKTOP_PREVIEW"}, callback); }; + BrambleProxy.prototype.enableFullscreenPreview = function(callback) { + this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_ENABLE_FULLSCREEN_PREVIEW"}, callback); + }; + + BrambleProxy.prototype.disableFullscreenPreview = function(callback) { + this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_DISABLE_FULLSCREEN_PREVIEW"}, callback); + }; + BrambleProxy.prototype.enableJavaScript = function(callback) { this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_ENABLE_SCRIPTS"}, callback); }; diff --git a/src/extensions/default/bramble/lib/RemoteCommandHandler.js b/src/extensions/default/bramble/lib/RemoteCommandHandler.js index c99f7bc5e76..c3845fbc25b 100644 --- a/src/extensions/default/bramble/lib/RemoteCommandHandler.js +++ b/src/extensions/default/bramble/lib/RemoteCommandHandler.js @@ -76,6 +76,12 @@ define(function (require, exports, module) { case "BRAMBLE_DESKTOP_PREVIEW": UI.showDesktopView(); break; + case "BRAMBLE_ENABLE_FULLSCREEN_PREVIEW": + UI.enableFullscreenPreview(); + break; + case "BRAMBLE_DISABLE_FULLSCREEN_PREVIEW": + UI.disableFullscreenPreview(); + break; case "BRAMBLE_ENABLE_SCRIPTS": HTMLRewriter.enableScripts(); PostMessageTransport.reload(); diff --git a/src/extensions/default/bramble/lib/UI.js b/src/extensions/default/bramble/lib/UI.js index 8b08eca014f..909fe9ff898 100644 --- a/src/extensions/default/bramble/lib/UI.js +++ b/src/extensions/default/bramble/lib/UI.js @@ -195,6 +195,14 @@ define(function (require, exports, module) { MainViewManager.setActivePaneId("first-pane"); } + function enableFullscreenPreview() { + $("#main-view").addClass("fullscreen-preview"); + } + + function disableFullscreenPreview() { + $("#main-view").removeClass("fullscreen-preview"); + } + function showDesktopView(preventReload) { if(!isMobileViewOpen) { return; @@ -323,6 +331,8 @@ define(function (require, exports, module) { exports.initUI = initUI; exports.showMobileView = showMobileView; exports.showDesktopView = showDesktopView; + exports.enableFullscreenPreview = enableFullscreenPreview; + exports.disableFullscreenPreview = disableFullscreenPreview; exports.getPreviewMode = getPreviewMode; exports.removeLeftSideToolBar = removeLeftSideToolBar; exports.removeMainToolBar = removeMainToolBar; diff --git a/src/styles/bramble_overrides.css b/src/styles/bramble_overrides.css index aec7a78c4ac..fb9dd831b25 100644 --- a/src/styles/bramble_overrides.css +++ b/src/styles/bramble_overrides.css @@ -63,3 +63,11 @@ li.jstree-leaf > a { .image-header { height: auto !important; } + +.fullscreen-preview #first-pane { + display: none; +} + +.fullscreen-preview .main-view .content { + left: 0 !important; +}