mirror of
https://github.com/codex-team/editor.js
synced 2024-06-16 12:45:29 +02:00
Paste hotfix
This commit is contained in:
parent
02ab4b50d2
commit
4989affd05
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -197,19 +197,10 @@ module.exports = function (paste) {
|
||||||
*/
|
*/
|
||||||
var insertPastedParagraphs = function (paragraphs) {
|
var insertPastedParagraphs = function (paragraphs) {
|
||||||
|
|
||||||
var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;
|
var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin,
|
||||||
|
currentNode = editor.content.currentNode;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If there was no data in working node, remove it
|
|
||||||
*/
|
|
||||||
if (editor.core.isBlockEmpty(editor.content.currentNode)) {
|
|
||||||
|
|
||||||
editor.content.currentNode.remove();
|
|
||||||
editor.caret.setToPreviousBlock(editor.caret.inputIndex);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
paragraphs.forEach(function (paragraph) {
|
paragraphs.forEach(function (paragraph) {
|
||||||
|
|
||||||
/** Don't allow empty paragraphs */
|
/** Don't allow empty paragraphs */
|
||||||
|
@ -233,6 +224,17 @@ module.exports = function (paste) {
|
||||||
editor.caret.setToPreviousBlock(editor.caret.getCurrentInputIndex() + 1);
|
editor.caret.setToPreviousBlock(editor.caret.getCurrentInputIndex() + 1);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there was no data in working node, remove it
|
||||||
|
*/
|
||||||
|
if (editor.core.isBlockEmpty(currentNode)) {
|
||||||
|
|
||||||
|
currentNode.remove();
|
||||||
|
editor.ui.saveInputs();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue