Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/js/ckeditor/samples/sample.js
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2020-02-01 09:05:48 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2020-02-01 09:05:48 +0100
commit6854cb3f4d8219cf1829e32122eb2502a916eae9 (patch)
tree350feb504587d932e02837a1442b059759927646 /js/ckeditor/samples/sample.js
initial checkin
Diffstat (limited to 'js/ckeditor/samples/sample.js')
-rw-r--r--js/ckeditor/samples/sample.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/js/ckeditor/samples/sample.js b/js/ckeditor/samples/sample.js
new file mode 100644
index 0000000..2bdcd98
--- /dev/null
+++ b/js/ckeditor/samples/sample.js
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or http://ckeditor.com/license
+ */
+
+// Tool scripts for the sample pages.
+// This file can be ignored and is not required to make use of CKEditor.
+
+( function() {
+ CKEDITOR.on( 'instanceReady', function( ev ) {
+ // Check for sample compliance.
+ var editor = ev.editor,
+ meta = CKEDITOR.document.$.getElementsByName( 'ckeditor-sample-required-plugins' ),
+ requires = meta.length ? CKEDITOR.dom.element.get( meta[ 0 ] ).getAttribute( 'content' ).split( ',' ) : [],
+ missing = [],
+ i;
+
+ if ( requires.length ) {
+ for ( i = 0; i < requires.length; i++ ) {
+ if ( !editor.plugins[ requires[ i ] ] )
+ missing.push( '<code>' + requires[ i ] + '</code>' );
+ }
+
+ if ( missing.length ) {
+ var warn = CKEDITOR.dom.element.createFromHtml(
+ '<div class="warning">' +
+ '<span>To fully experience this demo, the ' + missing.join( ', ' ) + ' plugin' + ( missing.length > 1 ? 's are' : ' is' ) + ' required.</span>' +
+ '</div>'
+ );
+ warn.insertBefore( editor.container );
+ }
+ }
+
+ // Set icons.
+ var doc = new CKEDITOR.dom.document( document ),
+ icons = doc.find( '.button_icon' );
+
+ for ( i = 0; i < icons.count(); i++ ) {
+ var icon = icons.getItem( i ),
+ name = icon.getAttribute( 'data-icon' ),
+ style = CKEDITOR.skin.getIconStyle( name, ( CKEDITOR.lang.dir == 'rtl' ) );
+
+ icon.addClass( 'cke_button_icon' );
+ icon.addClass( 'cke_button__' + name + '_icon' );
+ icon.setAttribute( 'style', style );
+ icon.setStyle( 'float', 'none' );
+
+ }
+ } );
+} )();