fix html documents preview in dialog

This commit is contained in:
j 2020-01-19 12:48:03 +01:00
parent 230275e4d8
commit c64b13537b
2 changed files with 19 additions and 7 deletions

View File

@ -201,8 +201,7 @@ pandora.ui.documentDialog = function(options) {
zoom: 'fit'
})
: item.extension == 'html'
? pandora.ui.textPanel(item).css({
})
? pandora.$ui.textPanel = pandora.ui.textPanel(item)
: Ox.ImageViewer({
area: pandora.user.ui.documents[item.id]
? pandora.user.ui.documents[item.id].position
@ -243,7 +242,7 @@ pandora.ui.documentDialog = function(options) {
}
function setTitle() {
that.options({title: item.title + '.' + item.extension});
that.options({title: item.title + (item.extension == 'html' ? '' : '.' + item.extension)});
}
that.getItems = function() {

View File

@ -1,16 +1,30 @@
'use strict';
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,
textEmbed,
embedURLs = getEmbedURLs(text.text),
that = Ox.SplitPanel({
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,
size: pandora.user.ui.embedSize,
resizable: true,
@ -124,7 +138,6 @@ pandora.ui.textPanel = function(text, $toolbar) {
0),
position = 100 * scrollTop / Math.max(1, textElement[0].scrollHeight);
textElement.scrollTo(position);
window.text = textElement;
}
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()
.bindEvent({