This commit is contained in:
rolux 2013-02-21 17:26:56 +05:30
parent 5d89f0d3a9
commit c6aa89f5b6

View file

@ -17,7 +17,7 @@ pandora.ui.textPanel = function() {
var text = result.data, var text = result.data,
embedsURLs = getEmbedsURLs(), embedURLs = getEmbedURLs(text.text),
$toolbar = Ox.Bar({size: 24}), $toolbar = Ox.Bar({size: 24}),
@ -95,6 +95,7 @@ pandora.ui.textPanel = function() {
orientation: 'horizontal' orientation: 'horizontal'
}); });
if (text.editable) {
if (text.type == 'html') { if (text.type == 'html') {
$editMenu = Ox.MenuButton({ $editMenu = Ox.MenuButton({
items: [ items: [
@ -122,6 +123,7 @@ pandora.ui.textPanel = function() {
}) })
.appendTo($toolbar); .appendTo($toolbar);
} }
}
that.setElement( that.setElement(
Ox.SplitPanel({ Ox.SplitPanel({
@ -175,10 +177,10 @@ pandora.ui.textHTML = function(text, tags) {
submit: function(data) { submit: function(data) {
Ox.Request.clearCache('getText'); Ox.Request.clearCache('getText');
pandora.api.editText({ pandora.api.editText({
id: ui.text, id: pandora.user.ui.text,
name: data.value name: data.value
}, function(result) { }, function(result) {
// ... Ox.print('RESULT.DATA:', result.data);
}); });
} }
}) })
@ -251,6 +253,8 @@ pandora.ui.textHTML = function(text, tags) {
return that; return that;
}; };
return that;
}; };
pandora.ui.textPDF = function(text) { pandora.ui.textPDF = function(text) {
@ -266,21 +270,25 @@ pandora.ui.textPDF = function(text) {
pandora.ui.textEmbed = function(url) { pandora.ui.textEmbed = function(url) {
var that = Ox.Element() var that = Ox.Element()
.css({padding: '16px'})
.html('No Embeds')
.bindEvent({ .bindEvent({
resizestart: function() { resizestart: function() {
url && $overlay.show(); url && $overlay.show();
}, },
resize: function(data) { resize: function(data) {
pandora.user.ui.embedSize = data.size; pandora.user.ui.embedSize = data.size;
pandora.$ui.text.updateSize(); pandora.$ui.text.update();
}, },
resizeend: function() { resizeend: function() {
url && $overlay.hide(); url && $overlay.hide();
} }
}), }),
$message = $('<div>')
.css({marginTop: '16px', textAlign: 'center'})
.html('No Embeds')
.hide()
.appendTo(that),
$iframe = $('<iframe>') $iframe = $('<iframe>')
.attr({ .attr({
height: '100%', height: '100%',
@ -289,7 +297,7 @@ pandora.ui.textEmbed = function(url) {
width: '100%' width: '100%'
}) })
.hide() .hide()
.appendTo($element), .appendTo(that),
$overlay = $('<div>') $overlay = $('<div>')
.css({ .css({
@ -300,13 +308,15 @@ pandora.ui.textEmbed = function(url) {
bottom: 0 bottom: 0
}) })
.hide() .hide()
.appendTo($element); .appendTo(that);
that.update = function(url) { that.update = function(url) {
if (url) { if (url) {
$message.hide();
$iframe.attr({src: url}).show(); $iframe.attr({src: url}).show();
} else { } else {
$iframe.hide(); $iframe.hide();
$message.show();
} }
return that; return that;
}; };