Destroy module (#157)

* listeners module added

* Destroy method added

* Destroy method for plugins added

* Delete plugins properties from window obj

* Revert "Delete plugins properties from window obj"

This reverts commit 6c91f81229.

* Twitter and instagram api's destroy

* Scripts destoy added

* Fix

* Replace regex with String.indexOf

* Settings for destroyer
This commit is contained in:
George Berezhnoy 2017-02-13 20:54:18 +03:00 committed by Peter Savchenko
commit d2e755086a
35 changed files with 535 additions and 169 deletions

View file

@ -3,7 +3,7 @@
* Creates code tag and adds content to this tag
*/
var code = (function(code) {
var code = (function(code_plugin) {
var baseClass = "ce-code";
@ -28,7 +28,7 @@ var code = (function(code) {
/**
* Method to render HTML block from JSON
*/
code.render = function (data) {
code_plugin.render = function (data) {
return make_(data);
};
@ -36,7 +36,7 @@ var code = (function(code) {
/**
* Method to extract JSON data from HTML block
*/
code.save = function (blockContent){
code_plugin.save = function (blockContent) {
var data = {
text : blockContent.innerHTML
@ -45,7 +45,7 @@ var code = (function(code) {
};
code.validate = function(data) {
code_plugin.validate = function (data) {
if (data.text.trim() == '')
return;
@ -53,6 +53,12 @@ var code = (function(code) {
return true;
};
return code;
code_plugin.destroy = function () {
code = null;
};
return code_plugin;
})({});