3 Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
\r 
   4 For licensing, see LICENSE.md or http://ckeditor.com/license
\r 
   8         <meta charset="utf-8">
\r 
   9         <title>Editing source code in a dialog — CKEditor Sample</title>
\r 
  10         <script src="../../../ckeditor.js"></script>
\r 
  11         <link rel="stylesheet" href="../../../samples/old/sample.css">
\r 
  12         <meta name="ckeditor-sample-name" content="Editing source code in a dialog">
\r 
  13         <meta name="ckeditor-sample-group" content="Plugins">
\r 
  14         <meta name="ckeditor-sample-description" content="Editing HTML content of both inline and classic editor instances.">
\r 
  15         <meta name="ckeditor-sample-isnew" content="1">
\r 
  27         <h1 class="samples">
\r 
  28                 <a href="../../../samples/old/index.html">CKEditor Samples</a> » Editing source code in a dialog
\r 
  30         <div class="warning deprecated">
\r 
  31                 This sample is not maintained anymore. Check out its <a href="http://sdk.ckeditor.com/samples/sourcearea.html">brand new version in CKEditor SDK</a>.
\r 
  33         <div class="description">
\r 
  35                         <strong>Sourcedialog</strong> plugin provides an easy way to edit raw HTML content
\r 
  36                         of an editor, similarly to what is possible with <strong>Sourcearea</strong>
\r 
  37                         plugin for classic (<code>iframe</code>-based) instances but using dialogs. Thanks to that, it's also possible
\r 
  38                         to manipulate raw content of inline editor instances.
\r 
  41                         This plugin extends the toolbar with a button,
\r 
  42                         which opens a dialog window with a source code editor. It works with both classic
\r 
  43                         and inline instances. To enable this
\r 
  44                         plugin, basically add <code>extraPlugins: 'sourcedialog'</code> to editor's
\r 
  47 <pre class="samples">
\r 
  49 CKEDITOR.inline( 'editable', {
\r 
  50         <strong>extraPlugins: 'sourcedialog'</strong>
\r 
  53 // Classic (iframe-based) editor.
\r 
  54 CKEDITOR.replace( 'textarea_id', {
\r 
  55         <strong>extraPlugins: 'sourcedialog'</strong>,
\r 
  56         removePlugins: 'sourcearea'
\r 
  60                         Note that you may want to include <code>removePlugins: 'sourcearea'</code>
\r 
  61                         in your config when using <strong>Sourcedialog</strong> in classic editor instances.
\r 
  62                         This prevents feature redundancy.
\r 
  65                         Note that <code>editable</code> in the code above is the <code>id</code>
\r 
  66                         attribute of the <code><div></code> element to be converted into an inline instance.
\r 
  69                         Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
\r 
  70                         the <code><textarea></code> element to be replaced with CKEditor.
\r 
  74                 <label for="editor1">
\r 
  77                 <div id="editor1" contenteditable="true" style="padding: 5px 20px;">
\r 
  78                         <p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>
\r 
  83                 <label for="editor2">
\r 
  86                 <textarea cols="80" id="editor2" name="editor2" rows="10">
\r 
  87                         This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.
\r 
  92                 // We need to turn off the automatic editor creation first.
\r 
  93                 CKEDITOR.disableAutoInline = true;
\r 
  98                                 { name: 'basicstyles' },
\r 
 101                         extraPlugins: 'sourcedialog',
\r 
 102                         removePlugins: 'sourcearea'
\r 
 105                 CKEDITOR.inline( 'editor1', config );
\r 
 106                 CKEDITOR.replace( 'editor2', config );
\r 
 112                         CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">
\r 
 113                                 http://ckeditor.com</a>
\r 
 116                         Copyright © 2003-2017, <a class="samples" href="http://cksource.com/">CKSource</a>
\r 
 117                         - Frederico Knabben. All rights reserved.
\r