wysiwyg
A tiny module to provide users a WYSIWYG editor
Last updated 4 years ago by tehshrike .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install wysiwyg 
SYNC missed versions from official npm registry.

wysiwyg

A tiny module to turn your textarea into a WYSIWYG editor.

Demo @RequireBin

Install

$ npm install wysiwyg

Usage

var wysiwyg = require('wysiwyg')

var editor = wysiwyg(document.querySelector('textarea'))

editor.selectAll()
editor.bold()
editor.color("pink")
editor.link("foobar.com")

editor.read()
// => <b><a href="foobar.com" style="color: pink">hello world</a></b>

When you call it passing a textarea element, it'll:

  • Hide the textarea element
  • Create an editable wysiwyg element (a.k.a content-editable iframe)
  • Copy the current value of the textarea element to the wysiwyg box
  • Update the textarea value as make changes on the editor

Listening Updates

editor.onUpdate(function () {
  console.log('content updated')
})

Reference

See make-editable

Current Tags

  • 2.0.0                                ...           latest (4 years ago)

5 Versions

  • 2.0.0                                ...           4 years ago
  • 0.2.0                                ...           6 years ago
  • 0.0.0                                ...           6 years ago
  • 0.0.1-security                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependencies (4)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |