mirror of
https://github.com/codex-team/editor.js
synced 2026-03-16 15:45:47 +01:00
Merge branch 'master' into localstorage-plugin
# Conflicts: # codex-editor.js # codex-editor.js.map # example.html # package.json # whatwg-fetch.js.map
This commit is contained in:
commit
38ac3741b8
13 changed files with 60 additions and 44 deletions
|
|
@ -147,6 +147,7 @@
|
|||
border-radius: 2px;
|
||||
padding: 6px 5px;
|
||||
line-height: 1em;
|
||||
font-size: 14px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
|
|
@ -443,6 +444,7 @@
|
|||
max-width: 100px;
|
||||
word-wrap: break-word;
|
||||
font-size: 12px;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
48
example.html
48
example.html
|
|
@ -104,6 +104,7 @@
|
|||
link: {
|
||||
type: 'link',
|
||||
iconClassname: 'ce-icon-link',
|
||||
prepare: link.prepare,
|
||||
make: link.makeNewBlock,
|
||||
appendCallback: link.appendCallback,
|
||||
render: link.render,
|
||||
|
|
@ -190,38 +191,23 @@
|
|||
},
|
||||
},
|
||||
data : {
|
||||
items: [],
|
||||
savingDate: 0,
|
||||
count: 0
|
||||
/*items: [
|
||||
{
|
||||
type : 'paragraph',
|
||||
data : {
|
||||
text : 'Привет от CodeX'
|
||||
}
|
||||
},
|
||||
{
|
||||
type : 'tweet',
|
||||
data : {
|
||||
"media" : true,
|
||||
"conversation" : false,
|
||||
"user" : null,
|
||||
"id" : 12312312312,
|
||||
"text" : null,
|
||||
"created_at" : null,
|
||||
"status_url" : 'ertertert',
|
||||
"caption" : null
|
||||
},
|
||||
cover : false
|
||||
},
|
||||
{
|
||||
type : 'paragraph',
|
||||
data : {
|
||||
text : 'Пишите нам на team@ifmo.su'
|
||||
}
|
||||
},
|
||||
],
|
||||
count: 2*/
|
||||
items: [
|
||||
{
|
||||
type : 'paragraph',
|
||||
data : {
|
||||
text : 'Привет от CodeX'
|
||||
}
|
||||
},
|
||||
{
|
||||
type : 'paragraph',
|
||||
data : {
|
||||
text : 'Пишите нам на team@ifmo.su'
|
||||
},
|
||||
anchor: 'Update',
|
||||
},
|
||||
],
|
||||
count: 2
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -5,15 +5,13 @@
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
let editor = codex.editor;
|
||||
|
||||
module.exports = function (anchors) {
|
||||
|
||||
let editor = codex.editor;
|
||||
|
||||
anchors.input = null;
|
||||
anchors.currentNode = null;
|
||||
|
||||
const blockWithAnchorClassName = 'ce-block--anchor';
|
||||
|
||||
anchors.settingsOpened = function (currentBlock) {
|
||||
|
||||
anchors.currentNode = currentBlock;
|
||||
|
|
@ -29,11 +27,11 @@ module.exports = function (anchors) {
|
|||
|
||||
if (newAnchor.trim() !== '') {
|
||||
|
||||
anchors.currentNode.classList.add(blockWithAnchorClassName);
|
||||
anchors.currentNode.classList.add(editor.ui.className.BLOCK_WITH_ANCHOR);
|
||||
|
||||
} else {
|
||||
|
||||
anchors.currentNode.classList.remove(blockWithAnchorClassName);
|
||||
anchors.currentNode.classList.remove(editor.ui.className.BLOCK_WITH_ANCHOR);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -194,6 +194,12 @@ module.exports = (function (content) {
|
|||
|
||||
}
|
||||
|
||||
if (targetBlock.classList.contains(editor.ui.className.BLOCK_WITH_ANCHOR)) {
|
||||
|
||||
newBlock.classList.add(editor.ui.className.BLOCK_WITH_ANCHOR);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Saving anchor
|
||||
*/
|
||||
|
|
@ -248,6 +254,12 @@ module.exports = (function (content) {
|
|||
|
||||
}
|
||||
|
||||
if (anchor) {
|
||||
|
||||
newBlock.classList.add(editor.ui.className.BLOCK_WITH_ANCHOR);
|
||||
|
||||
}
|
||||
|
||||
if (workingBlock) {
|
||||
|
||||
editor.core.insertAfter(workingBlock, newBlock);
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ module.exports = (function (renderer) {
|
|||
var block,
|
||||
tool = toolData.tool,
|
||||
pluginName = tool.type,
|
||||
anchor = toolData.anchor,
|
||||
anchor = tool.anchor,
|
||||
cover = tool.cover;
|
||||
|
||||
/** Get first key of object that stores plugin name */
|
||||
|
|
|
|||
|
|
@ -38,6 +38,15 @@ module.exports = (function () {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* If no one passed plugins requires preparation, finish prepare() and go ahead
|
||||
*/
|
||||
if (!pluginsRequiresPreparation.length) {
|
||||
|
||||
resolve_();
|
||||
|
||||
}
|
||||
|
||||
return pluginsRequiresPreparation;
|
||||
|
||||
})
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@ module.exports = (function (ui) {
|
|||
*/
|
||||
BLOCK_IN_FEED_MODE : 'ce-block--feed-mode',
|
||||
|
||||
/**
|
||||
* @const {String} - Block with anchor
|
||||
*/
|
||||
BLOCK_WITH_ANCHOR : 'ce-block--anchor',
|
||||
|
||||
/**
|
||||
* @const {String} - for all default settings
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "codex.editor",
|
||||
"version": "1.4.7",
|
||||
"version": "1.4.8",
|
||||
"description": "Codex Editor. Native JS, based on API and Open Source",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -243,7 +243,11 @@ var link = (function(link) {
|
|||
};
|
||||
|
||||
link.prepare = function (config) {
|
||||
|
||||
link.config = config;
|
||||
|
||||
return Promise.resolve();
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue