scribe-editor
Advanced tools
Comparing version 0.1.17 to 0.1.18
@@ -9,12 +9,7 @@ { | ||
"requirejs": "~2.1.9", | ||
"scribe": "guardian/scribe#master", | ||
"scribe-plugin-blockquote-command": "guardian/scribe-plugin-blockquote-command#master", | ||
"scribe-plugin-curly-quotes": "guardian/scribe-plugin-curly-quotes#master", | ||
"scribe-plugin-formatter-plain-text-convert-new-lines-to-html": "guardian/scribe-plugin-formatter-plain-text-convert-new-lines-to-html#master", | ||
"scribe-plugin-heading-command": "guardian/scribe-plugin-heading-command#master", | ||
"scribe-plugin-intelligent-unlink-command": "guardian/scribe-plugin-intelligent-unlink-command#master", | ||
"scribe-plugin-keyboard-shortcuts": "guardian/scribe-plugin-keyboard-shortcuts#master", | ||
"scribe-plugin-link-prompt-command": "guardian/scribe-plugin-link-prompt-command#master", | ||
"scribe-plugin-sanitizer": "guardian/scribe-plugin-sanitizer#master", | ||
"scribe-plugin-smart-lists": "guardian/scribe-plugin-smart-lists#master", | ||
"scribe-plugin-toolbar": "guardian/scribe-plugin-toolbar#master", | ||
@@ -21,0 +16,0 @@ "scribe-plugin-inline-styles-to-elements": "guardian/scribe-plugin-inline-styles-to-elements#master" |
@@ -46,2 +46,5 @@ ## List of `contenteditable` Browser Inconsistencies | ||
height`: http://jsbin.com/OtemujAY/10/edit?html,css,js,output | ||
- Chrome does not add a BR element when there is no `DOCTYPE`: | ||
http://jsbin.com/sasec/1/edit?js,console,output | ||
https://code.google.com/p/chromium/issues/detail?id=396654&thanks=396654&ts=1406132418 | ||
* "`indent`": | ||
@@ -93,2 +96,4 @@ - Chrome nests BLOCKQUOTE inside of P: | ||
-treewalker-not-working-with-documentfragments | ||
* Firefox: Selection object never gets access to text nodes, only parent | ||
elements: http://jsbin.com/rotus/2/edit?js,output,console | ||
@@ -95,0 +100,0 @@ ### `Range.commonAncestorContainer` |
@@ -0,1 +1,4 @@ | ||
# 0.0.18 | ||
* Fix [New line detection improved](https://github.com/guardian/scribe/pull/253) | ||
# 0.1.17 | ||
@@ -2,0 +5,0 @@ * Allow entering multiple consecutive spaces ([c4ba50eb](https://github.com/guardian/scribe/commit/c4ba50ebe457066f06daa5efe98e0a345658ac54) [#232](https://github.com/guardian/scribe/pull/232)) |
@@ -72,3 +72,4 @@ # Contributing | ||
* `bower prune` | ||
* `git add --update .` | ||
* `git add --update .` (don't include untracked files from source Bower | ||
components) | ||
* Commit using version number as the message (OR plugin version) | ||
@@ -75,0 +76,0 @@ * `git push` |
{ | ||
"name": "scribe-editor", | ||
"version": "0.1.17", | ||
"version": "0.1.18", | ||
"main": "src/scribe.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -1,2 +0,5 @@ | ||
define(function () { | ||
define([ | ||
'scribe-common/src/element' | ||
], | ||
function (elementHelper) { | ||
@@ -182,12 +185,30 @@ 'use strict'; | ||
Selection.prototype.isCaretOnNewLine = function () { | ||
// return true if nested inline tags ultimately just contain <br> or "" | ||
function isEmptyInlineElement(node) { | ||
var treeWalker = document.createTreeWalker(node, NodeFilter.SHOW_ELEMENT); | ||
var currentNode = treeWalker.root; | ||
while(currentNode) { | ||
var numberOfChildren = currentNode.childNodes.length; | ||
// forks in the tree or text mean no new line | ||
if (numberOfChildren > 1 || | ||
(numberOfChildren === 1 && currentNode.textContent.trim() !== '')) | ||
return false; | ||
if (numberOfChildren === 0) { | ||
return currentNode.textContent.trim() === ''; | ||
} | ||
currentNode = treeWalker.nextNode(); | ||
}; | ||
}; | ||
var containerPElement = this.getContaining(function (node) { | ||
return node.nodeName === 'P'; | ||
}); | ||
// We must do `innerHTML.trim()` to avoid weird Firefox bug: | ||
// http://stackoverflow.com/questions/3676927/why-if-element-innerhtml-is-not-working-in-firefox | ||
if (containerPElement) { | ||
var containerPElementInnerHTML = containerPElement.innerHTML.trim(); | ||
return (containerPElement.nodeName === 'P' | ||
&& (containerPElementInnerHTML === '<br>' | ||
|| containerPElementInnerHTML === '')); | ||
return isEmptyInlineElement(containerPElement); | ||
} else { | ||
@@ -194,0 +215,0 @@ return false; |
@@ -38,4 +38,3 @@ define([ | ||
node.textContent.trim() === '' && | ||
!contains(html5VoidElements, node.nodeName)) | ||
{ | ||
!contains(html5VoidElements, node.nodeName)) { | ||
node.appendChild(document.createElement('br')); | ||
@@ -42,0 +41,0 @@ } else if (node.children.length > 0) { |
@@ -18,8 +18,5 @@ /** | ||
/** | ||
* FIXME: We have to set a ridiculous timeout (20 minutes) because Travis’ | ||
* concurrent builds will sometimes exceed Sauce Labs’ concurrency. We should | ||
* track the following issue to add an option to Travis for limiting | ||
* concurrency: https://github.com/travis-ci/travis-ci/issues/1366 | ||
* Wait for the connection to Sauce Labs to finish. | ||
*/ | ||
mocha.timeout(1200000); | ||
mocha.timeout(15 * 1000); | ||
mocha.reporter('spec'); | ||
@@ -32,3 +29,4 @@ mocha.addFile(__dirname + '/block-mode.spec.js'); | ||
mocha.addFile(__dirname + '/undo-manager.spec.js'); | ||
mocha.addFile(__dirname + '/selection.spec.js'); | ||
createRunner(mocha); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
74
3637
200100
1