scrolling for long texts

This commit is contained in:
j 2013-02-24 09:28:25 +00:00
parent 9a26a72a73
commit 7c3576c59b

View file

@ -213,7 +213,12 @@ pandora.ui.textHTML = function(text) {
width = getWidth(), width = getWidth(),
that = Ox.Element() that = Ox.Element()
.css({margin: '16px'}), .css({
'overflow-y': 'auto'
}),
$content = Ox.Element().css({
margin: '16px',
}).appendTo(that),
$title = Ox.Editable({ $title = Ox.Editable({
editable: text.editable, editable: text.editable,
@ -240,11 +245,11 @@ pandora.ui.textHTML = function(text) {
}); });
} }
}) })
.appendTo(that), .appendTo($content),
$spaceTop = Ox.Element() $spaceTop = Ox.Element()
.css({height: '16px'}) .css({height: '16px'})
.appendTo(that), .appendTo($content),
$text = Ox.Editable({ $text = Ox.Editable({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
@ -267,8 +272,7 @@ pandora.ui.textHTML = function(text) {
} }
); );
}, },
height: height, maxHeight: height - 1,
maxHeight: Infinity,
placeholder: text.editable ? 'Doubleclick to edit text' : '', placeholder: text.editable ? 'Doubleclick to edit text' : '',
tooltip: text.editable ? 'Doubleclick to edit text' : '', tooltip: text.editable ? 'Doubleclick to edit text' : '',
type: 'textarea', type: 'textarea',
@ -277,7 +281,7 @@ pandora.ui.textHTML = function(text) {
}) })
.css({ .css({
//position: 'absolute', //position: 'absolute',
height: height + 'px', //height: height + 'px',
width: width + 'px', width: width + 'px',
//marginTop: '48px', //marginTop: '48px',
fontSize: '12px' fontSize: '12px'
@ -293,11 +297,12 @@ pandora.ui.textHTML = function(text) {
pandora.$ui.textPanel.update(data.value); pandora.$ui.textPanel.update(data.value);
} }
}) })
.appendTo(that); .appendTo($content);
function getHeight() { function getHeight() {
// 24 menu + 24 toolbar + 16 statusbar + 32 title + 32 margins // 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() { function getWidth() {
@ -309,7 +314,7 @@ pandora.ui.textHTML = function(text) {
that.update = function() { that.update = function() {
$text.options({ $text.options({
height: getHeight(), maxHeight: getHeight(),
width: getWidth() width: getWidth()
}); });
return that; return that;