Skip to content

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

Notifications You must be signed in to change notification settings

npm-dom/wysiwyg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published