mirror of
https://github.com/codex-team/editor.js
synced 2024-06-10 09:52:36 +02:00
48ac2271f9
Co-authored-by: Murod Khaydarov <murod.haydarov@gmail.com> Co-authored-by: Petr Savchenko <specc.dev@gmail.com> Co-authored-by: George Berezhnoy <gohabereg@gmail.com> Co-authored-by: Taly Guryn <vitalik7tv@yandex.ru>
39 lines
667 B
JavaScript
39 lines
667 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.raw) {
|
|
input.value = data.raw;
|
|
}
|
|
|
|
return input;
|
|
};
|
|
|
|
plugin.save = function (block) {
|
|
return {
|
|
raw: block.value
|
|
};
|
|
};
|
|
|
|
plugin.validate = function (data) {
|
|
if (data.raw.trim() === '') {
|
|
return;
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
plugin.destroy = function () {
|
|
rawPlugin = null;
|
|
};
|
|
|
|
return plugin;
|
|
}({}); |