Merge branch 'master' into release.1.7

This commit is contained in:
Taly 2018-05-25 17:52:14 +03:00
commit e06590dcf2
No known key found for this signature in database
GPG key ID: F8569511A387BDFB
9 changed files with 5058 additions and 9 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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;
})({});
})({});

View file

@ -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>';
};

View file

@ -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();

View file

@ -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

File diff suppressed because it is too large Load diff

View file

@ -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": {

View file

@ -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('&nbsp;', ' ');
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;
};