fix html documents preview in dialog
This commit is contained in:
parent
230275e4d8
commit
c64b13537b
2 changed files with 19 additions and 7 deletions
|
@ -201,8 +201,7 @@ pandora.ui.documentDialog = function(options) {
|
||||||
zoom: 'fit'
|
zoom: 'fit'
|
||||||
})
|
})
|
||||||
: item.extension == 'html'
|
: item.extension == 'html'
|
||||||
? pandora.ui.textPanel(item).css({
|
? pandora.$ui.textPanel = pandora.ui.textPanel(item)
|
||||||
})
|
|
||||||
: Ox.ImageViewer({
|
: Ox.ImageViewer({
|
||||||
area: pandora.user.ui.documents[item.id]
|
area: pandora.user.ui.documents[item.id]
|
||||||
? pandora.user.ui.documents[item.id].position
|
? pandora.user.ui.documents[item.id].position
|
||||||
|
@ -243,7 +242,7 @@ pandora.ui.documentDialog = function(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTitle() {
|
function setTitle() {
|
||||||
that.options({title: item.title + '.' + item.extension});
|
that.options({title: item.title + (item.extension == 'html' ? '' : '.' + item.extension)});
|
||||||
}
|
}
|
||||||
|
|
||||||
that.getItems = function() {
|
that.getItems = function() {
|
||||||
|
|
|
@ -1,16 +1,30 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
pandora.ui.textPanel = function(text, $toolbar) {
|
pandora.ui.textPanel = function(text, $toolbar) {
|
||||||
|
if (Ox.isUndefined(text.text)) {
|
||||||
|
var that = Ox.Element().append(Ox.LoadingScreen().start())
|
||||||
|
pandora.api.getDocument({
|
||||||
|
id: text.id,
|
||||||
|
keys: ['text']
|
||||||
|
}, function(result) {
|
||||||
|
text.text = result.data.text
|
||||||
|
if (text.text) {
|
||||||
|
pandora.$ui.textPanel.replaceWith(pandora.$ui.textPanel = pandora.ui.textPanel(text, $toolbar))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return that;
|
||||||
|
}
|
||||||
|
|
||||||
var textElement,
|
var textElement,
|
||||||
textEmbed,
|
textEmbed,
|
||||||
embedURLs = getEmbedURLs(text.text),
|
embedURLs = getEmbedURLs(text.text),
|
||||||
that = Ox.SplitPanel({
|
that = Ox.SplitPanel({
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
element: textElement = pandora.$ui.textElement = pandora.ui.textHTML(text)
|
element: textElement = pandora.ui.textHTML(text)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: textEmbed = pandora.ui.textEmbed(textElement),
|
element: textEmbed = pandora.ui.textEmbed(),
|
||||||
collapsed: !embedURLs.length,
|
collapsed: !embedURLs.length,
|
||||||
size: pandora.user.ui.embedSize,
|
size: pandora.user.ui.embedSize,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -124,7 +138,6 @@ pandora.ui.textPanel = function(text, $toolbar) {
|
||||||
0),
|
0),
|
||||||
position = 100 * scrollTop / Math.max(1, textElement[0].scrollHeight);
|
position = 100 * scrollTop / Math.max(1, textElement[0].scrollHeight);
|
||||||
textElement.scrollTo(position);
|
textElement.scrollTo(position);
|
||||||
window.text = textElement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
that.selectEmbed = function(index, scroll) {
|
that.selectEmbed = function(index, scroll) {
|
||||||
|
@ -431,7 +444,7 @@ pandora.ui.textHTML = function(text) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.ui.textEmbed = function(textElement) {
|
pandora.ui.textEmbed = function(textEmbed) {
|
||||||
|
|
||||||
var that = Ox.Element()
|
var that = Ox.Element()
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
|
|
Loading…
Reference in a new issue