I discovered that the toolbars don't automatically wrap in WebKit browswers (Safari, Chrome). There is a three year old bug reported for CKEditor 3, but it was closed. Maybe this is a regression?
I'm not setting a width in my configuration. I want the editor to expand to the available width automatically. The editor is inside a div
element that has the overflow: hidden;
style applied to it.
Here's my toolbar configuration:
config.toolbar = [
{name:'clipboard', items:['Cut', 'Copy', 'Paste', 'PasteText',
'-', 'Undo', 'Redo']},
{name:'insert', items:['Link', 'Unlink', 'Image', 'Table', 'SpecialChar']},
{name:'basic', items:['Bold', 'Italic', 'Strike',
'-', 'NumberedList', 'BulletedList',
'-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock',
'-', 'Outdent', 'Indent',
'-', 'RemoveFormat']},
{name:'styles', items:['Styles']},
{name:'additional', items:['jQuerySpellChecker',
'-', 'Source',
'-', 'Maximize']}
];
Firefox:
Chrome (cuts off editor because of the container):
I don't want to add hard breaks, because I use the same editor configuration at varying widths. How do I resolve this without using manual wrap "buttons"?
UPDATE
I use fieldset
elements in my forms. I found that adding the fieldset
is what triggers the layout issue. This code reproduces the issue:
<!DOCTYPE html>
<html>
<head>
<title>CKEditor</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html {
background-color: lightgray;
}
#content {
margin: 0 auto;
border: 1px solid black;
padding: 10px;
width: 400px;
overflow: hidden;
background-color: white;
}
fieldset {
margin: 0;
border: 0 none;
padding: 0;
}
</style>
</head>
<body>
<div id="content">
<fieldset>
<textarea name="editor1" id="editor1"><p>Foo foo!</p></textarea>
</fieldset>
</div>
<script type="text/javascript" src="http://ckeditor.com/apps/ckeditor/4.0.1/ckeditor.js"></script>
<script>
CKEDITOR.replace('editor1');
</script>
</body>
</html>
UPDATE 2
I have filed a bug report. I will accept an answer that provides a work-around for this bug.