Advertisement
Guest User

ckeditor config.js modified

a guest
Sep 20th, 2012
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
  3. For licensing, see LICENSE.html or http://ckeditor.com/license
  4.  
  5. Version 2012-09-20
  6. Site: http://www.gute-mathe-fragen.de/
  7. */
  8.  
  9. CKEDITOR.editorConfig = function( config ) {
  10.     config.language = 'de';
  11.    
  12.     config.linkShowAdvancedTab = false;
  13.     config.linkShowTargetTab = false;
  14.    
  15.     config.height = 350;
  16.     config.width = 680;
  17.  
  18.     // smaller editor-width for mobile devices
  19.     if (/iPhone|iPod/i.test(navigator.userAgent)) {
  20.         config.width = 300;
  21.     }
  22.    
  23.     // remove font size, family, bg color from pasted text
  24.     config.pasteFromWordRemoveFontStyles = true;
  25.    
  26.     // allow browser's spell checker
  27.     config.disableNativeSpellChecker = false;
  28.    
  29.     // shortcuts for firefox and chrome (editor breaks if assigned in IE9)
  30.     // if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
  31.     if ( !(/MSIE (\d+\.\d+);/.test(navigator.userAgent)) ) {
  32.         config.keystrokes = [
  33.             // [ CKEDITOR.SHIFT + 45, 'pastefromword' ], //INS
  34.             [ CKEDITOR.CTRL + 76, 'link' ], //L
  35.             [ CKEDITOR.CTRL + CKEDITOR.ALT + 66, 'image' ], //B
  36.             [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 77, 'specialchar' ], //M
  37.             [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 188, 'subscript' ], //COMMA
  38.             [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 109, 'subscript' ], //-
  39.             [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 191, 'subscript' ], //#
  40.             [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 190, 'superscript' ], //PERIOD
  41.             [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 107, 'superscript' ], //+
  42.             [ CKEDITOR.CTRL + 66, 'bold' ], //B
  43.             [ CKEDITOR.CTRL + 73, 'italic' ], //I
  44.             [ CKEDITOR.CTRL + 85, 'underline' ], //U
  45.             [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 70, 'bold' ], //F
  46.             [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 75, 'italic' ], //K
  47.             [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 85, 'underline' ], //U
  48.         ];
  49.     }
  50. };
  51.  
  52. CKEDITOR.on( 'dialogDefinition', function( ev ) {
  53.     // Take the dialog name and its definition from the event data.
  54.     var dialogName = ev.data.name;
  55.     var dialogDefinition = ev.data.definition;
  56.  
  57.     if(dialogName == 'link') {
  58.         dialogDefinition.onShow = function () {
  59.             var dialog = CKEDITOR.dialog.getCurrent();
  60.             //dialog.hidePage( 'target' ); // via config
  61.             //dialog.hidePage( 'advanced' ); // via config
  62.             elem = dialog.getContentElement('info','anchorOptions');   
  63.             elem.getElement().hide();
  64.             elem = dialog.getContentElement('info','emailOptions');
  65.             elem.getElement().hide();
  66.             var elem = dialog.getContentElement('info','linkType');
  67.             elem.getElement().hide();
  68.             elem = dialog.getContentElement('info','protocol');
  69.             elem.disable();
  70.         };
  71.     }
  72.     else if(dialogName == 'image') {
  73.        
  74.         // Get a reference to the 'Link Info' tab.
  75.         var infoTab = dialogDefinition.getContents('info');
  76.         // Remove unnecessary widgets
  77.         infoTab.remove( 'ratioLock' );
  78.         infoTab.remove( 'txtHeight' );        
  79.         infoTab.remove( 'txtWidth' );        
  80.         infoTab.remove( 'txtBorder');
  81.         infoTab.remove( 'txtHSpace');
  82.         infoTab.remove( 'txtVSpace');
  83.         infoTab.remove( 'cmbAlign' );
  84.  
  85.         // memo: dialogDefinition.onShow = ... throws JS error (C.preview not defined)
  86.         dialogDefinition.onLoad = function () {
  87.             var dialog = CKEDITOR.dialog.getCurrent();
  88.            
  89.             var elem = dialog.getContentElement('info','htmlPreview'); 
  90.             elem.getElement().hide();
  91.  
  92.             dialog.hidePage('Link');
  93.             dialog.hidePage('advanced');
  94.             this.selectPage('Upload');
  95.            
  96.             // hide on start up, prevent user input external image URLs
  97.             // goes in onShow of image.js: dialog.hidePage('info');
  98.  
  99.             // hide ok button so that upload button can only be used
  100.             // goes in onShow of image.js: document.getElementById(this.getButton('ok').domId).style.display='none';
  101.            
  102.             // on tab switching or automatic after upload
  103.             this.on('selectPage', function (e) {
  104.                 // alert("Tab gewechselt");
  105.                 document.getElementById(this.getButton('ok').domId).style.display='inline';
  106.                 // after upload the selectPage is fired, show Bild-Info then
  107.                 dialog.showPage( 'info' );
  108.             });
  109.         };
  110.  
  111.     }
  112.     else if(dialogName == 'table') {
  113.         dialogDefinition.removeContents('advanced');
  114.     }      
  115.  
  116. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement