Dotclear

Changeset 3181:9ce02e94c77e


Ignore:
Timestamp:
02/22/16 13:12:48 (8 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Source code indent is back in CKEditor, fixes #2130

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • build-tools/ckeditor/build-config.js

    r2962 r3181  
    4343          format: 1, 
    4444          horizontalrule: 1, 
     45          htmlwriter: 1, 
    4546          image: 1, 
    4647          indentlist: 1, 
  • plugins/dcCKEditor/js/ckeditor/ckeditor.js

    r3175 r3181  
    4343               // for each release and generated by the releaser. 
    4444               // (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122) 
    45                timestamp: 'G1JE', 
     45               timestamp: 'G1MC', 
    4646 
    4747               /** 
     
    4329943299 */ 
    4330043300 
     43301CKEDITOR.plugins.add( 'htmlwriter', { 
     43302     init: function( editor ) { 
     43303          var writer = new CKEDITOR.htmlWriter(); 
     43304 
     43305          writer.forceSimpleAmpersand = editor.config.forceSimpleAmpersand; 
     43306          writer.indentationChars = editor.config.dataIndentationChars || '\t'; 
     43307 
     43308          // Overwrite default basicWriter initialized in hmtlDataProcessor constructor. 
     43309          editor.dataProcessor.writer = writer; 
     43310     } 
     43311} ); 
     43312 
     43313/** 
     43314 * The class used to write HTML data. 
     43315 * 
     43316 *        var writer = new CKEDITOR.htmlWriter(); 
     43317 *        writer.openTag( 'p' ); 
     43318 *        writer.attribute( 'class', 'MyClass' ); 
     43319 *        writer.openTagClose( 'p' ); 
     43320 *        writer.text( 'Hello' ); 
     43321 *        writer.closeTag( 'p' ); 
     43322 *        alert( writer.getHtml() ); // '<p class="MyClass">Hello</p>' 
     43323 * 
     43324 * @class 
     43325 * @extends CKEDITOR.htmlParser.basicWriter 
     43326 */ 
     43327CKEDITOR.htmlWriter = CKEDITOR.tools.createClass( { 
     43328     base: CKEDITOR.htmlParser.basicWriter, 
     43329 
     43330     /** 
     43331      * Creates an `htmlWriter` class instance. 
     43332      * 
     43333      * @constructor 
     43334      */ 
     43335     $: function() { 
     43336          // Call the base contructor. 
     43337          this.base(); 
     43338 
     43339          /** 
     43340           * The characters to be used for each indentation step. 
     43341           * 
     43342           *        // Use tab for indentation. 
     43343           *        editorInstance.dataProcessor.writer.indentationChars = '\t'; 
     43344           */ 
     43345          this.indentationChars = '\t'; 
     43346 
     43347          /** 
     43348           * The characters to be used to close "self-closing" elements, like `<br>` or `<img>`. 
     43349           * 
     43350           *        // Use HTML4 notation for self-closing elements. 
     43351           *        editorInstance.dataProcessor.writer.selfClosingEnd = '>'; 
     43352           */ 
     43353          this.selfClosingEnd = ' />'; 
     43354 
     43355          /** 
     43356           * The characters to be used for line breaks. 
     43357           * 
     43358           *        // Use CRLF for line breaks. 
     43359           *        editorInstance.dataProcessor.writer.lineBreakChars = '\r\n'; 
     43360           */ 
     43361          this.lineBreakChars = '\n'; 
     43362 
     43363          this.sortAttributes = 1; 
     43364 
     43365          this._.indent = 0; 
     43366          this._.indentation = ''; 
     43367          // Indicate preformatted block context status. (#5789) 
     43368          this._.inPre = 0; 
     43369          this._.rules = {}; 
     43370 
     43371          var dtd = CKEDITOR.dtd; 
     43372 
     43373          for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) { 
     43374               this.setRules( e, { 
     43375                    indent: !dtd[ e ][ '#' ], 
     43376                    breakBeforeOpen: 1, 
     43377                    breakBeforeClose: !dtd[ e ][ '#' ], 
     43378                    breakAfterClose: 1, 
     43379                    needsSpace: ( e in dtd.$block ) && !( e in { li: 1, dt: 1, dd: 1 } ) 
     43380               } ); 
     43381          } 
     43382 
     43383          this.setRules( 'br', { breakAfterOpen: 1 } ); 
     43384 
     43385          this.setRules( 'title', { 
     43386               indent: 0, 
     43387               breakAfterOpen: 0 
     43388          } ); 
     43389 
     43390          this.setRules( 'style', { 
     43391               indent: 0, 
     43392               breakBeforeClose: 1 
     43393          } ); 
     43394 
     43395          this.setRules( 'pre', { 
     43396               breakAfterOpen: 1, // Keep line break after the opening tag 
     43397               indent: 0 // Disable indentation on <pre>. 
     43398          } ); 
     43399     }, 
     43400 
     43401     proto: { 
     43402          /** 
     43403           * Writes the tag opening part for an opener tag. 
     43404           * 
     43405           *        // Writes '<p'. 
     43406           *        writer.openTag( 'p', { class : 'MyClass', id : 'MyId' } ); 
     43407           * 
     43408           * @param {String} tagName The element name for this tag. 
     43409           * @param {Object} attributes The attributes defined for this tag. The 
     43410           * attributes could be used to inspect the tag. 
     43411           */ 
     43412          openTag: function( tagName ) { 
     43413               var rules = this._.rules[ tagName ]; 
     43414 
     43415               if ( this._.afterCloser && rules && rules.needsSpace && this._.needsSpace ) 
     43416                    this._.output.push( '\n' ); 
     43417 
     43418               if ( this._.indent ) 
     43419                    this.indentation(); 
     43420               // Do not break if indenting. 
     43421               else if ( rules && rules.breakBeforeOpen ) { 
     43422                    this.lineBreak(); 
     43423                    this.indentation(); 
     43424               } 
     43425 
     43426               this._.output.push( '<', tagName ); 
     43427 
     43428               this._.afterCloser = 0; 
     43429          }, 
     43430 
     43431          /** 
     43432           * Writes the tag closing part for an opener tag. 
     43433           * 
     43434           *        // Writes '>'. 
     43435           *        writer.openTagClose( 'p', false ); 
     43436           * 
     43437           *        // Writes ' />'. 
     43438           *        writer.openTagClose( 'br', true ); 
     43439           * 
     43440           * @param {String} tagName The element name for this tag. 
     43441           * @param {Boolean} isSelfClose Indicates that this is a self-closing tag, 
     43442           * like `<br>` or `<img>`. 
     43443           */ 
     43444          openTagClose: function( tagName, isSelfClose ) { 
     43445               var rules = this._.rules[ tagName ]; 
     43446 
     43447               if ( isSelfClose ) { 
     43448                    this._.output.push( this.selfClosingEnd ); 
     43449 
     43450                    if ( rules && rules.breakAfterClose ) 
     43451                         this._.needsSpace = rules.needsSpace; 
     43452               } else { 
     43453                    this._.output.push( '>' ); 
     43454 
     43455                    if ( rules && rules.indent ) 
     43456                         this._.indentation += this.indentationChars; 
     43457               } 
     43458 
     43459               if ( rules && rules.breakAfterOpen ) 
     43460                    this.lineBreak(); 
     43461               tagName == 'pre' && ( this._.inPre = 1 ); 
     43462          }, 
     43463 
     43464          /** 
     43465           * Writes an attribute. This function should be called after opening the 
     43466           * tag with {@link #openTagClose}. 
     43467           * 
     43468           *        // Writes ' class="MyClass"'. 
     43469           *        writer.attribute( 'class', 'MyClass' ); 
     43470           * 
     43471           * @param {String} attName The attribute name. 
     43472           * @param {String} attValue The attribute value. 
     43473           */ 
     43474          attribute: function( attName, attValue ) { 
     43475 
     43476               if ( typeof attValue == 'string' ) { 
     43477                    this.forceSimpleAmpersand && ( attValue = attValue.replace( /&amp;/g, '&' ) ); 
     43478                    // Browsers don't always escape special character in attribute values. (#4683, #4719). 
     43479                    attValue = CKEDITOR.tools.htmlEncodeAttr( attValue ); 
     43480               } 
     43481 
     43482               this._.output.push( ' ', attName, '="', attValue, '"' ); 
     43483          }, 
     43484 
     43485          /** 
     43486           * Writes a closer tag. 
     43487           * 
     43488           *        // Writes '</p>'. 
     43489           *        writer.closeTag( 'p' ); 
     43490           * 
     43491           * @param {String} tagName The element name for this tag. 
     43492           */ 
     43493          closeTag: function( tagName ) { 
     43494               var rules = this._.rules[ tagName ]; 
     43495 
     43496               if ( rules && rules.indent ) 
     43497                    this._.indentation = this._.indentation.substr( this.indentationChars.length ); 
     43498 
     43499               if ( this._.indent ) 
     43500                    this.indentation(); 
     43501               // Do not break if indenting. 
     43502               else if ( rules && rules.breakBeforeClose ) { 
     43503                    this.lineBreak(); 
     43504                    this.indentation(); 
     43505               } 
     43506 
     43507               this._.output.push( '</', tagName, '>' ); 
     43508               tagName == 'pre' && ( this._.inPre = 0 ); 
     43509 
     43510               if ( rules && rules.breakAfterClose ) { 
     43511                    this.lineBreak(); 
     43512                    this._.needsSpace = rules.needsSpace; 
     43513               } 
     43514 
     43515               this._.afterCloser = 1; 
     43516          }, 
     43517 
     43518          /** 
     43519           * Writes text. 
     43520           * 
     43521           *        // Writes 'Hello Word'. 
     43522           *        writer.text( 'Hello Word' ); 
     43523           * 
     43524           * @param {String} text The text value 
     43525           */ 
     43526          text: function( text ) { 
     43527               if ( this._.indent ) { 
     43528                    this.indentation(); 
     43529                    !this._.inPre && ( text = CKEDITOR.tools.ltrim( text ) ); 
     43530               } 
     43531 
     43532               this._.output.push( text ); 
     43533          }, 
     43534 
     43535          /** 
     43536           * Writes a comment. 
     43537           * 
     43538           *        // Writes "<!-- My comment -->". 
     43539           *        writer.comment( ' My comment ' ); 
     43540           * 
     43541           * @param {String} comment The comment text. 
     43542           */ 
     43543          comment: function( comment ) { 
     43544               if ( this._.indent ) 
     43545                    this.indentation(); 
     43546 
     43547               this._.output.push( '<!--', comment, '-->' ); 
     43548          }, 
     43549 
     43550          /** 
     43551           * Writes a line break. It uses the {@link #lineBreakChars} property for it. 
     43552           * 
     43553           *        // Writes '\n' (e.g.). 
     43554           *        writer.lineBreak(); 
     43555           */ 
     43556          lineBreak: function() { 
     43557               if ( !this._.inPre && this._.output.length > 0 ) 
     43558                    this._.output.push( this.lineBreakChars ); 
     43559               this._.indent = 1; 
     43560          }, 
     43561 
     43562          /** 
     43563           * Writes the current indentation character. It uses the {@link #indentationChars} 
     43564           * property, repeating it for the current indentation steps. 
     43565           * 
     43566           *        // Writes '\t' (e.g.). 
     43567           *        writer.indentation(); 
     43568           */ 
     43569          indentation: function() { 
     43570               if ( !this._.inPre && this._.indentation ) 
     43571                    this._.output.push( this._.indentation ); 
     43572               this._.indent = 0; 
     43573          }, 
     43574 
     43575          /** 
     43576           * Empties the current output buffer. It also brings back the default 
     43577           * values of the writer flags. 
     43578           * 
     43579           *        writer.reset(); 
     43580           */ 
     43581          reset: function() { 
     43582               this._.output = []; 
     43583               this._.indent = 0; 
     43584               this._.indentation = ''; 
     43585               this._.afterCloser = 0; 
     43586               this._.inPre = 0; 
     43587          }, 
     43588 
     43589          /** 
     43590           * Sets formatting rules for a given element. Possible rules are: 
     43591           * 
     43592           * * `indent` &ndash; indent the element content. 
     43593           * * `breakBeforeOpen` &ndash; break line before the opener tag for this element. 
     43594           * * `breakAfterOpen` &ndash; break line after the opener tag for this element. 
     43595           * * `breakBeforeClose` &ndash; break line before the closer tag for this element. 
     43596           * * `breakAfterClose` &ndash; break line after the closer tag for this element. 
     43597           * 
     43598           * All rules default to `false`. Each function call overrides rules that are 
     43599           * already present, leaving the undefined ones untouched. 
     43600           * 
     43601           * By default, all elements available in the {@link CKEDITOR.dtd#$block}, 
     43602           * {@link CKEDITOR.dtd#$listItem}, and {@link CKEDITOR.dtd#$tableContent} 
     43603           * lists have all the above rules set to `true`. Additionaly, the `<br>` 
     43604           * element has the `breakAfterOpen` rule set to `true`. 
     43605           * 
     43606           *        // Break line before and after "img" tags. 
     43607           *        writer.setRules( 'img', { 
     43608           *             breakBeforeOpen: true 
     43609           *             breakAfterOpen: true 
     43610           *        } ); 
     43611           * 
     43612           *        // Reset the rules for the "h1" tag. 
     43613           *        writer.setRules( 'h1', {} ); 
     43614           * 
     43615           * @param {String} tagName The name of the element for which the rules are set. 
     43616           * @param {Object} rules An object containing the element rules. 
     43617           */ 
     43618          setRules: function( tagName, rules ) { 
     43619               var currentRules = this._.rules[ tagName ]; 
     43620 
     43621               if ( currentRules ) 
     43622                    CKEDITOR.tools.extend( currentRules, rules, true ); 
     43623               else 
     43624                    this._.rules[ tagName ] = rules; 
     43625          } 
     43626     } 
     43627} ); 
     43628 
     43629/** 
     43630 * Whether to force using `'&'` instead of `'&amp;'` in element attributes 
     43631 * values. It is not recommended to change this setting for compliance with the 
     43632 * W3C XHTML 1.0 standards ([C.12, XHTML 1.0](http://www.w3.org/TR/xhtml1/#C_12)). 
     43633 * 
     43634 *        // Use `'&'` instead of `'&amp;'` 
     43635 *        CKEDITOR.config.forceSimpleAmpersand = true; 
     43636 * 
     43637 * @cfg {Boolean} [forceSimpleAmpersand=false] 
     43638 * @member CKEDITOR.config 
     43639 */ 
     43640 
     43641/** 
     43642 * The characters to be used for indenting HTML output produced by the editor. 
     43643 * Using characters different from `' '` (space) and `'\t'` (tab) is not recommended 
     43644 * as it will mess the code. 
     43645 * 
     43646 *        // No indentation. 
     43647 *        CKEDITOR.config.dataIndentationChars = ''; 
     43648 * 
     43649 *        // Use two spaces for indentation. 
     43650 *        CKEDITOR.config.dataIndentationChars = '  '; 
     43651 * 
     43652 * @cfg {String} [dataIndentationChars='\t'] 
     43653 * @member CKEDITOR.config 
     43654 */ 
     43655 
     43656/** 
     43657 * Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. 
     43658 * For licensing, see LICENSE.md or http://ckeditor.com/license 
     43659 */ 
     43660 
    4330143661/** 
    4330243662 * @fileOverview The Image plugin. 
     
    5518155541 */ 
    5518255542 
    55183 CKEDITOR.config.plugins='dialogui,dialog,a11yhelp,about,basicstyles,blockquote,clipboard,button,panelbutton,panel,floatpanel,colorbutton,dialogadvtab,div,elementspath,enterkey,floatingspace,listblock,richcombo,format,horizontalrule,image,indent,indentlist,indentblock,justify,fakeobjects,link,list,menu,contextmenu,liststyle,magicline,maximize,pastefromword,pastetext,print,removeformat,resize,sourcearea,specialchar,stylescombo,tab,table,tabletools,templates,toolbar,undo,wysiwygarea';CKEDITOR.config.skin='moono';(function() {var setIcons = function(icons, strip) {var path = CKEDITOR.getUrl( 'plugins/' + strip );icons = icons.split( ',' );for ( var i = 0; i < icons.length; i++ )CKEDITOR.skin.icons[ icons[ i ] ] = { path: path, offset: -icons[ ++i ], bgsize : icons[ ++i ] };};if (CKEDITOR.env.hidpi) setIcons('about,0,,bold,24,,italic,48,,strike,72,,subscript,96,,superscript,120,,underline,144,,blockquote,168,,copy-rtl,192,,copy,216,,cut-rtl,240,,cut,264,,paste-rtl,288,,paste,312,,bgcolor,336,,textcolor,360,,creatediv,384,,horizontalrule,408,,image,432,,indent-rtl,456,,indent,480,,outdent-rtl,504,,outdent,528,,justifyblock,552,,justifycenter,576,,justifyleft,600,,justifyright,624,,anchor-rtl,648,,anchor,672,,link,696,,unlink,720,,bulletedlist-rtl,744,,bulletedlist,768,,numberedlist-rtl,792,,numberedlist,816,,maximize,840,,pastefromword-rtl,864,,pastefromword,888,,pastetext-rtl,912,,pastetext,936,,print,960,,removeformat,984,,source-rtl,1008,,source,1032,,specialchar,1056,,table,1080,,templates-rtl,1104,,templates,1128,,redo-rtl,1152,,redo,1176,,undo-rtl,1200,,undo,1224,','icons_hidpi.png');else setIcons('about,0,auto,bold,24,auto,italic,48,auto,strike,72,auto,subscript,96,auto,superscript,120,auto,underline,144,auto,blockquote,168,auto,copy-rtl,192,auto,copy,216,auto,cut-rtl,240,auto,cut,264,auto,paste-rtl,288,auto,paste,312,auto,bgcolor,336,auto,textcolor,360,auto,creatediv,384,auto,horizontalrule,408,auto,image,432,auto,indent-rtl,456,auto,indent,480,auto,outdent-rtl,504,auto,outdent,528,auto,justifyblock,552,auto,justifycenter,576,auto,justifyleft,600,auto,justifyright,624,auto,anchor-rtl,648,auto,anchor,672,auto,link,696,auto,unlink,720,auto,bulletedlist-rtl,744,auto,bulletedlist,768,auto,numberedlist-rtl,792,auto,numberedlist,816,auto,maximize,840,auto,pastefromword-rtl,864,auto,pastefromword,888,auto,pastetext-rtl,912,auto,pastetext,936,auto,print,960,auto,removeformat,984,auto,source-rtl,1008,auto,source,1032,auto,specialchar,1056,auto,table,1080,auto,templates-rtl,1104,auto,templates,1128,auto,redo-rtl,1152,auto,redo,1176,auto,undo-rtl,1200,auto,undo,1224,auto','icons.png');})(); 
     55543CKEDITOR.config.plugins='dialogui,dialog,a11yhelp,about,basicstyles,blockquote,clipboard,button,panelbutton,panel,floatpanel,colorbutton,dialogadvtab,div,elementspath,enterkey,floatingspace,listblock,richcombo,format,horizontalrule,htmlwriter,image,indent,indentlist,indentblock,justify,fakeobjects,link,list,menu,contextmenu,liststyle,magicline,maximize,pastefromword,pastetext,print,removeformat,resize,sourcearea,specialchar,stylescombo,tab,table,tabletools,templates,toolbar,undo,wysiwygarea';CKEDITOR.config.skin='moono';(function() {var setIcons = function(icons, strip) {var path = CKEDITOR.getUrl( 'plugins/' + strip );icons = icons.split( ',' );for ( var i = 0; i < icons.length; i++ )CKEDITOR.skin.icons[ icons[ i ] ] = { path: path, offset: -icons[ ++i ], bgsize : icons[ ++i ] };};if (CKEDITOR.env.hidpi) setIcons('about,0,,bold,24,,italic,48,,strike,72,,subscript,96,,superscript,120,,underline,144,,blockquote,168,,copy-rtl,192,,copy,216,,cut-rtl,240,,cut,264,,paste-rtl,288,,paste,312,,bgcolor,336,,textcolor,360,,creatediv,384,,horizontalrule,408,,image,432,,indent-rtl,456,,indent,480,,outdent-rtl,504,,outdent,528,,justifyblock,552,,justifycenter,576,,justifyleft,600,,justifyright,624,,anchor-rtl,648,,anchor,672,,link,696,,unlink,720,,bulletedlist-rtl,744,,bulletedlist,768,,numberedlist-rtl,792,,numberedlist,816,,maximize,840,,pastefromword-rtl,864,,pastefromword,888,,pastetext-rtl,912,,pastetext,936,,print,960,,removeformat,984,,source-rtl,1008,,source,1032,,specialchar,1056,,table,1080,,templates-rtl,1104,,templates,1128,,redo-rtl,1152,,redo,1176,,undo-rtl,1200,,undo,1224,','icons_hidpi.png');else setIcons('about,0,auto,bold,24,auto,italic,48,auto,strike,72,auto,subscript,96,auto,superscript,120,auto,underline,144,auto,blockquote,168,auto,copy-rtl,192,auto,copy,216,auto,cut-rtl,240,auto,cut,264,auto,paste-rtl,288,auto,paste,312,auto,bgcolor,336,auto,textcolor,360,auto,creatediv,384,auto,horizontalrule,408,auto,image,432,auto,indent-rtl,456,auto,indent,480,auto,outdent-rtl,504,auto,outdent,528,auto,justifyblock,552,auto,justifycenter,576,auto,justifyleft,600,auto,justifyright,624,auto,anchor-rtl,648,auto,anchor,672,auto,link,696,auto,unlink,720,auto,bulletedlist-rtl,744,auto,bulletedlist,768,auto,numberedlist-rtl,792,auto,numberedlist,816,auto,maximize,840,auto,pastefromword-rtl,864,auto,pastefromword,888,auto,pastetext-rtl,912,auto,pastetext,936,auto,print,960,auto,removeformat,984,auto,source-rtl,1008,auto,source,1032,auto,specialchar,1056,auto,table,1080,auto,templates-rtl,1104,auto,templates,1128,auto,redo-rtl,1152,auto,redo,1176,auto,undo-rtl,1200,auto,undo,1224,auto','icons.png');})(); 
    5518455544}()); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map