ckeditor/samples/toolbarconfigurator/index.html
author indvd00m (gotoindvdum[at]gmail[dot]com)
Thu, 15 Dec 2016 18:10:20 +0300
changeset 0 44d330dccc59
permissions -rw-r--r--
Init sample
indvd00m@0
     1
<!DOCTYPE html>
indvd00m@0
     2
<!--
indvd00m@0
     3
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
indvd00m@0
     4
For licensing, see LICENSE.md or http://ckeditor.com/license
indvd00m@0
     5
-->
indvd00m@0
     6
<!--[if IE 8]><html class="ie8"><![endif]-->
indvd00m@0
     7
<!--[if gt IE 8]><html><![endif]-->
indvd00m@0
     8
<!--[if !IE]><!--><html><!--<![endif]-->
indvd00m@0
     9
<head>
indvd00m@0
    10
	<meta charset="utf-8">
indvd00m@0
    11
	<title>Toolbar Configurator</title>
indvd00m@0
    12
	<script src="../../ckeditor.js"></script>
indvd00m@0
    13
	<script>
indvd00m@0
    14
		if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
indvd00m@0
    15
			CKEDITOR.tools.enableHtml5Elements( document );
indvd00m@0
    16
	</script>
indvd00m@0
    17
	<link rel="stylesheet" href="lib/codemirror/codemirror.css">
indvd00m@0
    18
	<link rel="stylesheet" href="lib/codemirror/show-hint.css">
indvd00m@0
    19
	<link rel="stylesheet" href="lib/codemirror/neo.css">
indvd00m@0
    20
	<link rel="stylesheet" href="css/fontello.css">
indvd00m@0
    21
	<link rel="stylesheet" href="../css/samples.css">
indvd00m@0
    22
</head>
indvd00m@0
    23
<body id="toolbar">
indvd00m@0
    24
indvd00m@0
    25
<nav class="navigation-a">
indvd00m@0
    26
	<div class="grid-container">
indvd00m@0
    27
		<ul class="navigation-a-left grid-width-70">
indvd00m@0
    28
			<li><a href="http://ckeditor.com">Project Homepage</a></li>
indvd00m@0
    29
			<li><a href="http://dev.ckeditor.com/">I found a bug</a></li>
indvd00m@0
    30
			<li><a href="http://github.com/ckeditor/ckeditor-dev" class="icon-pos-right icon-navigation-a-github">Fork CKEditor on GitHub</a></li>
indvd00m@0
    31
		</ul>
indvd00m@0
    32
		<ul class="navigation-a-right grid-width-30">
indvd00m@0
    33
			<li><a href="http://ckeditor.com/blog-list">CKEditor Blog</a></li>
indvd00m@0
    34
		</ul>
indvd00m@0
    35
	</div>
indvd00m@0
    36
</nav>
indvd00m@0
    37
indvd00m@0
    38
<header class="header-a">
indvd00m@0
    39
	<div class="grid-container">
indvd00m@0
    40
		<h1 class="header-a-logo grid-width-30">
indvd00m@0
    41
			<a href="../index.html"><img src="../img/logo.png" alt="CKEditor Logo"></a>
indvd00m@0
    42
		</h1>
indvd00m@0
    43
		<nav class="navigation-b grid-width-70">
indvd00m@0
    44
			<ul>
indvd00m@0
    45
				<li><a href="../index.html"  class="button-a">Start</a></li>
indvd00m@0
    46
				<li><a href="index.html"  class="button-a button-a-background">Toolbar configurator</a></li>
indvd00m@0
    47
			</ul>
indvd00m@0
    48
		</nav>
indvd00m@0
    49
	</div>
indvd00m@0
    50
</header>
indvd00m@0
    51
indvd00m@0
    52
<main>
indvd00m@0
    53
	<div class="adjoined-top">
indvd00m@0
    54
		<div class="grid-container">
indvd00m@0
    55
			<div class="content grid-width-100">
indvd00m@0
    56
				<div class="grid-container-nested">
indvd00m@0
    57
					<h1 class="grid-width-60">
indvd00m@0
    58
						Toolbar Configurator
indvd00m@0
    59
						<a href="#help-content" type="button" title="Configurator help" id="help" class="button-a button-a-background button-a-no-text icon-pos-left icon-question-mark">Help</a>
indvd00m@0
    60
					</h1>
indvd00m@0
    61
indvd00m@0
    62
					<div class="grid-width-40 grid-switch-magic">
indvd00m@0
    63
						<div class="switch">
indvd00m@0
    64
							<span class="balloon-a balloon-a-se">Select configurator type</span>
indvd00m@0
    65
							<input type="radio" name="radio" data-num="1" id="radio-basic" />
indvd00m@0
    66
							<input type="radio" name="radio" data-num="2" id="radio-advanced" />
indvd00m@0
    67
							<label data-for="1" for="radio-basic">Basic</label>
indvd00m@0
    68
							<span class="switch-inner">
indvd00m@0
    69
								<span class="handler"></span>
indvd00m@0
    70
							</span>
indvd00m@0
    71
							<label data-for="2" for="radio-advanced">Advanced</label>
indvd00m@0
    72
						</div>
indvd00m@0
    73
					</div>
indvd00m@0
    74
				</div>
indvd00m@0
    75
			</div>
indvd00m@0
    76
		</div>
indvd00m@0
    77
	</div>
indvd00m@0
    78
	<div class="adjoined-bottom">
indvd00m@0
    79
		<div class="grid-container">
indvd00m@0
    80
			<div class="grid-width-100">
indvd00m@0
    81
				<div class="editors-container">
indvd00m@0
    82
					<div id="editor-basic"></div>
indvd00m@0
    83
					<div id="editor-advanced"></div>
indvd00m@0
    84
				</div>
indvd00m@0
    85
			</div>
indvd00m@0
    86
		</div>
indvd00m@0
    87
	</div>
indvd00m@0
    88
indvd00m@0
    89
	<div class="grid-container configurator">
indvd00m@0
    90
		<div class="content grid-width-100">
indvd00m@0
    91
			<div class="configurator">
indvd00m@0
    92
				<div>
indvd00m@0
    93
					<div id="toolbarModifierWrapper"></div>
indvd00m@0
    94
				</div>
indvd00m@0
    95
			</div>
indvd00m@0
    96
		</div>
indvd00m@0
    97
	</div>
indvd00m@0
    98
indvd00m@0
    99
	<div id="help-content">
indvd00m@0
   100
		<div class="grid-container">
indvd00m@0
   101
			<div class="grid-width-100">
indvd00m@0
   102
				<h2>What Am I Doing Here?</h2>
indvd00m@0
   103
indvd00m@0
   104
				<div class="grid-container grid-container-nested">
indvd00m@0
   105
					<div class="basic">
indvd00m@0
   106
						<div class="grid-width-50">
indvd00m@0
   107
							<p>Arrange <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbarGroups">toolbar groups</a>, toggle <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-removeButtons">button visibility</a> according to your needs and get your toolbar configuration.</p>
indvd00m@0
   108
							<p>You can replace the content of the <a href="../../config.js"><code>config.js</code></a> file with the generated configuration. If you already set some configuration options you will need to merge both configurations.</p>
indvd00m@0
   109
						</div>
indvd00m@0
   110
						<div class="grid-width-50">
indvd00m@0
   111
							<p>Read more about different ways of <a href="http://docs.ckeditor.com/#!/guide/dev_configuration">setting configuration</a> and do not forget about <strong>clearing browser cache</strong>.</p>
indvd00m@0
   112
							<p>Arranging toolbar groups is the recommended way of configuring the toolbar, but if you need more freedom you can use the <a href="#advanced">advanced configurator</a>.</p>
indvd00m@0
   113
						</div>
indvd00m@0
   114
					</div>
indvd00m@0
   115
					<div class="advanced" style="display: none;">
indvd00m@0
   116
						<div class="grid-width-50">
indvd00m@0
   117
							<p>With this code editor you can edit your <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbar">toolbar configuration</a> live.</p>
indvd00m@0
   118
							<p>You can replace the content of the <a href="../../config.js"><code>config.js</code></a> file with the generated configuration. If you already set some configuration options you will need to merge both configurations.</p>
indvd00m@0
   119
						</div>
indvd00m@0
   120
						<div class="grid-width-50">
indvd00m@0
   121
							<p>Read more about different ways of <a href="http://docs.ckeditor.com/#!/guide/dev_configuration">setting configuration</a> and do not forget about <strong>clearing browser cache</strong>.</p>
indvd00m@0
   122
						</div>
indvd00m@0
   123
					</div>
indvd00m@0
   124
				</div>
indvd00m@0
   125
indvd00m@0
   126
				<p class="grid-container grid-container-nested">
indvd00m@0
   127
					<button type="button" class="help-content-close grid-width-100 button-a button-a-background">Got it. Let's play!</button>
indvd00m@0
   128
				</p>
indvd00m@0
   129
			</div>
indvd00m@0
   130
		</div>
indvd00m@0
   131
	</div>
indvd00m@0
   132
</main>
indvd00m@0
   133
indvd00m@0
   134
<footer class="footer-a grid-container">
indvd00m@0
   135
	<p class="grid-width-100">
indvd00m@0
   136
		CKEditor &ndash; The text editor for the Internet &ndash; <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
indvd00m@0
   137
	</p>
indvd00m@0
   138
	<p class="grid-width-100" id="copy">
indvd00m@0
   139
		Copyright &copy; 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> &ndash; Frederico Knabben. All rights reserved.
indvd00m@0
   140
	</p>
indvd00m@0
   141
</footer>
indvd00m@0
   142
indvd00m@0
   143
<script src="lib/codemirror/codemirror.js"></script>
indvd00m@0
   144
<script src="lib/codemirror/javascript.js"></script>
indvd00m@0
   145
<script src="lib/codemirror/show-hint.js"></script>
indvd00m@0
   146
indvd00m@0
   147
<script src="js/fulltoolbareditor.js"></script>
indvd00m@0
   148
<script src="js/abstracttoolbarmodifier.js"></script>
indvd00m@0
   149
<script src="js/toolbarmodifier.js"></script>
indvd00m@0
   150
<script src="js/toolbartextmodifier.js"></script>
indvd00m@0
   151
<script src="../js/sf.js"></script>
indvd00m@0
   152
indvd00m@0
   153
<script>
indvd00m@0
   154
	( function() {
indvd00m@0
   155
		'use strict';
indvd00m@0
   156
indvd00m@0
   157
		var mode = ( window.location.hash.substr( 1 ) === 'advanced' ) ? 'advanced' : 'basic',
indvd00m@0
   158
			configuratorSection = CKEDITOR.document.findOne( 'main > .grid-container.configurator' ),
indvd00m@0
   159
			basicInstruction = CKEDITOR.document.findOne( '#help-content .basic' ),
indvd00m@0
   160
			advancedInstruction = CKEDITOR.document.findOne( '#help-content .advanced' ),
indvd00m@0
   161
indvd00m@0
   162
			// Configurator mode switcher.
indvd00m@0
   163
			modeSwitchBasic = CKEDITOR.document.getById( 'radio-basic' ),
indvd00m@0
   164
			modeSwitchAdvanced = CKEDITOR.document.getById( 'radio-advanced' );
indvd00m@0
   165
indvd00m@0
   166
		// Initial setup
indvd00m@0
   167
		function updateSwitcher() {
indvd00m@0
   168
			if ( mode === 'advanced' ) {
indvd00m@0
   169
				modeSwitchAdvanced.$.checked = true;
indvd00m@0
   170
			} else {
indvd00m@0
   171
				modeSwitchBasic.$.checked = true;
indvd00m@0
   172
			}
indvd00m@0
   173
		}
indvd00m@0
   174
indvd00m@0
   175
		updateSwitcher();
indvd00m@0
   176
indvd00m@0
   177
		CKEDITOR.document.getWindow().on( 'hashchange', function( e ) {
indvd00m@0
   178
			var hash = window.location.hash.substr( 1 );
indvd00m@0
   179
			if ( !( hash === 'advanced' || hash === 'basic' ) ) {
indvd00m@0
   180
				return;
indvd00m@0
   181
			}
indvd00m@0
   182
			mode = hash;
indvd00m@0
   183
			onToolbarsDone( mode );
indvd00m@0
   184
		} );
indvd00m@0
   185
indvd00m@0
   186
		CKEDITOR.document.getWindow().on( 'resize', function() {
indvd00m@0
   187
			updateToolbar( ( mode === 'basic' ? toolbarModifier : toolbarTextModifier )[ 'editorInstance' ] );
indvd00m@0
   188
		} );
indvd00m@0
   189
indvd00m@0
   190
		function onRefresh( modifier ) {
indvd00m@0
   191
			modifier = modifier || this;
indvd00m@0
   192
indvd00m@0
   193
			if ( mode === 'basic' && modifier instanceof ToolbarConfigurator.ToolbarTextModifier ) {
indvd00m@0
   194
				return;
indvd00m@0
   195
			}
indvd00m@0
   196
indvd00m@0
   197
			// CodeMirror container becomes visible, so we need to refresh and to avoid rendering problems.
indvd00m@0
   198
			if ( mode === 'advanced' && modifier instanceof ToolbarConfigurator.ToolbarTextModifier ) {
indvd00m@0
   199
				modifier.codeContainer.refresh();
indvd00m@0
   200
			}
indvd00m@0
   201
indvd00m@0
   202
			updateToolbar( modifier.editorInstance );
indvd00m@0
   203
		}
indvd00m@0
   204
indvd00m@0
   205
		function updateToolbar( editor ) {
indvd00m@0
   206
			var editorContainer = editor.container;
indvd00m@0
   207
indvd00m@0
   208
			// Not always editor is loaded.
indvd00m@0
   209
			if ( !editorContainer ) {
indvd00m@0
   210
				return;
indvd00m@0
   211
			}
indvd00m@0
   212
indvd00m@0
   213
			var displayStyle = editorContainer.getStyle( 'display' );
indvd00m@0
   214
indvd00m@0
   215
			editorContainer.setStyle( 'display', 'block' );
indvd00m@0
   216
indvd00m@0
   217
			var newHeight = editorContainer.getSize( 'height' );
indvd00m@0
   218
indvd00m@0
   219
			var newMarginTop = parseInt( editorContainer.getComputedStyle( 'margin-top' ), 10 );
indvd00m@0
   220
			newMarginTop = ( isNaN( newMarginTop ) ? 0 : Number( newMarginTop ) );
indvd00m@0
   221
indvd00m@0
   222
			var newMarginBottom = parseInt( editorContainer.getComputedStyle( 'margin-bottom' ), 10 );
indvd00m@0
   223
			newMarginBottom = ( isNaN( newMarginBottom ) ? 0 : Number( newMarginBottom ) );
indvd00m@0
   224
indvd00m@0
   225
			var result = newHeight + newMarginTop + newMarginBottom;
indvd00m@0
   226
indvd00m@0
   227
			editorContainer.setStyle( 'display', displayStyle );
indvd00m@0
   228
indvd00m@0
   229
			editor.container.getAscendant( 'div' ).setStyle( 'height', result + 'px' );
indvd00m@0
   230
		}
indvd00m@0
   231
indvd00m@0
   232
		var toolbarModifier = new ToolbarConfigurator.ToolbarModifier( 'editor-basic' );
indvd00m@0
   233
indvd00m@0
   234
		var done = 0;
indvd00m@0
   235
		toolbarModifier.init( onToolbarInit );
indvd00m@0
   236
		toolbarModifier.onRefresh = onRefresh;
indvd00m@0
   237
indvd00m@0
   238
		CKEDITOR.document.getById( 'toolbarModifierWrapper' ).append( toolbarModifier.mainContainer );
indvd00m@0
   239
indvd00m@0
   240
		var toolbarTextModifier = new ToolbarConfigurator.ToolbarTextModifier( 'editor-advanced' );
indvd00m@0
   241
		toolbarTextModifier.init( onToolbarInit );
indvd00m@0
   242
		toolbarTextModifier.onRefresh = onRefresh;
indvd00m@0
   243
indvd00m@0
   244
		function onToolbarInit() {
indvd00m@0
   245
			if ( ++done === 2 ) {
indvd00m@0
   246
				onToolbarsDone();
indvd00m@0
   247
indvd00m@0
   248
				positionSticky.watch( CKEDITOR.document.findOne( '.toolbar' ), function() {
indvd00m@0
   249
					return mode === 'advanced';
indvd00m@0
   250
				} );
indvd00m@0
   251
			}
indvd00m@0
   252
		}
indvd00m@0
   253
indvd00m@0
   254
		function onToolbarsDone() {
indvd00m@0
   255
			if ( mode === 'basic' ) {
indvd00m@0
   256
				toggleModeBasic( false );
indvd00m@0
   257
			} else {
indvd00m@0
   258
				toggleModeAdvanced( false );
indvd00m@0
   259
			}
indvd00m@0
   260
indvd00m@0
   261
			updateSwitcher();
indvd00m@0
   262
indvd00m@0
   263
			setTimeout( function() {
indvd00m@0
   264
				CKEDITOR.document.findOne( '.editors-container' ).addClass( 'active' );
indvd00m@0
   265
				CKEDITOR.document.findOne( '#toolbarModifierWrapper' ).addClass( 'active' );
indvd00m@0
   266
			}, 200 );
indvd00m@0
   267
		}
indvd00m@0
   268
indvd00m@0
   269
		CKEDITOR.document.getById( 'toolbarModifierWrapper' ).append( toolbarTextModifier.mainContainer );
indvd00m@0
   270
indvd00m@0
   271
		function toogleModeSwitch( onElement, offElement, onModifier, offModifier ) {
indvd00m@0
   272
			onElement.addClass( 'fancy-button-active' );
indvd00m@0
   273
			offElement.removeClass( 'fancy-button-active' );
indvd00m@0
   274
indvd00m@0
   275
			onModifier.showUI();
indvd00m@0
   276
			offModifier.hideUI();
indvd00m@0
   277
		}
indvd00m@0
   278
indvd00m@0
   279
		function toggleModeBasic( callOnRefresh ) {
indvd00m@0
   280
			callOnRefresh = ( callOnRefresh !== false );
indvd00m@0
   281
			mode = 'basic';
indvd00m@0
   282
			window.location.hash = '#basic';
indvd00m@0
   283
			toogleModeSwitch( modeSwitchBasic, modeSwitchAdvanced, toolbarModifier, toolbarTextModifier );
indvd00m@0
   284
indvd00m@0
   285
			configuratorSection.removeClass( 'freed-width' );
indvd00m@0
   286
			basicInstruction.show();
indvd00m@0
   287
			advancedInstruction.hide();
indvd00m@0
   288
indvd00m@0
   289
			callOnRefresh && onRefresh( toolbarModifier );
indvd00m@0
   290
		}
indvd00m@0
   291
indvd00m@0
   292
		function toggleModeAdvanced( callOnRefresh ) {
indvd00m@0
   293
			callOnRefresh = ( callOnRefresh !== false );
indvd00m@0
   294
			mode = 'advanced';
indvd00m@0
   295
			window.location.hash = '#advanced';
indvd00m@0
   296
			toogleModeSwitch( modeSwitchAdvanced, modeSwitchBasic, toolbarTextModifier, toolbarModifier );
indvd00m@0
   297
indvd00m@0
   298
			configuratorSection.addClass( 'freed-width' );
indvd00m@0
   299
			advancedInstruction.show();
indvd00m@0
   300
			basicInstruction.hide();
indvd00m@0
   301
indvd00m@0
   302
			callOnRefresh && onRefresh( toolbarTextModifier );
indvd00m@0
   303
		}
indvd00m@0
   304
indvd00m@0
   305
		modeSwitchBasic.on( 'click', toggleModeBasic );
indvd00m@0
   306
		modeSwitchAdvanced.on( 'click', toggleModeAdvanced );
indvd00m@0
   307
indvd00m@0
   308
		//
indvd00m@0
   309
		// Position:sticky for the toolbar.
indvd00m@0
   310
		//
indvd00m@0
   311
indvd00m@0
   312
		// Will make elements behave like they were styled with position:sticky.
indvd00m@0
   313
		var positionSticky = {
indvd00m@0
   314
			// Store object: {
indvd00m@0
   315
			// 		element: CKEDITOR.dom.element, // Element which will float.
indvd00m@0
   316
			// 		placeholder: CKEDITOR.dom.element, // Placeholder which is place to prevent page bounce.
indvd00m@0
   317
			// 		isFixed: boolean // Whether element float now.
indvd00m@0
   318
			// }
indvd00m@0
   319
			watched: [],
indvd00m@0
   320
indvd00m@0
   321
			active: [],
indvd00m@0
   322
indvd00m@0
   323
			staticContainer: null,
indvd00m@0
   324
indvd00m@0
   325
			init: function() {
indvd00m@0
   326
				var element = CKEDITOR.dom.element.createFromHtml(
indvd00m@0
   327
					'<div class="staticContainer">' +
indvd00m@0
   328
						'<div class="grid-container" >' +
indvd00m@0
   329
							'<div class="grid-width-100">' +
indvd00m@0
   330
								'<div class="inner"></div>' +
indvd00m@0
   331
							'</div>' +
indvd00m@0
   332
						'</div>' +
indvd00m@0
   333
					'</div>' );
indvd00m@0
   334
indvd00m@0
   335
				this.staticContainer = element.findOne( '.inner' );
indvd00m@0
   336
indvd00m@0
   337
				CKEDITOR.document.getBody().append( element );
indvd00m@0
   338
			},
indvd00m@0
   339
indvd00m@0
   340
			watch: function( element, preventFunc ) {
indvd00m@0
   341
				this.watched.push( {
indvd00m@0
   342
					element: element,
indvd00m@0
   343
					placeholder: new CKEDITOR.dom.element( 'div' ),
indvd00m@0
   344
					isFixed: false,
indvd00m@0
   345
					preventFunc: preventFunc
indvd00m@0
   346
				} );
indvd00m@0
   347
			},
indvd00m@0
   348
indvd00m@0
   349
			checkAll: function() {
indvd00m@0
   350
				for ( var i = 0; i < this.watched.length; i++ ) {
indvd00m@0
   351
					this.check( this.watched[ i ] );
indvd00m@0
   352
				}
indvd00m@0
   353
			},
indvd00m@0
   354
indvd00m@0
   355
			check: function( element ) {
indvd00m@0
   356
				var isFixed = element.isFixed;
indvd00m@0
   357
				var shouldBeFixed = this.shouldBeFixed( element );
indvd00m@0
   358
indvd00m@0
   359
				// Nothing to be done.
indvd00m@0
   360
				if ( isFixed === shouldBeFixed ) {
indvd00m@0
   361
					return;
indvd00m@0
   362
				}
indvd00m@0
   363
indvd00m@0
   364
				var placeholder = element.placeholder;
indvd00m@0
   365
indvd00m@0
   366
				if ( isFixed ) {
indvd00m@0
   367
					// Unfixing.
indvd00m@0
   368
indvd00m@0
   369
					element.element.insertBefore( placeholder );
indvd00m@0
   370
					placeholder.remove();
indvd00m@0
   371
indvd00m@0
   372
					element.element.removeStyle( 'margin' );
indvd00m@0
   373
indvd00m@0
   374
					this.active.splice( CKEDITOR.tools.indexOf( this.active, element ), 1 );
indvd00m@0
   375
indvd00m@0
   376
				} else {
indvd00m@0
   377
					// Fixing.
indvd00m@0
   378
					placeholder.setStyle( 'width', element.element.getSize( 'width' ) + 'px' );
indvd00m@0
   379
					placeholder.setStyle( 'height', element.element.getSize( 'height' ) + 'px' );
indvd00m@0
   380
					placeholder.setStyle( 'margin-bottom', element.element.getComputedStyle( 'margin-bottom' ) );
indvd00m@0
   381
					placeholder.setStyle( 'display', element.element.getComputedStyle( 'display' ) );
indvd00m@0
   382
					placeholder.insertAfter( element.element );
indvd00m@0
   383
indvd00m@0
   384
					this.staticContainer.append( element.element );
indvd00m@0
   385
indvd00m@0
   386
					this.active.push( element );
indvd00m@0
   387
				}
indvd00m@0
   388
indvd00m@0
   389
				element.isFixed = !element.isFixed;
indvd00m@0
   390
			},
indvd00m@0
   391
indvd00m@0
   392
			shouldBeFixed: function( element ) {
indvd00m@0
   393
				if ( element.preventFunc && element.preventFunc() ) {
indvd00m@0
   394
					return false;
indvd00m@0
   395
				}
indvd00m@0
   396
indvd00m@0
   397
				// If element is already fixed we are checking it's placeholder.
indvd00m@0
   398
				var related = ( element.isFixed ? element.placeholder : element.element ),
indvd00m@0
   399
					clientRect = related.$.getBoundingClientRect(),
indvd00m@0
   400
					staticHeight = this.staticContainer.getSize('height' ),
indvd00m@0
   401
					elemHeight = element.element.getSize( 'height' );
indvd00m@0
   402
indvd00m@0
   403
				if ( element.isFixed ) {
indvd00m@0
   404
					return ( clientRect.top + elemHeight < staticHeight );
indvd00m@0
   405
				} else {
indvd00m@0
   406
					return ( clientRect.top < staticHeight );
indvd00m@0
   407
				}
indvd00m@0
   408
			}
indvd00m@0
   409
		};
indvd00m@0
   410
indvd00m@0
   411
		positionSticky.init();
indvd00m@0
   412
indvd00m@0
   413
		CKEDITOR.document.getWindow().on( 'scroll',
indvd00m@0
   414
			new CKEDITOR.tools.eventsBuffer( 100, positionSticky.checkAll, positionSticky ).input
indvd00m@0
   415
		);
indvd00m@0
   416
indvd00m@0
   417
		// Make the toolbar sticky.
indvd00m@0
   418
		positionSticky.watch( CKEDITOR.document.findOne( '.editors-container' ) );
indvd00m@0
   419
indvd00m@0
   420
		// Help button and help-content.
indvd00m@0
   421
		( function() {
indvd00m@0
   422
			var helpButton = CKEDITOR.document.getById( 'help' ),
indvd00m@0
   423
				helpContent = CKEDITOR.document.getById( 'help-content' );
indvd00m@0
   424
indvd00m@0
   425
			// Don't show help button on IE8 because it's unsupported by Pico Modal.
indvd00m@0
   426
			if ( CKEDITOR.env.ie && CKEDITOR.env.version == 8 ) {
indvd00m@0
   427
				helpButton.hide();
indvd00m@0
   428
			} else {
indvd00m@0
   429
				// Display help modal when the button is clicked.
indvd00m@0
   430
				helpButton.on( 'click', function( evt ) {
indvd00m@0
   431
					SF.modal( {
indvd00m@0
   432
						// Clone modal content from DOM.
indvd00m@0
   433
						content: helpContent.getHtml(),
indvd00m@0
   434
indvd00m@0
   435
						afterCreate: function( modal ) {
indvd00m@0
   436
							// Enable modal content button to close the modal.
indvd00m@0
   437
							new CKEDITOR.dom.element( modal.modalElem() ).findOne( '.help-content-close' ).once( 'click', modal.close );
indvd00m@0
   438
						}
indvd00m@0
   439
					} ).show();
indvd00m@0
   440
				} );
indvd00m@0
   441
			}
indvd00m@0
   442
		} )();
indvd00m@0
   443
	} )();
indvd00m@0
   444
</script>
indvd00m@0
   445
</body>
indvd00m@0
   446
</html>