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
@ -161,4 +162,4 @@ module.exports = (function (saver) {
return saver;
})({});
})({});

View file

@ -1,7 +1,7 @@
/**
* Toolbar settings
*
* @version 1.0.4
* @version 1.0.5
*/
module.exports = (function (settings) {
@ -22,22 +22,20 @@ 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}» не имеет настроек`;
} else {
/**
* Draw settings block
*/
var settingsBlock = editor.tools[toolType].makeSettings();
editor.nodes.pluginSettings.appendChild(settingsBlock);
return;
}
/**
* Draw settings block
*/
var settingsBlock = editor.tools[toolType].makeSettings();
editor.nodes.pluginSettings.appendChild(settingsBlock);
/** Open settings block */
editor.nodes.blockSettings.classList.add('opened');
this.opened = true;
@ -171,4 +169,4 @@ module.exports = (function (settings) {
return settings;
})({});
})({});

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;
@ -118,4 +130,4 @@ module.exports = (function (toolbar) {
return toolbar;
})({});
})({});

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": {