editor.js/plugins/raw/raw.js
khaydarov fe40755aa9 Update v1.5 to v1.5.4 (#169)
* quote now saves HTML in author and job

* Quote.js improved

* Fix (#165)

* Remove tool type from switchBlock -> by default it will saved from previous (#166)

* small fixes

regex match must not be similar to pasted string. Ex:
```https://www.instagram.com/p/BQ3wxmlA5GN/?taken-by=thenotoriousmma``
and match is ```https://www.instagram.com/p/BQ3wxmlA5GN/```.

```SwitchBlock``` have 3 parameter that is not important

* new instagram embed regex

* raw plugin added (#163)

* raw plugin added

* Try to paste raw html to raw plugin

* insert text/plain to native area instead of contenteditable element

* styles updated

* rename variable

* fixed raw backspace click handler

* paste code

* Replace mask with two svg icons

* Toolbox leaf fix

* Remove data in example.html

* Toolbar and caret behavior improvments

* upd

* Upd

* new bundle due the local merge

* new ui module (#167)
2017-02-27 17:32:33 +03:00

51 lines
No EOL
765 B
JavaScript

/**
* Plugin for CodeX.Editor
* Implements RAW-data block
*/
var rawPlugin = function (plugin) {
var editor = codex.editor;
plugin.render = function (data) {
var input = editor.draw.node('TEXTAREA', 'raw-plugin__input', {});
input.placeholder = 'Вставьте HTML код';
if (data && data.html) {
input.value = data.html;
}
return input;
};
plugin.save = function (block) {
return {
html: block.value
};
};
plugin.validate = function (data) {
if (data.html.trim() === '') {
return;
}
return true;
};
plugin.destroy = function () {
rawPlugin = null;
};
return plugin;
}({});