Get layout and resize logic working for PDF view

This commit is contained in:
James Allen 2014-06-28 12:07:18 +01:00
parent 3b57d62de2
commit 845c4a7297
6 changed files with 66 additions and 30 deletions

View file

@ -1,19 +1,28 @@
div.full-size(ng-show="ui.view == 'editor'")
.loading-panel(ng-show="!editor.sharejs_doc || editor.opening")
i.fa.fa-spin.fa-refresh
|   Loading...
div.full-size(
ng-show="ui.view == 'editor'"
layout="pdf"
resize-on="layout:main:resize"
)
.ui-layout-center
.loading-panel(ng-show="true || !editor.sharejs_doc || editor.opening")
i.fa.fa-spin.fa-refresh
|   Loading...
#editor(
ace-editor,
ng-show="!!editor.sharejs_doc && !editor.opening"
theme="settings.theme",
keybindings="settings.mode",
font-size="settings.fontSize",
auto-complete="settings.autoComplete",
spell-check-language="project.spellCheckLanguage",
annotations="onlineUserCursorAnnotations[editor.open_doc_id]"
show-print-margin="false",
sharejs-doc="editor.sharejs_doc",
last-updated="editor.last_updated",
cursor-position="editor.cursorPosition"
)
#editor(
ace-editor,
ng-show="!!editor.sharejs_doc && !editor.opening"
theme="settings.theme",
keybindings="settings.mode",
font-size="settings.fontSize",
auto-complete="settings.autoComplete",
spell-check-language="project.spellCheckLanguage",
annotations="onlineUserCursorAnnotations[editor.open_doc_id]"
show-print-margin="false",
sharejs-doc="editor.sharejs_doc",
last-updated="editor.last_updated",
cursor-position="editor.cursorPosition",
resize-on="layout:main:resize,layout:pdf:resize"
)
.ui-layout-east
include ./pdf

View file

@ -0,0 +1,12 @@
.toolbar.toolbar-tall
a.btn.btn-primary(
href
)
i.fa.fa-refresh
| Recompile
a(
href
tooltip="Logs"
tooltip-placement="bottom"
)
i.fa.fa-file-text-o

View file

@ -72,7 +72,8 @@ div#trackChanges(ng-show="ui.view == 'track-changes'")
font-size="settings.fontSize",
text="trackChanges.diff.text",
annotations="trackChanges.diff.annotations",
read-only="true"
read-only="true",
resize-on="layout:main:resize"
)
.diff-deleted.text-centered(
ng-show="trackChanges.diff.deleted"

View file

@ -10,14 +10,20 @@ define [
spacing_open: 24
spacing_closed: 24
onresize: () =>
scope.$broadcast "layout:resize"
console.log "Triggering", "layout:#{name}:resize", name
scope.$broadcast "layout:#{name}:resize"
#maskIframesOnResize: true
# Restore previously recorded state
if (state = $.localStorage("layout.main"))?
if (state = $.localStorage("layout.#{name}"))?
options.west = state.west
options.east = state.east
$(element).layout options
element.layout options
element.layout().resizeAll()
if attrs.resizeOn?
scope.$on attrs.resizeOn, () -> element.layout().resizeAll()
# Save state when exiting
$(window).unload () ->

View file

@ -58,13 +58,10 @@ define [
editor.commands.removeCommand "showSettingsMenu"
editor.commands.removeCommand "foldall"
scope.$on "layout:resize", () ->
console.log "LAYOUT RESIZED"
editor.resize()
$(window).on "resize", () ->
console.log "WINDOW RESIZED"
editor.resize()
if attrs.resizeOn?
for event in attrs.resizeOn.split(",")
scope.$on event, () ->
editor.resize()
editor.on "changeSelection", () ->
cursor = editor.getCursorPosition()

View file

@ -2,7 +2,7 @@
height: 40px;
border-bottom: 1px solid @toolbar-border-color;
a {
a:not(.btn) {
display: inline-block;
color: @gray-light;
padding: 6px 12px 8px;
@ -60,4 +60,15 @@
}
}
}
&.toolbar-tall {
height: 48px;
a.btn {
margin-left: 12px;
}
a:not(.btn) {
padding-top: 10px;
margin-left: 4px;
}
}
}