mirror of
https://github.com/codex-team/editor.js
synced 2024-06-17 13:15:20 +02:00
Merge branch 'master' into quotes
This commit is contained in:
commit
e7a86559d2
|
@ -390,6 +390,11 @@ cEditor.ui = {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (typeof tool.make != 'function') {
|
||||
cEditor.core.log('make method missed. Tool %o skipped', 'warn', name);
|
||||
continue;
|
||||
}
|
||||
|
||||
tool_button = cEditor.draw.toolbarButton(name, tool.iconClassname);
|
||||
cEditor.nodes.toolbar.appendChild(tool_button);
|
||||
|
||||
|
@ -1369,21 +1374,17 @@ cEditor.toolbar = {
|
|||
appendCallback,
|
||||
newBlock;
|
||||
|
||||
/** Make block from plugin */
|
||||
newBlock = tool.make();
|
||||
|
||||
/** Can replace? */
|
||||
if (REPLACEBLE_TOOLS.indexOf(tool.type) != -1 && workingNode) {
|
||||
|
||||
/**
|
||||
* Copy plugin 'append' Element
|
||||
*/
|
||||
newBlock = tool.append.cloneNode(true);
|
||||
|
||||
/** Replace current block */
|
||||
cEditor.content.switchBlock(workingNode, newBlock, tool.type);
|
||||
|
||||
} else {
|
||||
|
||||
newBlock = tool.append;
|
||||
|
||||
/** Insert new Block from plugin */
|
||||
cEditor.content.insertBlock(newBlock, tool.type);
|
||||
|
||||
|
@ -1855,7 +1856,7 @@ var paragraphTool = {
|
|||
* @param {object} JSON to with block data
|
||||
* @return {Element} element to append
|
||||
*/
|
||||
makeBlockToAppend : function (data) {
|
||||
make : function (data) {
|
||||
|
||||
var tag = document.createElement('P');
|
||||
|
||||
|
@ -1874,7 +1875,7 @@ var paragraphTool = {
|
|||
*/
|
||||
render : function (data) {
|
||||
|
||||
return paragraphTool.makeBlockToAppend(data);
|
||||
return paragraphTool.make(data);
|
||||
|
||||
},
|
||||
|
||||
|
@ -1903,7 +1904,7 @@ cEditor.tools.paragraph = {
|
|||
|
||||
type : 'paragraph',
|
||||
iconClassname : 'ce-icon-paragraph',
|
||||
append : paragraphTool.makeBlockToAppend(),
|
||||
make : paragraphTool.make,
|
||||
appendCallback : null,
|
||||
settings : null,
|
||||
render : paragraphTool.render,
|
||||
|
@ -1922,7 +1923,7 @@ var headerTool = {
|
|||
* @param {object} JSON to with block data
|
||||
* @return {Element} element to append
|
||||
*/
|
||||
makeBlockToAppend : function (data) {
|
||||
make : function (data) {
|
||||
|
||||
var availableTypes = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'],
|
||||
tag;
|
||||
|
@ -1958,7 +1959,7 @@ var headerTool = {
|
|||
*/
|
||||
render : function (data) {
|
||||
|
||||
return headerTool.makeBlockToAppend(data);
|
||||
return headerTool.make(data);
|
||||
|
||||
},
|
||||
|
||||
|
@ -2082,7 +2083,7 @@ cEditor.tools.header = {
|
|||
|
||||
type : 'header',
|
||||
iconClassname : 'ce-icon-header',
|
||||
append : headerTool.makeBlockToAppend(),
|
||||
make : headerTool.make,
|
||||
appendCallback : headerTool.appendCallback,
|
||||
settings : headerTool.makeSettings(),
|
||||
render : headerTool.render,
|
||||
|
|
26
example.html
26
example.html
|
@ -5,26 +5,38 @@
|
|||
<title>CodeX Editor</title>
|
||||
<link rel="stylesheet" href="editor.css" />
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,400italic,600,700,800&subset=latin,cyrillic' rel='stylesheet' type='text/css' async=true>
|
||||
<link href='https://fonts.googleapis.com/css?family=Lora:400,400italic,700,700italic&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
|
||||
<style>
|
||||
body{
|
||||
font-family: 'Open Sans';
|
||||
/*font-family: 'Lora';*/
|
||||
font-size: 14px;
|
||||
}
|
||||
.article{
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h1{
|
||||
font-size: 2em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="padding: 100px">
|
||||
|
||||
<article class="article">
|
||||
|
||||
<h1>CodeX Editor</h1>
|
||||
<h1>CodeX Editor</h1>
|
||||
|
||||
<button id="codex_editor_export_btn">Сохранить</button>
|
||||
<br>
|
||||
<br>
|
||||
<form action="">
|
||||
<button id="codex_editor_export_btn">Сохранить</button>
|
||||
<br>
|
||||
<br>
|
||||
<form action="">
|
||||
|
||||
<textarea hidden name="" id="codex_editor" cols="30" rows="10" style="width: 100%;height: 300px;"></textarea>
|
||||
<textarea hidden name="" id="codex_editor" cols="30" rows="10" style="width: 100%;height: 300px;"></textarea>
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
||||
</article>
|
||||
|
||||
<!--
|
||||
<div class="ce_wrapper">
|
||||
|
|
Loading…
Reference in a new issue