forked from guardian/scribe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cjs.js
31 lines (23 loc) · 890 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
/**
* 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 the following file: build-cjs.sh.
*
* 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();