wysiwyg
A tiny module to provide users a WYSIWYG editor
Last updated 6 years ago by npm .
BSD · Repository · 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 (5 years ago)

5 Versions

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

Copyright 2014 - 2017 © taobao.org |