way2web-summernote
Version:
Way 2 Summernote.
100 lines (63 loc) • 1.93 kB
Markdown
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url]
Example implementation:
```
$('.js-wysiwyg').each(function() {
new W2Summernote()
.element($(this))
.init();
});
```
Attach summernote.
Summernote is a JavaScript library that helps you create WYSIWYG editors online.
With the function toolbar you can send an array with the toolbars.
```
[
['style', ['bold', 'italic', 'underline', 'clear']],
['font', ['strikethrough', 'superscript', 'subscript']],
['para', ['ul', 'ol', 'paragraph']],
['insert', ['link']],
['misc', ['undo', 'redo']],
['codeview', ['codeview']]
]
```
Set the element of the textarea to attach the summernote wysiwyg editor.
Default value:
`.js-wysiwyg`
Set the height of the summernote wysiwyg editor.
Default value:
`300`
Turn the tooltip on or off.
Default value:
`true`
Get the HTML contents of the first summernote in the set of matched elements.
A string of HTML to set as the content of each matched element.
```
var markupString = 'hello world';
new W2Summernote(markupString).set().init();
```
Unset summernote.
To test the package, clone the package to your system.
Than run this command.
```
npm run build
```
This will copy the test files to the dist, and also build the package files include the dependencies.
When this script is complete without errors, you can open `dist/index.html` in your browser.
Open the dev tools, tab console, and you see all the results of the tests.
If you only want to check the eslint rules, just run.
```
npm run lint
```
[]: https://img.shields.io/npm/dm/way2web-summernote.svg
[]: https://www.npmjs.com/package/way2web-summernote
[]: https://img.shields.io/npm/v/way2web-summernote.svg