Solved

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

Posted on 2013-05-21
3
352 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
href return to normal window 5 29
Popup write two lines 3 22
Accordion won't close correctly 5 13
How to show popup no matter what a user clicks on navigation wise 10 33
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

756 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