Coder Social home page Coder Social logo

pks-os / js-markdown-editor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from grafikart/js-markdown-editor

0.0 1.0 0.0 596 KB

An easy to use markdown editor with live preview and Image uploading

License: MIT License

HTML 0.94% JavaScript 87.38% CoffeeScript 3.52% CSS 8.02% PHP 0.13%

js-markdown-editor's Introduction

WIPBICTBF : Work in progress but it's close to be finished

The result

DEMO

How it works

To transform a textarea in an markdown editor you just have to create a new MdEditor instance

var md = new MdEditor('#mdeditor');

You can pass options ass the second parameter

var md = new MdEditor('#mdeditor', {
uploader: false, //'http://local.dev/Lab/MdEditor/app/upload.php?id=',
preview: true,
images: [
  {id: '1.jpg', url: 'http://lorempicsum.com/futurama/200/200/1'},
]
});

Options

I created options for my needs, if you have some new ideas, PR are welcomed.

  • labelClose 'Do you really want to close this window ? Every edit you did could be lost'
  • labelInsert: 'Insert', This label is used within the image uploader
  • labelDelete: 'Delete',
  • labelSuccess: 'Content saved with success', This label is used when saving using ctrl + s
  • labelImage: 'Insert your image url', This label is used within the image uploader is not availabled
  • labelConfirm: 'Do you really want to delete this picture ?'
  • preview: true, Enable the preview for the inline editor (preview is always displayed when fullscreen is enabled
  • uploader: false, false to disable the image uploader (using drag'n drop) or a string containing the REST api endpoint
  • uploaderData: {}, additional data to send when uploading (CSRF token for instance
  • ctrls: true, enable autosaving, it will submit the form using ajax (so if you have additional fields, they will be sent too)
  • images: [], an array containing initial images to display within the image uploader
  • imageURL: function(){ return el.url }, how to fetch the image URL from the image data
  • flash: function(message, type) {return window.alert(message) }, a function that display error or success message. you can replace it using jgrowl or a notification system of your choice.

Contributing

Before you can start you have to download you have to install npm dependencies, bower dependencies, then start gulp serve task

  • npm install
  • bower install
  • gulp serve

Then you can edit app/scripts/mdeditor.coffee to do some edits.

Todo

  • Rework the gulpfile.js
  • Test it on multiple browsers (only tested with chrome atm)

js-markdown-editor's People

Contributors

caporaldead avatar cogwizzle avatar grafikart avatar lackneets avatar

Watchers

 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.