Commit 21f3c2c6 authored by chriseth's avatar chriseth Committed by GitHub

Merge pull request #372 from ethereum/editor-size

Move storage.editorSize to app.js
parents 35b3a43b 0eee795e
......@@ -335,6 +335,8 @@ var run = function () {
// ----------------- resizeable ui ---------------
var EDITOR_SIZE_KEY = 'editor-size-cache'
var dragging = false
$('#dragbar').mousedown(function (e) {
e.preventDefault()
......@@ -361,7 +363,7 @@ var run = function () {
}
function getEditorSize () {
storage.setEditorSize($('#righthand-panel').width())
return $('#righthand-panel').width()
}
$(document).mouseup(function (e) {
......@@ -371,15 +373,16 @@ var run = function () {
$(document).unbind('mousemove')
dragging = false
setEditorSize(delta)
storage.setEditorSize(delta)
storage.set(EDITOR_SIZE_KEY, delta)
reAdjust()
}
})
// set cached defaults
var cachedSize = storage.getEditorSize()
if (cachedSize) setEditorSize(cachedSize)
else getEditorSize()
if (storage.exists(EDITOR_SIZE_KEY)) {
setEditorSize(storage.get(EDITOR_SIZE_KEY))
} else {
storage.set(EDITOR_SIZE_KEY, getEditorSize())
}
// ----------------- toggle right hand panel -----------------
......
......@@ -4,8 +4,6 @@
var utils = require('./utils')
function Storage (updateFiles) {
var EDITOR_SIZE_CACHE_KEY = 'editor-size-cache'
this.rename = function (originalName, newName) {
var content = this.get(originalName)
this.set(newName, content)
......@@ -16,14 +14,6 @@ function Storage (updateFiles) {
window.localStorage.removeItem(name)
}
this.setEditorSize = function (size) {
this.set(EDITOR_SIZE_CACHE_KEY, size)
}
this.getEditorSize = function () {
return this.get(EDITOR_SIZE_CACHE_KEY)
}
this.getFileContent = function (key) {
return this.get(utils.fileKey(key))
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment