forked from guardian/scribe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cjs.js
35 lines (27 loc) · 1010 Bytes
/
cjs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* This example demonstrates how to consume the Scribe
* editor using `browserify` and CommonJS module syntax.
*
* Note that you'll need to install scribe's dependencies
* through `npm install`. `npm` is installed with Node.js.
* See http://nodejs.org/ if you are unfamiliar.
*
* In order to compile the `build.js` file, run these commands:
*
* $ npm install deamdify
* $ npm install scribe-plugin-toolbar
* $ browserify -g deamdify examples/cjs.js > examples/build.js
*
* See the `examples/cjs.html` file to see where this entry point
* ends up being consumed.
*/
var Scribe = require('../');
var scribePluginToolbar = require('scribe-plugin-toolbar');
var scribe = new Scribe(document.getElementById('editor'));
scribe.setContent('<p>Hello, World!</p>');
scribe.use(scribePluginToolbar(document.querySelector('.toolbar')));
function updateHtml() {
document.querySelector('.editor-output').value = scribe.getHTML();
}
scribe.on('content-changed', updateHtml);
updateHtml();