GithubHelp home page GithubHelp logo

nvdnkpr / medium-editor-insert-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from linkesch/medium-editor-insert-plugin

0.0 2.0 0.0 1.54 MB

jQuery insert plugin for MediumEditor (Medium.com WYSIWYG editor clone)

Home Page: http://orthes.github.io/medium-editor-insert-plugin

License: MIT License

medium-editor-insert-plugin's Introduction

jQuery insert plugin for MediumEditor

This plugin expands capabilities of MediumEditor which is a clone of medium.com WYSIWYG editor.

The plugin is next, completely rewritten version of previous "images plugin". Now inserting images is only one of the plugin's addons. More addons (inserting files and maps) are coming soon...

Build Status

Table of Contents

Demo

http://orthes.github.io/medium-editor-insert-plugin

Available Addons

Current available addons:

  • images

More are coming soon...

Download

Usage

The first step is to add all prerequisites (MediumEditor and jQuery):

<link rel="stylesheet" href="medium-editor/css/medium-editor.css">
<script src="medium-editor/js/medium-editor.min.js"></script>
<script src="bower_components/jquery/jquery.min.js"></script>

Now you have two possibilites. You can load all addons at once:

<link rel="stylesheet" href="medium-editor-insert-plugin/css/medium-editor-insert-plugin.css">
<script src="medium-editor-insert-plugin/js/medium-editor-insert-plugin.all.min.js"></script>

Or if you for some reason want, you can load only addons that you want separately. In this case, don't forget to load medium-editor-insert-plugin.min.js, which is the main plugin file, that initializes addons:

<link rel="stylesheet" href="medium-editor-insert-plugin/css/medium-editor-insert-plugin.css">
<script src="medium-editor-insert-plugin/js/addons/medium-editor-insert-plugin.min.js"></script>
<script src="medium-editor-insert-plugin/js/addons/medium-editor-insert-images.min.js"></script>

Initialize MediumEditor as you normally would:

<script>var editor = new MediumEditor('.editable');</script>

Finally, you can initialize the insert plugin with images addon:

$(function () {
  $('.editable').mediumInsert({
    editor: editor,
    images: true
  });
});

Options

  • editor: (MediumEditor) instance of MediumEditor
  • imagesUploadScript: (string) relative path to a script that handles file uploads. Default: upload.php
  • images: (boolean) whether to use images addon: Default true. (NOTICE: Remember to use medium-editor-insert-plugin.all.min.js, which includes all addons, or separately load medium-editor-insert-plugin.min.js and medium-editor-insert-images.min.js)
  • maps: (boolean) whether to use maps addon: Default false. (NOTICE: Remember to use medium-editor-insert-plugin.all.min.js, which includes all addons, or separately load medium-editor-insert-plugin.min.js and medium-editor-insert-maps.min.js)
  • enabled: (boolean) plugin's state: Default true.
  • imagesPlugin: (object) options for images addon
    • formatData: (function) function that formats data before sending them to server while uploading an image

Methods

  • enable: enables the plugin. It's connected to Medium Editor's own activate function, so if the editor is activated, so is the plugin. (The plugin is enabled automatically. Use it only if you previously disabled the plugin.)
  • disable: disables the plugin. It's connected to Medium Editor's own deactivate function, so if the editor is deactivated, so is the plugin.

Use example:

$('.editable').mediumInsert('disable');

Development

The plugin uses Grunt for automating development tasks and Bower for package management. To install all the necessities for development run these commands:

npm install
bower install

These are available Grunt tasks:

  • js: runs jshint, uglify and copy
  • css: runs compass
  • test: runs jshint and qunit
  • watch: watches for modifications on script/scss files and runs js/css task

Contributing

I'm happy when you not only use the plugin, but contribute your improvements, too. To do that, you need to meet only two requirements:

  1. Use the same coding style as the plugin
  2. Write QUnit tests (if you're adding a new funcionality) and test your changes with grunt test

Author

Pavel Linkesch | @linkesch | http://www.linkesch.sk

Bitdeli Badge

medium-editor-insert-plugin's People

Contributors

linkesch avatar iamfiras avatar brenfrow avatar miloshadzic avatar bitdeli-chef avatar maxkirchoff avatar ironwren avatar

Watchers

Navid Nikpour avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.