From 7c3576c59bfdbba44ba400d31540e3577ffe3ba0 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 24 Feb 2013 09:28:25 +0000 Subject: [PATCH] scrolling for long texts --- static/js/pandora/textPanel.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/static/js/pandora/textPanel.js b/static/js/pandora/textPanel.js index b6ae48e3c..f0ee8fb2a 100644 --- a/static/js/pandora/textPanel.js +++ b/static/js/pandora/textPanel.js @@ -213,7 +213,12 @@ pandora.ui.textHTML = function(text) { width = getWidth(), that = Ox.Element() - .css({margin: '16px'}), + .css({ + 'overflow-y': 'auto' + }), + $content = Ox.Element().css({ + margin: '16px', + }).appendTo(that), $title = Ox.Editable({ editable: text.editable, @@ -240,11 +245,11 @@ pandora.ui.textHTML = function(text) { }); } }) - .appendTo(that), + .appendTo($content), $spaceTop = Ox.Element() .css({height: '16px'}) - .appendTo(that), + .appendTo($content), $text = Ox.Editable({ clickLink: pandora.clickLink, @@ -267,8 +272,7 @@ pandora.ui.textHTML = function(text) { } ); }, - height: height, - maxHeight: Infinity, + maxHeight: height - 1, placeholder: text.editable ? 'Doubleclick to edit text' : '', tooltip: text.editable ? 'Doubleclick to edit text' : '', type: 'textarea', @@ -277,7 +281,7 @@ pandora.ui.textHTML = function(text) { }) .css({ //position: 'absolute', - height: height + 'px', + //height: height + 'px', width: width + 'px', //marginTop: '48px', fontSize: '12px' @@ -293,11 +297,12 @@ pandora.ui.textHTML = function(text) { pandora.$ui.textPanel.update(data.value); } }) - .appendTo(that); + .appendTo($content); function getHeight() { // 24 menu + 24 toolbar + 16 statusbar + 32 title + 32 margins - return window.innerHeight - 128; + // + 1px to ge trid of scrollbar + return window.innerHeight - 128 -1; } function getWidth() { @@ -309,7 +314,7 @@ pandora.ui.textHTML = function(text) { that.update = function() { $text.options({ - height: getHeight(), + maxHeight: getHeight(), width: getWidth() }); return that;