[gen] ckeditor now works with IE.

This commit is contained in:
Gaetan Delannay 2012-09-10 11:44:22 +02:00
parent c2eaab4b44
commit 6801188496
3 changed files with 17 additions and 10 deletions

View file

@ -968,16 +968,17 @@ class Type:
try: try:
return method(obj, self) return method(obj, self)
except Exception, e: except Exception, e:
obj.log(tb, type='error')
if raiseOnError: if raiseOnError:
# Raise the initial error. # Raise the initial error.
raise te raise te
else: else:
obj.log(tb, type='error')
return str(te) return str(te)
except Exception, e: except Exception, e:
if raiseOnError: raise e obj.log(Traceback.get(), type='error')
if raiseOnError:
raise e
else: else:
obj.log(Traceback.get(), type='error')
return str(e) return str(e)
def process(self, obj): def process(self, obj):
@ -1209,8 +1210,11 @@ class String(Type):
self.isSelect = self.isSelection() self.isSelect = self.isSelection()
# Default width, height and maxChars vary according to String format # Default width, height and maxChars vary according to String format
if width == None: if width == None:
if format == String.TEXT: self.width = 60 if format == String.TEXT: self.width = 60
else: self.width = 30 # This width corresponds to the standard width of an Appy page,
# minus the portlet.
if format == String.XHTML: self.width = 750
else: self.width = 30
if height == None: if height == None:
if format == String.TEXT: self.height = 5 if format == String.TEXT: self.height = 5
elif self.isSelect: self.height = 4 elif self.isSelect: self.height = 4

View file

@ -1576,13 +1576,16 @@ class BaseMixin:
# this field. # this field.
field = self.getAppyType(name) field = self.getAppyType(name)
ckAttrs = {'toolbar': field.richText and 'AppyRich' or 'Appy', ckAttrs = {'toolbar': field.richText and 'AppyRich' or 'Appy',
'format_tags': '%s' % ';'.join(field.styles)} 'format_tags': '%s' % ';'.join(field.styles),
'width': field.width}
if field.allowImageUpload: if field.allowImageUpload:
ckAttrs['filebrowserUploadUrl'] = '%s/upload' % self.absolute_url() ckAttrs['filebrowserUploadUrl'] = '%s/upload' % self.absolute_url()
ck = '' ck = []
for k, v in ckAttrs.iteritems(): for k, v in ckAttrs.iteritems():
ck += "%s: '%s'," % (k, v) if isinstance(v, int): sv = str(v)
res = "CKEDITOR.replace('%s', {%s})" % (name, ck) else: sv = '"%s"' % v
ck.append('%s: %s' % (k, sv))
res = 'CKEDITOR.replace("%s", {%s})' % (name, ', '.join(ck))
return res return res
def getCalendarInit(self, name, years): def getCalendarInit(self, name, years):

View file

@ -64,7 +64,7 @@
class python: (fmt==2) and ('rich_%s' % name) or ''" class python: (fmt==2) and ('rich_%s' % name) or ''"
tal:content="python: test(inRequest, requestValue, value)"> tal:content="python: test(inRequest, requestValue, value)">
</textarea> </textarea>
<script tal:condition="python: fmt == 2" <script type="text/javascript" tal:condition="python: fmt == 2"
tal:content="python: contextObj.getEditorInit(name)"> tal:content="python: contextObj.getEditorInit(name)">
</script> </script>
</tal:textarea> </tal:textarea>