cover restoring and fetch function fixed (#101)

* cover restoring fixed

* upd

* fetch fixed in safari

* updated

* plugins

* plugins ready

* code improved

* fixed bug with backspace

* improved architecture
This commit is contained in:
khaydarov 2016-12-25 17:41:57 +03:00 committed by Peter Savchenko
commit bc8fb1aed9
53 changed files with 3924 additions and 189 deletions

25
plugins/code/code.css Normal file
View file

@ -0,0 +1,25 @@
.ce-code {
display: block;
border: 1px solid #ebeef3;
border-radius: 3px;
background: #fdfdff !important;
margin: 1em 0 !important;
padding: .5em .8em;
box-sizing: border-box;
white-space: pre-wrap;
font-family: 'monospace', 'monaco', 'consolas', 'courier';
line-height: 1.5em;
color: #325179;
font-size: .8em;
}
/**
* CodeX Editor styles overlay
* @todo change for ce-tool-wrapper__code
*/
.ce_block[data-type="code"]{
padding: 1em 0 !important;
}

54
plugins/code/code.js Normal file
View file

@ -0,0 +1,54 @@
/**
* Code Plugin\
* Creates code tag and adds content to this tag
*/
var codeTool = {
baseClass : "ce-code",
/**
* Make initial header block
* @param {object} JSON with block data
* @return {Element} element to append
*/
make : function (data) {
var tag = document.createElement('code');
tag.classList.add(codeTool.baseClass);
if (data && data.text) {
tag.innerHTML = data.text;
}
tag.contentEditable = true;
return tag;
},
/**
* Method to render HTML block from JSON
*/
render : function (data) {
return codeTool.make(data);
},
/**
* Method to extract JSON data from HTML block
*/
save : function (blockContent){
var data = {
text : null,
};
data.text = blockContent.innerHTML;
return data;
}
};