All Projects → vsymguysung → ember-cli-summernote

vsymguysung / ember-cli-summernote

Licence: MIT License
ember cli addon for summernote

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to ember-cli-summernote

summernote-templates
Summernote Toolbar Buttons to Add Page and Block Templates.
Stars: ✭ 21 (-32.26%)
Mutual labels:  addon, summernote
addon-airsonos
AirSonos - Home Assistant Community Add-ons
Stars: ✭ 50 (+61.29%)
Mutual labels:  addon
keywi
Minimalistic Keepass plugin using Web Extensions and KeepassHTTP.
Stars: ✭ 33 (+6.45%)
Mutual labels:  addon
deflix-stremio
Deflix addon for Stremio
Stars: ✭ 31 (+0%)
Mutual labels:  addon
gravityforms-repeater
A Gravity Forms add-on that allows specified groups of fields to be repeated by the user.
Stars: ✭ 59 (+90.32%)
Mutual labels:  addon
add-url-to-window-title
A Firefox addon which will put the web page address (URL) into the window's title. Useful for customizing KeePass's auto-type
Stars: ✭ 56 (+80.65%)
Mutual labels:  addon
RaidBrowser
Bringing LFR to Wrath of the Lich King
Stars: ✭ 19 (-38.71%)
Mutual labels:  addon
ghostscript4js
Ghostscript4JS binds the Ghostscript C API to the Node.JS world.
Stars: ✭ 53 (+70.97%)
Mutual labels:  addon
tab-search
WebExtension for keyboard-accessible tab management
Stars: ✭ 102 (+229.03%)
Mutual labels:  addon
laravel-uptime-monitor-api
API Package for Laravel Uptime Monitor
Stars: ✭ 24 (-22.58%)
Mutual labels:  addon
THREEg.js
three.js addon to create special or extended geometries. The addon generates indexed or non indexed BufferGeometries.
Stars: ✭ 33 (+6.45%)
Mutual labels:  addon
ember-eui
Ember Components for Elastic Eui
Stars: ✭ 22 (-29.03%)
Mutual labels:  addon
chinese-support-redux
Anki add-on providing support for Chinese study
Stars: ✭ 88 (+183.87%)
Mutual labels:  addon
pm27-sdk-addons
SDK-based extensions for Pale Moon 27.1+
Stars: ✭ 19 (-38.71%)
Mutual labels:  addon
demo addon
Beispiel-Addon für REDAXO 5. Zeigt den Aufbau und Basisfunktionalität von Addons.
Stars: ✭ 46 (+48.39%)
Mutual labels:  addon
summernote-image-title
Summernote plugin to edit an image title and alt attributes
Stars: ✭ 22 (-29.03%)
Mutual labels:  summernote
ofxAubio
openFrameworks addon for aubio, estimates beat, onset, pitch, and a few other things
Stars: ✭ 56 (+80.65%)
Mutual labels:  addon
Blog-laravel
This is built on Laravel Framework 5.5. This was built for demonstrate purpose.
Stars: ✭ 48 (+54.84%)
Mutual labels:  summernote
KLH-Threat-Meter-17.35
KTM 17.35, version from DuduSandsten (https://nirklars.wordpress.com/wow/addons-rarecustom-addons-by-other-authors/)
Stars: ✭ 14 (-54.84%)
Mutual labels:  addon
whmcs-addon
GOGETSSL WHMCS SSL Addon
Stars: ✭ 28 (-9.68%)
Mutual labels:  addon

Ember-cli-summernote

Build Status NPM Downlaads npm version

Ember Observer Score

Description

Ember-cli-summernote is an Ember CLI add-on. This addon actually converts summernote to an Ember component which is a re-usable unit. This is still a work in progress. Pull requests are welcome.

DEMO

Installation

# install via npm
$ npm install ember-cli-summernote --save-dev
# make ember-cli fetch internal dependencies
$ ember g ember-cli-summernote

Basic Usage

Handlebar Template

As of version 1.1.0, the addon embraces DDAU. The content property is readonly and onContentChange action is used for updated contents.

import Ember from 'ember';

export default Ember.ObjectController.extend({
  contentHeight: 200,
  postContent: "Some intial contents go here. Lorem Ipsum is simply dummy text of the printing.",
  editingDisabled: false,

  actions: {
    onContentChange(text) {
      set(this, 'postContent', text);
    },

    changeHeight(someObject) {
      let height = someObject.doSomeCalculationToGetHeight();
      set(this, 'contentHeight', height)
    }
  }
});

As a result to follow DDAU, the summernote internall callback onChange will not be supported through the callbacks property in a consumming application.

{{summer-note height=contentHeight
              btnSize=bs-sm
              airMode=false
              focus=false
              header="Example"
              content=(readonly postContent)
              onContentChange=(action 'onContentChange')
              disabled=editingDisabled
              callbacks=callbackOptions
              toolbarOptions=toolbarOptions}}

Example of configuring the toolbar options.

    toolbarOptions: {
      style: false,
      insert: {
        picture: false
      },
      help: false
    }

Custom buttons usage

In hbs file

    {{summer-note content=article customButtons=customButtons}}

In controller file

    import Ember from 'ember';

    export default Ember.Controller.extend({
        article: 'some text',
        customButtons: [],

        init() {

            let _onNewBlock = this.get('onNewBlock').bind(this);

            let newBlockButton = function (context) {
                var ui = $.summernote.ui;

                var button = ui.button({
                    contents: '<i class="fa fa-file-text-o"/> New div',
                    tooltip: 'New div',
                    click: _onNewBlock
                });

                return button.render();
            }

            this.customButtons.push(newBlockButton);

        },

        onNewBlock() {
            let blocks = '<div class="header" id="headerBlock"></div>';
            this.set('article', article + blocks);
        }
    });

All callbacks except onChange are supported.

The onChange callback are used internally for the onContentChange action.

    callbackOptions: {
      onInit: function() {
        console.log('Summernote is launched');
      },
      onEnter: function() {
        console.log('Enter/Return key pressed');
      },
      onPaste: function(e) {
        console.log('Called event paste');
      },
    },

config/environment.js

The bootstrap resources will not be imported to your resources by default.

Also you can set lang option for the editor.

var ENV = {
  modulePrefix: 'dummy',
  environment: environment,
  ...
  'ember-cli-summernote': {
    "importBootstrapCSS": true,
    "importBootstrapJS": true,
    "lang": "en-US // "ru-RU" //"lang": "en-US"
  }
}

Test Helper

This addon also provides a convenient test helper to interact with the editor in acceptance tests.

fillInSummernote('.summernote-container', '<p>Test Text Entered.</p>');

getContentFromSummernote('.summernote-container');

Demo

You can clone this repo and run the app

$ sudo npm install -g ember-cli

# clone the codebase
$ git clone http://github.com/vsymguysung/ember-cli-summernote.git
$ cd ember-cli-summernote

# install dependencies
$ npm install; bower install

# fire up local server
$ ember serve

# visit the page with the following url.
http://localhost:4200

Inspired by

License

MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].