Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

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