mirror of
https://github.com/codex-team/editor.js
synced 2024-06-10 18:03:25 +02:00
Merge branch 'master' into release.1.7
This commit is contained in:
commit
e06590dcf2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -98,7 +98,7 @@ module.exports = (function (caret) {
|
|||
}
|
||||
|
||||
/** Looking for parent contentEditable block */
|
||||
while (focusedNode.contentEditable != 'true') {
|
||||
while (focusedNode && focusedNode.contentEditable != 'true') {
|
||||
|
||||
focusedNodeHolder = focusedNode.parentNode;
|
||||
focusedNode = focusedNodeHolder;
|
||||
|
@ -302,4 +302,4 @@ module.exports = (function (caret) {
|
|||
|
||||
return caret;
|
||||
|
||||
})({});
|
||||
})({});
|
||||
|
|
|
@ -720,6 +720,8 @@ module.exports = (function (content) {
|
|||
*/
|
||||
var wrapPlainTextWithParagraphs = function (plainText) {
|
||||
|
||||
if (!plainText) return '';
|
||||
|
||||
return '<p>' + plainText.split('\n\n').join('</p><p>') + '</p>';
|
||||
|
||||
};
|
||||
|
|
|
@ -174,6 +174,9 @@ module.exports = (function (notifications) {
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* Show notification block
|
||||
*/
|
||||
function send() {
|
||||
|
||||
editor.nodes.notifications.appendChild(notification);
|
||||
|
@ -191,6 +194,9 @@ module.exports = (function (notifications) {
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove notification block
|
||||
*/
|
||||
function close() {
|
||||
|
||||
notification.remove();
|
||||
|
|
|
@ -91,6 +91,12 @@ module.exports = (function (inline) {
|
|||
newCoordinateX,
|
||||
newCoordinateY;
|
||||
|
||||
if (!coords) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (toolbar.offsetHeight === 0) {
|
||||
|
||||
defaultOffset = 40;
|
||||
|
@ -590,4 +596,4 @@ module.exports = (function (inline) {
|
|||
|
||||
return inline;
|
||||
|
||||
})({});
|
||||
})({});
|
||||
|
|
5018
package-lock.json
generated
Normal file
5018
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "codex.editor",
|
||||
"version": "1.7.7",
|
||||
"version": "1.7.9",
|
||||
"description": "Codex Editor. Native JS, based on API and Open Source",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -67,8 +67,25 @@ var paragraph = (function(paragraph_plugin) {
|
|||
*/
|
||||
paragraph_plugin.validate = function(output) {
|
||||
|
||||
if (output.text === '')
|
||||
return;
|
||||
let text = output.text;
|
||||
|
||||
text = text.replace(' ', ' ');
|
||||
text = text.replace(/\s/g, ' ');
|
||||
text = text.trim();
|
||||
|
||||
/**
|
||||
* Check for empty <p>:
|
||||
* <p> </p>
|
||||
*/
|
||||
let div = document.createElement('div');
|
||||
div.innerHTML = text;
|
||||
|
||||
text = div.textContent.trim();
|
||||
|
||||
if (!text) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return output;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue