Procházet zdrojové kódy

Get layout and resize logic working for PDF view

James Allen před 12 roky
rodič
revize
845c4a7297

+ 27 - 18
services/web/app/views/project/editor/editor.jade

@@ -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

+ 12 - 0
services/web/app/views/project/editor/pdf.jade

@@ -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

+ 2 - 1
services/web/app/views/project/editor/track-changes.jade

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

+ 9 - 3
services/web/public/coffee/app/ide/directives/layout.coffee

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

+ 4 - 7
services/web/public/coffee/app/ide/editor/directives/aceEditor.coffee

@@ -58,13 +58,10 @@ define [
 				editor.commands.removeCommand "showSettingsMenu"
 				editor.commands.removeCommand "showSettingsMenu"
 				editor.commands.removeCommand "foldall"
 				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", () ->
 				editor.on "changeSelection", () ->
 					cursor = editor.getCursorPosition()
 					cursor = editor.getCursorPosition()

+ 12 - 1
services/web/public/stylesheets/app/editor/toolbar.less

@@ -2,7 +2,7 @@
 	height: 40px;
 	height: 40px;
 	border-bottom: 1px solid @toolbar-border-color;
 	border-bottom: 1px solid @toolbar-border-color;
 
 
-	a {
+	a:not(.btn) {
 		display: inline-block;
 		display: inline-block;
 		color: @gray-light;
 		color: @gray-light;
 		padding: 6px 12px 8px;
 		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;
+		}
+	}
 }
 }