Permalink
Browse files

Fixed content_css when the Plone Site id is 'plone'.

This is used to display the text during editing in the same layout as
it appears when viewing.
Fixes #11430

svn path=/Products.TinyMCE/trunk/; revision=246336
  • Loading branch information...
1 parent b4bf11d commit 81459608b355d7ccf30651f0ea9487e01ec92358 @mauritsvanrees mauritsvanrees committed Nov 15, 2011
Showing with 20 additions and 7 deletions.
  1. +6 −0 CHANGES.txt
  2. +14 −7 Products/TinyMCE/utility.py
View
6 CHANGES.txt
@@ -5,6 +5,12 @@ HISTORY
1.2.9 (unreleased)
------------------
+- Fixed content_css when the Plone Site id is 'plone'. This is used
+ to display the text during editing in the same layout as it appears
+ when viewing.
+ Fixes http://dev.plone.org/plone/ticket/11430
+ [maurits]
+
- Add value attributes to Insert and Cancel input tags for the ploneimage popup
template. When Chameleon is installed attributes that don't already exist on
a tag don't get translated.
View
21 Products/TinyMCE/utility.py
@@ -5,6 +5,11 @@
import simplejson as json
from types import StringTypes
from zope.component import getUtility, queryUtility
+try:
+ from zope.component.hooks import getSite
+ getSite #Pyflakes
+except ImportError:
+ from zope.app.component.hooks import getSite
from zope.i18n import translate
from zope.i18nmessageid import MessageFactory
from zope.interface import classProvides
@@ -20,7 +25,6 @@
from Products.Archetypes.interfaces.field import IImageField
from Products.CMFCore.interfaces._content import IFolderish
from Products.CMFCore.utils import getToolByName
-from Products.CMFCore.interfaces import ISiteRoot
try:
from plone.app.layout.globals.portal import RIGHT_TO_LEFT
except ImportError:
@@ -750,10 +754,18 @@ def getConfiguration(self, context=None, field=None, request=None):
else:
results['contextmenu'] = False
+ portal = getSite()
+ results['portal_url'] = aq_inner(portal).absolute_url()
+ nav_root = getNavigationRootObject(context, portal)
+ results['navigation_root_url'] = nav_root.absolute_url()
+
if self.content_css and self.content_css.strip() != "":
results['content_css'] = self.content_css
else:
- results['content_css'] = self.absolute_url() + """/@@tinymce-getstyle"""
+ results['content_css'] = '/'.join([
+ results['portal_url'],
+ self.getId(),
+ "@@tinymce-getstyle"])
if self.link_using_uids:
results['link_using_uids'] = True
@@ -776,11 +788,6 @@ def getConfiguration(self, context=None, field=None, request=None):
results['entity_encoding'] = self.entity_encoding
- portal = getUtility(ISiteRoot)
- results['portal_url'] = aq_inner(portal).absolute_url()
- nav_root = getNavigationRootObject(context, portal)
- results['navigation_root_url'] = nav_root.absolute_url()
-
props = getToolByName(self, 'portal_properties')
livesearch = props.site_properties.getProperty('enable_livesearch', False)
if livesearch:

0 comments on commit 8145960

Please sign in to comment.