Wiredcraft / Moleskin

A simple WYSIWYG editor for editing markdown.
23 stars 4 forks source link

Moleskin

Usable with jQuery and Angular

Quick start

Angular

<!-- don't forget jquery -->
<script type="text/javascript" src="https://github.com/Wiredcraft/Moleskin/raw/master/jquery-1.9.1.min.js"></script>

<script type="text/javascript" src="https://github.com/Wiredcraft/Moleskin/raw/master/dist/angular-moleskin.min.js"></script>
<link rel="stylesheet" href="https://github.com/Wiredcraft/Moleskin/blob/master/moleskine.css" />

<moleskine bind-data="content2"
   base-content="static_content"
   class="hey"
   width="550"
   css-class="mole"
   default-mode="markdown"
   input="markdown"
   output="html"
   height="450"></moleskine>

Example in example/angular/index.html

jQuery

<script type="text/javascript" src="https://github.com/Wiredcraft/Moleskin/raw/master/jquery-1.9.1.min.js"></script>

<script type="text/javascript" src="https://github.com/Wiredcraft/Moleskin/raw/master/dist/moleskin.min.js"></script>

<script type="text/javascript">
  $(document).ready(function() {
    el = $('.rte1').moleskine({
      width         : 800,
      height        : 500,
      defaultMode : 'markdown',
      onChange : function(err, data) {
        console.log(data);
      }
    });
  });
</script>

Example in example/jquery/index.html

API

Angular

    scope    : { 
      bindData    : '=',
      baseContent : '=',
      width       : '@',
      height      : '@',
      input       : '@',
      output      : '@',
      defaultMode : '@',
      cssClass    : '@',
      autoGrow    : '@'
    },

jQuery

    this.width      = options.width  || $(textarea).width() || '100%';
    this.height     = options.height || $(textarea).height() || 350;
    this.change         = this.onChange = options.change || function() {};
    this.output         = options.output || null;
    this.input          = options.input  || null;
    this.defaultMode    = options.defaultMode || 'html';
    this.autoGrow       = options.autoGrow || true;
    this.mode           = 'html';

Build

$ grunt compile

Ideas

LICENSE