mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
25 lines
No EOL
571 B
CoffeeScript
25 lines
No EOL
571 B
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.directive "layout", () ->
|
|
return {
|
|
link: (scope, element, attrs) ->
|
|
name = attrs.layout
|
|
|
|
options =
|
|
spacing_open: 24
|
|
spacing_closed: 24
|
|
onresize: () =>
|
|
scope.$broadcast "layout:#{name}:resize"
|
|
|
|
# Restore previously recorded state
|
|
if (state = $.localStorage("layout.main"))?
|
|
options.west = state.west
|
|
options.east = state.east
|
|
|
|
$(element).layout options
|
|
|
|
# Save state when exiting
|
|
$(window).unload () ->
|
|
$.localStorage("layout.#{name}", element.layout().readState())
|
|
} |