npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-simplemde

v1.3.1

Published

A component wrapper for SimpleMDE markdown editor

Downloads

546

Readme

ember-simplemde

Standard - JavaScript Style Guide Latest NPM release Ember Observer Score License Dependencies Dev Dependencies Build Status

A wrapper around the SimpleMDE editor for use in ember-cli projects, it provides a component simple-mde to show the editor, and a helper to show the rendered html simple-mde-preview you can check this on the dummy app application template.

Usage on ember project

  • Install with ember install ember-simplemde

  • Use the component with:

    // Controller
    theValue: "This is a test of **simpleMDE**"
    {{simple-mde value=theValue change=(action (mut theValue))}}
  • Use the helper like this:

    {{simple-mde-preview theValue}}

Passing options to simpleMDE

ember-simplemde supports all options that SimpleMDE supports.

full list of all simpleMde options

You can pass options through to the simpleMDE instance in two ways.

Define Options in your ember config that will be applied to all simpleMDE instances

You can pass global options that will be applied to all editors via the consuming apps config/environment with a property called simpleMDE. For example, if you wanted to remove the toolbar from all instances:

module.exports = function(environment) {
  var ENV = {
    ...
    simpleMDE: {
      toolbar: false,
      ... any simpleMDE options go here
    },
    ...
  };

Note on toolbar options action handlers: If you are customizing the simpleMDE toolbar options from the consuming apps config, simpleMDE needs you to pass toolbar option action handlers as function references. In ember configs, we can only express these function references as strings. Ember-simplemde has a mechanism in place to unpack these strings as function references against the window.SimpleMDE global. So, if you are expressing a custom toolbar option from your consuming apps config, pass the toolbar action handlers as strings. If you are passing options to the instance and not using your ember/config you can use function reference's/definitions like normal.

For example, the action handler below will be unpacked against the window as

window['SimpleMDE']['toggleBold']
module.exports = function(environment) {
  var ENV = {
    ...
    simpleMDE: {
      toolbar: [
        {
          name: 'bold',
          action: 'SimpleMDE.toggleBold',
          className: 'fa fa-bold',
          title: 'Bold'
        }
      ]
    },
    ...
  };

Define options on the individual editor instance

You can pass instance options via the simple-mde components options attribute. The options attribute will overwrite global options via ember.assign so if you want instance options to squash global options you can use this. An example of this is in the tests/dummy/app/application.hbs and the corresponding application controller.

{{simple-mde value=value options=simpleMdeOptions}}

Note: This options parameter is NOT watched. Changing it during runtime will not change the instance properties.

Installation

  • git clone https://github.com/smith-carson/ember-simplemde.git
  • cd ember-simplemde
  • npm install
  • bower install

Linting

  • npm run lint:hbs
  • npm run lint:js
  • npm run lint:js -- --fix

Running tests

  • ember test – Runs the test suite on the current Ember version
  • ember test --server – Runs the test suite in "watch mode"
  • ember try:each – Runs the test suite against multiple Ember versions

Running the dummy application

For more information on using ember-cli, visit http://ember-cli.com/.