Skip to content
This repository has been archived by the owner on Mar 30, 2018. It is now read-only.

An extension to Ember CLI Medium Editor to enable custom buttons with the MediumButton plugin

License

Notifications You must be signed in to change notification settings

willviles/ember-medium-editor-button

Repository files navigation

This addon is deprecated as it is based on the unmaintained Ember CLI Medium Editor. Please check out its successor Ember Medium Editor instead.

Ember Medium Editor Button npm

This Ember Addon extends the functionality of ember-cli-medium-editor to include MediumButton. MediumButton enables a quick way to add custom buttons to the Medium Editor toolbar.

Demo

https://stillhart.biz/project/MediumButton/

Installation

To install, make sure you've installed ember-cli-medium-editor.

ember install ember-cli-medium-editor

Then simply run:

ember install ember-medium-editor-button

To satisfy jshint, add MediumButton to the predef array in .jshintrc.

Usage

Follow the usage instructions in the MediumButton plugin.

This addon simply includes the plugin via Bower and exposes MediumButton as an ES6 import.

import MediumButton from 'ember-medium-editor-button';

Example

The following example adds a simple custom button which generates a <hr> horizontal line.

import MediumButton from 'ember-medium-editor-button';

{
  options: {
    // ... ember-cli-medium-editor options
    extensions: {
      'hr': new MediumButton({
        label: '<i class="icon-hr"></i>',
        action(html, mark, parent) {
          Ember.$(parent).remove();
          return '<hr>';
        }
      })
    },
    toolbar: {
      buttons: [
        'hr'
      ]
    }  
  }
}

About

An extension to Ember CLI Medium Editor to enable custom buttons with the MediumButton plugin

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published