Commit bdb5a09f authored by d11e9's avatar d11e9

cache editor resizing and use as default

parent 3ff5f355
...@@ -258,11 +258,10 @@ input[readonly] { ...@@ -258,11 +258,10 @@ input[readonly] {
// ----------------- resizeable ui --------------- // ----------------- resizeable ui ---------------
var EDITOR_SIZE_CACHE_KEY = "editor-size-cache";
var dragging = false; var dragging = false;
$('#dragbar').mousedown(function(e){ $('#dragbar').mousedown(function(e){
e.preventDefault(); e.preventDefault();
dragging = true; dragging = true;
var main = $('#righthand-panel'); var main = $('#righthand-panel');
var ghostbar = $('<div id="ghostbar">', { var ghostbar = $('<div id="ghostbar">', {
...@@ -279,18 +278,28 @@ input[readonly] { ...@@ -279,18 +278,28 @@ input[readonly] {
var $body = $('body'); var $body = $('body');
function setEditorSize (delta) {
$('#righthand-panel').css("width", delta);
$('#editor').css("right", delta);
}
$(document).mouseup(function(e){ $(document).mouseup(function(e){
if (dragging) { if (dragging) {
var delta = $body.width() - e.pageX+2; var delta = $body.width() - e.pageX+2;
$('#righthand-panel').css("width", delta); setEditorSize( delta )
$('#editor').css("right", delta);
$('#ghostbar').remove(); $('#ghostbar').remove();
$(document).unbind('mousemove'); $(document).unbind('mousemove');
dragging = false; dragging = false;
window.localStorage.setItem( EDITOR_SIZE_CACHE_KEY, delta );
onResize(); onResize();
} }
}); });
// set cached defaults
var cachedSize = window.localStorage.getItem( EDITOR_SIZE_CACHE_KEY );
if (cachedSize) {
setEditorSize( cachedSize )
}
// ----------------- editor ---------------------- // ----------------- editor ----------------------
......
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