Merge pull request #1003 from sharelatex/cmg-split-screen-button

Switch between pdf and editor with full-screen button
This commit is contained in:
Timothée Alby 2018-10-11 10:54:53 +01:00 committed by GitHub
commit 89590d5199
3 changed files with 19 additions and 18 deletions

View file

@ -106,7 +106,7 @@ div.full-size.pdf(ng-controller="PdfController")
| #{translate("code_check_failed")}
a(
href,
ng-click="switchToFlatLayout()"
ng-click="switchToFlatLayout('pdf')"
ng-show="ui.pdfLayout == 'sideBySide'"
tooltip=translate('full_screen')
tooltip-placement="bottom"
@ -116,7 +116,7 @@ div.full-size.pdf(ng-controller="PdfController")
i.full-screen
a(
href,
ng-click="switchToSideBySideLayout()"
ng-click="switchToSideBySideLayout('editor')"
ng-show="ui.pdfLayout == 'flat'"
tooltip=translate('split_screen')
tooltip-placement="bottom"

View file

@ -190,6 +190,23 @@ define [
ide.localStorage = localStorage
ide.browserIsSafari = false
$scope.switchToFlatLayout = (view) ->
$scope.ui.pdfLayout = 'flat'
$scope.ui.view = view
ide.localStorage "pdf.layout", "flat"
$scope.switchToSideBySideLayout = (view) ->
$scope.ui.pdfLayout = 'sideBySide'
$scope.ui.view = view
localStorage "pdf.layout", "split"
if pdfLayout = localStorage("pdf.layout")
$scope.switchToSideBySideLayout() if pdfLayout == "split"
$scope.switchToFlatLayout() if pdfLayout == "flat"
else
$scope.switchToSideBySideLayout()
try
userAgent = navigator.userAgent
ide.browserIsSafari = (

View file

@ -591,22 +591,6 @@ define [
{doc, line} = data
ide.editorManager.openDoc(doc, gotoLine: line)
$scope.switchToFlatLayout = () ->
$scope.ui.pdfLayout = 'flat'
$scope.ui.view = 'pdf'
ide.localStorage "pdf.layout", "flat"
$scope.switchToSideBySideLayout = () ->
$scope.ui.pdfLayout = 'sideBySide'
$scope.ui.view = 'editor'
localStorage "pdf.layout", "split"
if pdfLayout = localStorage("pdf.layout")
$scope.switchToSideBySideLayout() if pdfLayout == "split"
$scope.switchToFlatLayout() if pdfLayout == "flat"
else
$scope.switchToSideBySideLayout()
App.factory "synctex", ["ide", "$http", "$q", (ide, $http, $q) ->
# enable per-user containers by default
perUserCompile = true