Move storage.editorSize to app.js

pull/1/head
Alex Beregszaszi 8 years ago
parent 35b3a43b16
commit 0eee795e40
  1. 15
      src/app.js
  2. 10
      src/app/storage.js

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

Loading…
Cancel
Save