[IMP] Ace: remember editor width when resizing
bzr revid: ddm@openerp.com-20131021091004-nchmsogl6349az8h
This commit is contained in:
@@ -608,7 +608,6 @@ table.editorbar-panel td.selected {
|
||||
right: 0;
|
||||
z-index: 1000;
|
||||
height: 100%;
|
||||
width: 720px;
|
||||
}
|
||||
.oe_ace_view_editor .oe_ace_view_editor_title {
|
||||
width: 100%;
|
||||
@@ -637,7 +636,6 @@ table.editorbar-panel td.selected {
|
||||
right: 0;
|
||||
bottom: 51px;
|
||||
left: 0;
|
||||
width: 720px;
|
||||
}
|
||||
.oe_ace_view_editor .ace_editor .ace_gutter {
|
||||
cursor: ew-resize;
|
||||
|
||||
@@ -466,7 +466,6 @@ $highlighted_text_color: #ffffff
|
||||
|
||||
/* ---- ACE EDITOR ---- */
|
||||
|
||||
$ace_width: 720px
|
||||
$editorbar_height: 30px
|
||||
// TODO Fix => might break with themes
|
||||
$navbar_height: 51px
|
||||
@@ -481,7 +480,6 @@ $navbar_height: 51px
|
||||
right: 0
|
||||
z-index: 1000
|
||||
height: 100%
|
||||
width: $ace_width
|
||||
.oe_ace_view_editor_title
|
||||
width: 100%
|
||||
padding-top: 0
|
||||
@@ -502,7 +500,6 @@ $navbar_height: 51px
|
||||
right: 0
|
||||
bottom: $navbar_height
|
||||
left: 0
|
||||
width: $ace_width
|
||||
.ace_gutter
|
||||
cursor: ew-resize
|
||||
&.oe_ace_open
|
||||
|
||||
@@ -100,6 +100,13 @@
|
||||
self.aceEditor.resize();
|
||||
self.$el.width(width);
|
||||
}
|
||||
function storeEditorWidth() {
|
||||
window.localStorage.setItem('ace_editor_width', self.$el.width());
|
||||
}
|
||||
function readEditorWidth() {
|
||||
var width = window.localStorage.getItem('ace_editor_width');
|
||||
return parseInt(width || 720, 10);
|
||||
}
|
||||
function startResizing (e) {
|
||||
self.refX = e.pageX;
|
||||
self.resizing = true;
|
||||
@@ -113,6 +120,7 @@
|
||||
var width = self.$el.width() - offset;
|
||||
self.refX = e.pageX;
|
||||
resizeEditor(width);
|
||||
storeEditorWidth();
|
||||
}
|
||||
}
|
||||
document.body.addEventListener('mouseup', stopResizing, true);
|
||||
@@ -121,6 +129,7 @@
|
||||
$('button[data-action=edit]').click(function () {
|
||||
self.close();
|
||||
});
|
||||
resizeEditor(readEditorWidth());
|
||||
},
|
||||
loadViews: function (views) {
|
||||
var self = this;
|
||||
|
||||
Reference in New Issue
Block a user