mirror of
https://github.com/codex-team/editor.js
synced 2024-06-02 22:12:27 +02:00
Merge branch 'master' into add-update
This commit is contained in:
commit
5e9c0a175f
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
11
example.html
11
example.html
|
@ -60,6 +60,7 @@
|
||||||
codex.editor.start({
|
codex.editor.start({
|
||||||
holderId : "codex-editor",
|
holderId : "codex-editor",
|
||||||
initialBlockPlugin : 'paragraph',
|
initialBlockPlugin : 'paragraph',
|
||||||
|
// placeholder: 'Прошлой ночью мне приснилось...',
|
||||||
hideToolbar: false,
|
hideToolbar: false,
|
||||||
tools : {
|
tools : {
|
||||||
paragraph: {
|
paragraph: {
|
||||||
|
@ -221,9 +222,10 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data : {
|
data : {
|
||||||
|
id: +new Date(),
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
type : 'paragraph',
|
type : 'header',
|
||||||
data : {
|
data : {
|
||||||
text : 'Привет от CodeX'
|
text : 'Привет от CodeX'
|
||||||
}
|
}
|
||||||
|
@ -234,13 +236,6 @@
|
||||||
text : 'Пишите нам на team@ifmo.su'
|
text : 'Пишите нам на team@ifmo.su'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type : 'list',
|
|
||||||
data : {
|
|
||||||
type : 'OL',
|
|
||||||
items : [1,3,4]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
count: 3
|
count: 3
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ module.exports = (function (core) {
|
||||||
|
|
||||||
editor.hideToolbar = userSettings.hideToolbar;
|
editor.hideToolbar = userSettings.hideToolbar;
|
||||||
|
|
||||||
|
editor.settings.placeholder = userSettings.placeholder || '';
|
||||||
|
|
||||||
editor.nodes.holder = document.getElementById(userSettings.holderId || editor.settings.holderId);
|
editor.nodes.holder = document.getElementById(userSettings.holderId || editor.settings.holderId);
|
||||||
|
|
||||||
if (typeof editor.nodes.holder === undefined || editor.nodes.holder === null) {
|
if (typeof editor.nodes.holder === undefined || editor.nodes.holder === null) {
|
||||||
|
|
|
@ -152,6 +152,7 @@ module.exports = (function (saver) {
|
||||||
editor.state.jsonOutput = items;
|
editor.state.jsonOutput = items;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: editor.state.blocks.id || null,
|
||||||
time: +new Date(),
|
time: +new Date(),
|
||||||
version: editor.version,
|
version: editor.version,
|
||||||
items
|
items
|
||||||
|
@ -161,4 +162,4 @@ module.exports = (function (saver) {
|
||||||
|
|
||||||
return saver;
|
return saver;
|
||||||
|
|
||||||
})({});
|
})({});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Toolbar settings
|
* Toolbar settings
|
||||||
*
|
*
|
||||||
* @version 1.0.4
|
* @version 1.0.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = (function (settings) {
|
module.exports = (function (settings) {
|
||||||
|
@ -22,22 +22,20 @@ module.exports = (function (settings) {
|
||||||
* Append settings content
|
* Append settings content
|
||||||
* It's stored in tool.settings
|
* 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');
|
return;
|
||||||
editor.nodes.pluginSettings.innerHTML = `Плагин «${toolType}» не имеет настроек`;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw settings block
|
|
||||||
*/
|
|
||||||
var settingsBlock = editor.tools[toolType].makeSettings();
|
|
||||||
|
|
||||||
editor.nodes.pluginSettings.appendChild(settingsBlock);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw settings block
|
||||||
|
*/
|
||||||
|
var settingsBlock = editor.tools[toolType].makeSettings();
|
||||||
|
|
||||||
|
editor.nodes.pluginSettings.appendChild(settingsBlock);
|
||||||
|
|
||||||
|
|
||||||
/** Open settings block */
|
/** Open settings block */
|
||||||
editor.nodes.blockSettings.classList.add('opened');
|
editor.nodes.blockSettings.classList.add('opened');
|
||||||
this.opened = true;
|
this.opened = true;
|
||||||
|
@ -171,4 +169,4 @@ module.exports = (function (settings) {
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
|
|
||||||
})({});
|
})({});
|
||||||
|
|
|
@ -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');
|
editor.nodes.toolbar.classList.add('opened');
|
||||||
this.opened = true;
|
this.opened = true;
|
||||||
|
|
||||||
|
@ -118,4 +130,4 @@ module.exports = (function (toolbar) {
|
||||||
|
|
||||||
return toolbar;
|
return toolbar;
|
||||||
|
|
||||||
})({});
|
})({});
|
||||||
|
|
|
@ -258,11 +258,6 @@ module.exports = (function (ui) {
|
||||||
command : 'italic'
|
command : 'italic'
|
||||||
},
|
},
|
||||||
|
|
||||||
underline: {
|
|
||||||
icon : 'ce-icon-underline',
|
|
||||||
command : 'underline'
|
|
||||||
},
|
|
||||||
|
|
||||||
link: {
|
link: {
|
||||||
icon : 'ce-icon-link',
|
icon : 'ce-icon-link',
|
||||||
command : 'createLink'
|
command : 'createLink'
|
||||||
|
@ -410,7 +405,7 @@ module.exports = (function (ui) {
|
||||||
|
|
||||||
initialBlock = editor.tools[initialBlockType].render();
|
initialBlock = editor.tools[initialBlockType].render();
|
||||||
|
|
||||||
initialBlock.setAttribute('data-placeholder', 'Расскажите свою историю...');
|
initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);
|
||||||
|
|
||||||
editor.content.insertBlock({
|
editor.content.insertBlock({
|
||||||
type : initialBlockType,
|
type : initialBlockType,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "codex.editor",
|
"name": "codex.editor",
|
||||||
"version": "1.7.1",
|
"version": "1.7.6",
|
||||||
"description": "Codex Editor. Native JS, based on API and Open Source",
|
"description": "Codex Editor. Native JS, based on API and Open Source",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in a new issue