Exemple #1
0
 def _showPreview(self):
     xhtmlDoc = self.getActiveContentEditor()._getContentEditControl().getXhtmlDocument()
     # Get the current blog selection from the UI control.
     if self.currentPreviewTemplate is not None:
         document = ZBlogPostEditorPreviewDocument(self.getTitle(), xhtmlDoc)
         templatedDoc = applyTemplateToDocument(self.currentPreviewTemplate, document, APPLY_TEMPLATE_MODE_FULL)
         if templatedDoc is not None:
             xhtmlDoc = templatedDoc
             disableTemplatePreviewJavaScript(xhtmlDoc)
     self.contentPreviewer.setXhtmlDocument(xhtmlDoc, False)
Exemple #2
0
 def refresh(self):
     self.templateList.refresh()
     self.statusBar.refresh()
     if self.selectedTemplate is not None:
         document = self.model.getSampleDocument()
         xhtmlDoc = applyTemplateToDocument(self.selectedTemplate, document, APPLY_TEMPLATE_MODE_FULL)
         disableTemplatePreviewJavaScript(xhtmlDoc)
     else:
         xhtmlDoc = loadXhtmlDocumentFromString(u"Select a template to view a preview of it.") #$NON-NLS-1$
     self.preview.setXhtmlDocument(xhtmlDoc, False)
    def _refreshContent(self):
        document = self.document

        # Clear content if no document is set.
        if document is None:
            self._clearHtmlContent()
            return

        content = document.getContent()
        if content is not None:
            xhtmlDoc = content.getXhtmlDocument()
            blog = getBlogFromDocument(document)
            if blog is not None and self.useTemplateInPreview:
                template = getTemplateFromBlog(blog)
                if template is not None:
                    templatedDoc = applyTemplateToDocument(template, document, APPLY_TEMPLATE_MODE_TITLE_AND_BODY)
                    if templatedDoc is not None:
                        xhtmlDoc = templatedDoc
                    disableTemplatePreviewJavaScript(xhtmlDoc)
                    self.htmlViewer.setXhtmlDocument(xhtmlDoc, False)
                    return

            self.htmlViewer.setXhtmlDocument( xhtmlDoc, True )
Exemple #4
0
    def _refreshContent(self):
        document = self.document

        # Clear content if no document is set.
        if document is None:
            self._clearHtmlContent()
            return

        content = document.getContent()
        if content is not None:
            xhtmlDoc = content.getXhtmlDocument()
            blog = getBlogFromDocument(document)
            if blog is not None and self.useTemplateInPreview:
                template = getTemplateFromBlog(blog)
                if template is not None:
                    templatedDoc = applyTemplateToDocument(
                        template, document, APPLY_TEMPLATE_MODE_TITLE_AND_BODY)
                    if templatedDoc is not None:
                        xhtmlDoc = templatedDoc
                    disableTemplatePreviewJavaScript(xhtmlDoc)
                    self.htmlViewer.setXhtmlDocument(xhtmlDoc, False)
                    return

            self.htmlViewer.setXhtmlDocument(xhtmlDoc, True)