Sha256: 6f76fd810d0440cb9e680c3e17b5d548e70293f8bba8f99aa89664c4a33c7a7d

Contents?: true

Size: 1.29 KB

Versions: 18

Compression:

Stored size: 1.29 KB

Contents

(function($) {
  elRTE.prototype.codeMirror = true;
  elRTE.prototype.updateSourceOld = elRTE.prototype.updateSource;
  elRTE.prototype.updateSource = function() {
    if( this.codeMirror ) {
      var blockHtmlElements = 'h[1-6]|div|p|blockquote|pre|form|label|select|input|button|ol|ul|dd|dt|li|table|thead|tbody|td|th|tr';
      
      var html = this.filter.source($(this.doc.body).html());
      html = html.replace(new RegExp('(</?(' + blockHtmlElements + ')[^<]*?>)\\s*', 'gi'), '$1\n')
        .replace(new RegExp('\\s*(</?(' + blockHtmlElements + ')[^<]*?>)', 'gi'), '\n$1');
      this.source.val(html);
        
      this.codeMirror = CodeMirror.fromTextArea(this.source[0], {
        mode:         'htmlmixed',
        tabMode:      'indent',
        lineWrapping: true
      });
      for (var i = 0, e = this.codeMirror.lineCount(); i < e; ++i) this.codeMirror.indentLine(i);
      
      this.source.css('display','block')
        .css('position','absolute')
        .css('z-index','-1');
    } else {
      this.updateSourceOld();
    }
  }

  elRTE.prototype.updateEditorOld = elRTE.prototype.updateEditor;
  elRTE.prototype.updateEditor = function() {
    if( this.codeMirror ){
      this.codeMirror.toTextArea();
      this.source.css('display','none');	
    }
    this.updateEditorOld();
  }
})(jQuery);

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.6.31 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.30 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.26 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.25 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.24 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.23 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.22 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.21 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.20 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.19 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.18 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.17 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.16 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.15 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.14 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.13 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.12 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js
comfortable_mexican_sofa-1.6.11 app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js