Skip to content

Commit

Permalink
Store editor window size in config file
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Jan 12, 2017
1 parent 86f84d5 commit d16a260
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ var run = function () {
// ----------------- resizeable ui ---------------

var EDITOR_SIZE_KEY = 'editor-size-cache'
var EDITOR_WINDOW_SIZE = 'editorWindowSize'

var dragging = false
$('#dragbar').mousedown(function (e) {
Expand Down Expand Up @@ -407,23 +408,31 @@ var run = function () {
$(document).unbind('mousemove')
dragging = false
setEditorSize(delta)
storage.set(EDITOR_SIZE_KEY, delta)
config.set(EDITOR_WINDOW_SIZE, delta)
reAdjust()
}
})

// convert old browser-solidity
if (storage.exists(EDITOR_SIZE_KEY)) {
setEditorSize(storage.get(EDITOR_SIZE_KEY))
if (!config.exists(EDITOR_WINDOW_SIZE)) {
config.set(EDITOR_WINDOW_SIZE, storage.get(EDITOR_SIZE_KEY))
}
storage.remove(EDITOR_SIZE_KEY)
}

if (config.exists(EDITOR_WINDOW_SIZE)) {
setEditorSize(config.get(EDITOR_WINDOW_SIZE))
} else {
storage.set(EDITOR_SIZE_KEY, getEditorSize())
config.set(EDITOR_WINDOW_SIZE, getEditorSize())
}

// ----------------- toggle right hand panel -----------------

var hidingRHP = false
$('.toggleRHP').click(function () {
hidingRHP = !hidingRHP
setEditorSize(hidingRHP ? 0 : storage.get(EDITOR_SIZE_KEY))
setEditorSize(hidingRHP ? 0 : config.get(EDITOR_WINDOW_SIZE))
$('.toggleRHP i').toggleClass('fa-angle-double-right', !hidingRHP)
$('.toggleRHP i').toggleClass('fa-angle-double-left', hidingRHP)
})
Expand Down

0 comments on commit d16a260

Please sign in to comment.