Skip to content
项目

Grafikart/JS-Markdown-Editor

在 GitHub 查看

关于

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

效率与自动化

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

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 as 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)

探索相关项目

加载中…