new static files.
Signed-off-by: rscnt <rascnt@gmail.com>
This commit is contained in:
		
					parent
					
						
							
								83e792bcaa
							
						
					
				
			
			
				commit
				
					
						fe4f6c97d5
					
				
			
		
					 778 changed files with 71557 additions and 0 deletions
				
			
		
							
								
								
									
										96
									
								
								static/djangocms_text_ckeditor/js/cms.ckeditor.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								static/djangocms_text_ckeditor/js/cms.ckeditor.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,96 @@
 | 
			
		|||
/*##################################################|*/
 | 
			
		||||
/* #CMS.CKEDITOR# */
 | 
			
		||||
(function($) {
 | 
			
		||||
// CMS.$ will be passed for $
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
	/*!
 | 
			
		||||
	 * CNS.CKEditor
 | 
			
		||||
	 * @version: 1.1.0
 | 
			
		||||
	 * @description: Adds cms specific plugins to CKEditor
 | 
			
		||||
	 */
 | 
			
		||||
	CMS.CKEditor = {
 | 
			
		||||
 | 
			
		||||
		options: {
 | 
			
		||||
			// ckeditor default settings, will be overwritten by CKEDITOR_SETTINGS
 | 
			
		||||
			'language': 'en',
 | 
			
		||||
			'skin': 'moono',
 | 
			
		||||
			'toolbar_CMS': [
 | 
			
		||||
				['Undo', 'Redo'],
 | 
			
		||||
				['cmsplugins', '-', 'ShowBlocks'],
 | 
			
		||||
				['Format', 'Styles'],
 | 
			
		||||
				['TextColor', 'BGColor', '-', 'PasteText', 'PasteFromWord'],
 | 
			
		||||
				['Maximize', ''],
 | 
			
		||||
				'/',
 | 
			
		||||
				['Bold', 'Italic', 'Underline', '-', 'Subscript', 'Superscript', '-', 'RemoveFormat'],
 | 
			
		||||
				['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
 | 
			
		||||
				['HorizontalRule'],
 | 
			
		||||
				['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Table'],
 | 
			
		||||
				['Source']
 | 
			
		||||
			],
 | 
			
		||||
			'toolbar_HTMLField': [
 | 
			
		||||
				['Undo', 'Redo'],
 | 
			
		||||
				['ShowBlocks'],
 | 
			
		||||
				['Format', 'Styles'],
 | 
			
		||||
				['TextColor', 'BGColor', '-', 'PasteText', 'PasteFromWord'],
 | 
			
		||||
				['Maximize', ''],
 | 
			
		||||
				'/',
 | 
			
		||||
				['Bold', 'Italic', 'Underline', '-', 'Subscript', 'Superscript', '-', 'RemoveFormat'],
 | 
			
		||||
				['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
 | 
			
		||||
				['HorizontalRule'],
 | 
			
		||||
				['Link', 'Unlink'],
 | 
			
		||||
				['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Table'],
 | 
			
		||||
				['Source']
 | 
			
		||||
			],
 | 
			
		||||
 | 
			
		||||
			'allowedContent': true,
 | 
			
		||||
			'toolbarCanCollapse': false,
 | 
			
		||||
			'extraPlugins': 'cmsplugins'
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		init: function (container, options, settings) {
 | 
			
		||||
			if ($('#' + container).length > 0) {
 | 
			
		||||
				this.container = $('#' + container);
 | 
			
		||||
				// add additional settings to options
 | 
			
		||||
				this.options.toolbar = settings.toolbar;
 | 
			
		||||
				this.options = $.extend(false, {
 | 
			
		||||
					'settings': settings
 | 
			
		||||
				}, this.options, options);
 | 
			
		||||
 | 
			
		||||
				// add additional plugins (autoloads plugins.js)
 | 
			
		||||
				CKEDITOR.plugins.addExternal('cmsplugins', settings.static_url + '/ckeditor_plugins/cmsplugins/');
 | 
			
		||||
 | 
			
		||||
				// render ckeditor
 | 
			
		||||
				this.editor = CKEDITOR.replace(container, this.options);
 | 
			
		||||
 | 
			
		||||
				// add additional styling
 | 
			
		||||
				CKEDITOR.on('instanceReady', $.proxy(CMS.CKEditor, 'setup'));
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// setup is called after ckeditor has been initialized
 | 
			
		||||
		setup: function () {
 | 
			
		||||
			// auto maximize modal if alone in a modal
 | 
			
		||||
			if (this._isAloneInModal()) {
 | 
			
		||||
				this.editor.execCommand('maximize');
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// add css tweks to the editor
 | 
			
		||||
			this.styles();
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		styles: function () {
 | 
			
		||||
			// add styling to source and fullscreen view
 | 
			
		||||
			$('.cke_button__maximize, .cke_button__source').parent()
 | 
			
		||||
				.css('margin-right', 0).parent()
 | 
			
		||||
				.css('float', 'right');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_isAloneInModal: function () {
 | 
			
		||||
			// return true if the ckeditor is alone in a modal popup
 | 
			
		||||
			return this.container.parents('body.djangocms_text_ckeditor-text').length > 0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
})(CMS.$);
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue