Opened 15 years ago
Closed 12 years ago
#5342 closed Bug (fixed)
Editor always at least 300px wide on Webkit
Reported by: | Mikko Kinnunen | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 3.0 |
Keywords: | WebKit HasPatch | Cc: |
Description
Webkit-based browsers refuse to create editors less than 300 pixels wide. Following code creates 300px wide editor, even though 150 is specified for all width options. Testcode was made against 2nd example in /_samples/replacebycode.html
CKEDITOR.config.toolbar_Mini = [ ['Bold','Italic','RemoveFormat'] ]; CKEDITOR.replace( 'editor2', { width: 150, resize_maxWidth: 150, resize_minWidth: 150, skin: 'v2', toolbar: 'Mini' } );
Happens on Safari 4.0.3 (Windows) / Chrome 4.1.249.1036 (Windows)
Attachments (1)
Change History (9)
comment:1 Changed 15 years ago by
Version: | 3.2 → 3.3 |
---|
comment:2 Changed 15 years ago by
Version: | 3.3 → 3.2 |
---|
comment:3 Changed 15 years ago by
Someone came up with a workaround in the forums:
http://cksource.com/forums/viewtopic.php?p=48574#p48574
Worked for me, would be nice to have it included in core.
comment:4 Changed 15 years ago by
Keywords: | WebKit HasPatch added |
---|
comment:5 Changed 14 years ago by
Just adding a note that this bug reappears after setData(..)
- Setup 'instanceReady' fix described in the forum post
- Create editor normally with
CKEDITOR.replace(...)
- Fix works and you get an editor the size you requested
- Change text in editor with
editor_instance.setData('<p>Hello</p>');
- Editor changes text and grows to be 300px wide
Changed 14 years ago by
comment:6 Changed 13 years ago by
Status: | new → confirmed |
---|---|
Version: | 3.2 → 3.0 |
Reproducible in Webkit from CKEditor 3.0.
Workaround based on original forum post, extended to handle also setData problem:
CKEDITOR.config.toolbar_Mini = [ ['Bold','Italic','RemoveFormat'] ]; CKEDITOR.replace( 'editor2', { width: 150, resize_maxWidth: 150, resize_minWidth: 150, skin: 'kama', toolbar: 'Mini' } ); CKEDITOR.on('instanceReady', function (evt) { //editor var editor = evt.editor; resizeEditorWebkit( editor ); editor.on('afterSetData', function(event){ resizeEditorWebkit( event.editor ); }); }); function resizeEditorWebkit( editor ) { //webkit not redraw iframe correctly when editor's width is < 310px (300px iframe + 10px paddings) if (CKEDITOR.env.webkit && parseInt(editor.config.width) < 310) { var iframe = document.getElementById('cke_contents_' + editor.name).firstChild; iframe.style.display = 'none'; iframe.style.display = 'block'; } }
All you have to do is insert this code in E.g. replacebycode sample (second editor).
Can be tested by adding button:
<input type="button" value="click" onclick="CKEDITOR.instances['editor2'].insertHtml('<p>myTest</p>');" />
comment:7 Changed 13 years ago by
This workaround works well for us, even though you can see resized for a second it works and in the end that's what we need. Thanks!
comment:8 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | confirmed → closed |
Expired. Now everything works correctly.
Problem still present in CKE 3.3 & Chrome 5