Solved

Need 2 text areas using CKEDITOR on same page to have diffrent widths?

Posted on 2013-05-21
3
356 Views
Last Modified: 2013-05-21
Hi,
I have 2 text area on my page using CKEDITOR and need different widths for both, but it appears that both get resized to the same value and in this case using the last value specified of CKEDITOR.config.width ='300px';

Is there a way to specify a diffrent size?

Thanks.
<textarea id="content" name="content"><?php echo $content; ?></textarea>
                     
<script>

CKEDITOR.replace( 'content' );
CKEDITOR.config.width ='800px';
CKEDITOR.config.height='500px';
CKEDITOR.config.skin = 'moonocolor';

</script>                     


<textarea id="content2" name="content2"><?php echo $content2; ?></textarea>
                     
<script>

CKEDITOR.replace( 'content2' );
CKEDITOR.config.width ='300px';
CKEDITOR.config.height='500px';
CKEDITOR.config.skin = 'moonocolor';

</script>                     

Open in new window

0
Comment
Question by:sabecs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39184219
0
 
LVL 7

Accepted Solution

by:
Robert Saylor earned 500 total points
ID: 39184241
Give this a try. I have a page "php" that uses two CKeditor boxes and both have different sizes.

   <textarea id="editor2" name="editor2" rows="10" cols="80"></textarea>
      <script type="text/javascript">
// This is a check for the CKEditor class. If not defined, the paths must be checked.
if ( typeof CKEDITOR == 'undefined' )
{
   document.write(
      '<strong><span style="color: #ff0000">Error</span>: CKEditor not found</strong>.' +
      'This sample assumes that CKEditor (not included with CKFinder) is installed in' +
      'the "/ckeditor/" path. If you have it installed in a different place, just edit' +
      'this file, changing the wrong paths in the &lt;head&gt; (line 5) and the "BasePath"' +
      'value (line 32).' ) ;
}
else
{
   var editor2 = CKEDITOR.replace( 'editor2',
      {

         width: '275px',
         height: '400px',
         toolbar :
            [
               [ 'Source','Preview' ],
               [ 'Bold', 'Italic','Underline','Strike','RemoveFormat', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'Anchor' ],
               [ 'Image','Table','HorizontalRule','SpecialChar','PageBreak'],
               [ 'Styles','Format','Font','FontSize' ],
               [ 'TextColor','BGColor' ],
               [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo','-','Outdent','Indent','Blockquote','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','BidiLtr','BidiRtl' ]
            ]
      });

   editor2.setData( '<?=$sValue2?>' );
   // Just call CKFinder.SetupCKEditor and pass the CKEditor instance as the first argument.
   // The second parameter (optional), is the path for the CKFinder installation (default = "/ckfinder/").
   CKFinder.setupCKEditor( editor2, 'ckfinder/' ) ;
   // It is also possible to pass an object with selected CKFinder properties as a second argument.
   // CKFinder.SetupCKEditor( editor, { BasePath : '../../', RememberLastFolder : false } ) ;
}
      </script>

Open in new window

0
 

Author Closing Comment

by:sabecs
ID: 39184276
Thanks, that did the trick.

CKEDITOR.replace( 'content2',{ width: '275px', height: '400px' });
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question