Merge branch 'master' into add-update

This commit is contained in:
George Berezhnoy 2017-08-30 14:20:13 +03:00
commit 5e9c0a175f
9 changed files with 36 additions and 33 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -60,6 +60,7 @@
codex.editor.start({
holderId : "codex-editor",
initialBlockPlugin : 'paragraph',
// placeholder: 'Прошлой ночью мне приснилось...',
hideToolbar: false,
tools : {
paragraph: {
@ -221,9 +222,10 @@
},
},
data : {
id: +new Date(),
items: [
{
type : 'paragraph',
type : 'header',
data : {
text : 'Привет от CodeX'
}
@ -234,13 +236,6 @@
text : 'Пишите нам на team@ifmo.su'
}
},
{
type : 'list',
data : {
type : 'OL',
items : [1,3,4]
}
}
],
count: 3
}

View file

@ -45,6 +45,8 @@ module.exports = (function (core) {
editor.hideToolbar = userSettings.hideToolbar;
editor.settings.placeholder = userSettings.placeholder || '';
editor.nodes.holder = document.getElementById(userSettings.holderId || editor.settings.holderId);
if (typeof editor.nodes.holder === undefined || editor.nodes.holder === null) {

View file

@ -152,6 +152,7 @@ module.exports = (function (saver) {
editor.state.jsonOutput = items;
return {
id: editor.state.blocks.id || null,
time: +new Date(),
version: editor.version,
items

View file

@ -1,7 +1,7 @@
/**
* Toolbar settings
*
* @version 1.0.4
* @version 1.0.5
*/
module.exports = (function (settings) {
@ -22,12 +22,11 @@ module.exports = (function (settings) {
* Append settings content
* It's stored in tool.settings
*/
if (!editor.tools[toolType] || !editor.tools[toolType].makeSettings ) {
if ( !editor.tools[toolType] || !editor.tools[toolType].makeSettings ) {
editor.core.log(`Plugin «${toolType}» has no settings`, 'warn');
editor.nodes.pluginSettings.innerHTML = `Плагин «${toolType}» не имеет настроек`;
return;
} else {
}
/**
* Draw settings block
@ -36,7 +35,6 @@ module.exports = (function (settings) {
editor.nodes.pluginSettings.appendChild(settingsBlock);
}
/** Open settings block */
editor.nodes.blockSettings.classList.add('opened');

View file

@ -40,6 +40,18 @@ module.exports = (function (toolbar) {
}
let toolType = editor.content.currentNode.dataset.tool;
if (!editor.tools[toolType] || !editor.tools[toolType].makeSettings ) {
editor.nodes.showSettingsButton.classList.add('hide');
} else {
editor.nodes.showSettingsButton.classList.remove('hide');
}
editor.nodes.toolbar.classList.add('opened');
this.opened = true;

View file

@ -258,11 +258,6 @@ module.exports = (function (ui) {
command : 'italic'
},
underline: {
icon : 'ce-icon-underline',
command : 'underline'
},
link: {
icon : 'ce-icon-link',
command : 'createLink'
@ -410,7 +405,7 @@ module.exports = (function (ui) {
initialBlock = editor.tools[initialBlockType].render();
initialBlock.setAttribute('data-placeholder', 'Расскажите свою историю...');
initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);
editor.content.insertBlock({
type : initialBlockType,

View file

@ -1,6 +1,6 @@
{
"name": "codex.editor",
"version": "1.7.1",
"version": "1.7.6",
"description": "Codex Editor. Native JS, based on API and Open Source",
"main": "index.js",
"scripts": {