scribe-editor
Advanced tools
Comparing version 0.1.25 to 1.0.0
{ | ||
"name": "scribe", | ||
"dependencies": { | ||
"lodash-amd": "2.4.1", | ||
"scribe-common": "0.0.11" | ||
"lodash-amd": "2.4.1" | ||
}, | ||
@@ -7,0 +6,0 @@ "devDependencies": { |
@@ -0,1 +1,12 @@ | ||
# 1.0.0 | ||
This is a non-backwards compatible change as we are removing the use of Scribe Common. The Node and Element apis that were available in that project are now exposed via the *scribe* object itself (`scribe.node` and `scribe.element`). | ||
Existing plugins should not break for this release but please re-write your plugins if you use 1.0.0 as a dependency. | ||
* Merge [Scribe Common into Scribe](https://github.com/guardian/scribe/pull/287) | ||
# 0.1.26 | ||
* Add preliminary support for Safari 6. [Muration Observer Safari](https://github.com/guardian/scribe/pull/285) | ||
# 0.1.25 | ||
@@ -2,0 +13,0 @@ * Switch from using export directly to the string alias version. [YUI Compressor changes](https://github.com/guardian/scribe/pull/279) |
{ | ||
"name": "scribe-editor", | ||
"version": "0.1.25", | ||
"version": "1.0.0", | ||
"main": "src/scribe.js", | ||
"dependencies": { | ||
"lodash-amd": "~2.4.1", | ||
"scribe-common": "~0.0.11" | ||
"lodash-amd": "~2.4.1" | ||
}, | ||
@@ -9,0 +8,0 @@ "devDependencies": { |
@@ -19,4 +19,3 @@ /* | ||
paths: { | ||
'lodash-amd': '../bower_components/lodash-amd', | ||
'scribe-common': '../bower_components/scribe-common' | ||
'lodash-amd': '../bower_components/lodash-amd' | ||
} | ||
@@ -23,0 +22,0 @@ }); |
@@ -171,2 +171,6 @@ Scribe [](https://travis-ci.org/guardian/scribe) | ||
### How do I run tests? | ||
See [CONTRIBUTING.md](CONTRIBUTING.md) for information about running tests. | ||
### Why does Scribe have a custom undo manager? | ||
@@ -173,0 +177,0 @@ |
define([ | ||
'scribe-common/src/element' | ||
'../element' | ||
], | ||
@@ -4,0 +4,0 @@ function (elementHelper) { |
define([ | ||
'lodash-amd/modern/arrays/flatten', | ||
'lodash-amd/modern/collections/toArray', | ||
'scribe-common/src/element', | ||
'scribe-common/src/node' | ||
'./element', | ||
'./node' | ||
], function ( | ||
@@ -28,4 +28,7 @@ flatten, | ||
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; | ||
// Flag to avoid running recursively | ||
var runningPostMutation = false; | ||
var observer = new MutationObserver(function(mutations) { | ||
@@ -32,0 +35,0 @@ if (! runningPostMutation && includeRealMutations(mutations)) { |
define([ | ||
'lodash-amd/modern/arrays/last', | ||
'scribe-common/src/element' | ||
'lodash-amd/modern/arrays/last' | ||
], function ( | ||
last, | ||
element | ||
last | ||
) { | ||
@@ -29,3 +27,3 @@ | ||
*/ | ||
function wrapChildNodes(parentNode) { | ||
function wrapChildNodes(scribe, parentNode) { | ||
var groups = Array.prototype.reduce.call(parentNode.childNodes, | ||
@@ -37,4 +35,4 @@ function (accumulator, binChildNode) { | ||
} else { | ||
var isBlockGroup = element.isBlockElement(group[0]); | ||
if (isBlockGroup === element.isBlockElement(binChildNode)) { | ||
var isBlockGroup = scribe.element.isBlockElement(group[0]); | ||
if (isBlockGroup === scribe.element.isBlockElement(binChildNode)) { | ||
group.push(binChildNode); | ||
@@ -55,3 +53,3 @@ } else { | ||
var consecutiveInlineElementsAndTextNodes = groups.filter(function (group) { | ||
var isBlockGroup = element.isBlockElement(group[0]); | ||
var isBlockGroup = scribe.element.isBlockElement(group[0]); | ||
return ! isBlockGroup; | ||
@@ -72,3 +70,3 @@ }); | ||
// Traverse the tree, wrapping child nodes as we go. | ||
function traverse(parentNode) { | ||
function traverse(scribe, parentNode) { | ||
var treeWalker = document.createTreeWalker(parentNode, NodeFilter.SHOW_ELEMENT); | ||
@@ -83,4 +81,4 @@ var node = treeWalker.firstChild(); | ||
if (node.nodeName === 'BLOCKQUOTE' && ! node._isWrapped) { | ||
wrapChildNodes(node); | ||
traverse(parentNode); | ||
wrapChildNodes(scribe, node); | ||
traverse(scribe, parentNode); | ||
break; | ||
@@ -108,4 +106,4 @@ } | ||
wrapChildNodes(bin); | ||
traverse(bin); | ||
wrapChildNodes(scribe, bin); | ||
traverse(scribe, bin); | ||
@@ -112,0 +110,0 @@ return bin.innerHTML; |
define([ | ||
'scribe-common/src/element', | ||
'../../../../element', | ||
'lodash-amd/modern/collections/contains' | ||
@@ -20,3 +20,3 @@ ], function ( | ||
function parentHasNoTextContent(node) { | ||
function parentHasNoTextContent(element, node) { | ||
if (element.isCaretPositionNode(node)) { | ||
@@ -30,3 +30,3 @@ return true; | ||
function traverse(parentNode) { | ||
function traverse(element, parentNode) { | ||
// Instead of TreeWalker, which gets confused when the BR is added to the dom, | ||
@@ -46,3 +46,3 @@ // we recursively traverse the tree to look for an empty node that can have childNodes | ||
if (!element.isBlockElement(node) && node.children.length === 0) { | ||
return parentHasNoTextContent(node); | ||
return parentHasNoTextContent(element, node); | ||
} | ||
@@ -62,3 +62,3 @@ | ||
} else if (node.children.length > 0) { | ||
traverse(node); | ||
traverse(element, node); | ||
} | ||
@@ -77,3 +77,3 @@ } | ||
traverse(bin); | ||
traverse(scribe.element, bin); | ||
@@ -80,0 +80,0 @@ return bin.innerHTML; |
@@ -1,2 +0,2 @@ | ||
define(['scribe-common/src/element'], function (element) { | ||
define([], function () { | ||
@@ -8,2 +8,3 @@ 'use strict'; | ||
var insertHTMLCommandPatch = new scribe.api.CommandPatch('insertHTML'); | ||
var element = scribe.element; | ||
@@ -10,0 +11,0 @@ insertHTMLCommandPatch.execute = function (value) { |
@@ -1,3 +0,2 @@ | ||
define(['scribe-common/src/element', | ||
'scribe-common/src/node'], function (element, nodeHelpers) { | ||
define([], function () { | ||
@@ -8,2 +7,5 @@ 'use strict'; | ||
return function (scribe) { | ||
var element = scribe.element; | ||
var nodeHelpers = scribe.node; | ||
var InsertListCommandPatch = function (commandName) { | ||
@@ -10,0 +12,0 @@ scribe.api.CommandPatch.call(this, commandName); |
@@ -1,2 +0,2 @@ | ||
define(['scribe-common/src/element'], function (element) { | ||
define([], function () { | ||
@@ -24,2 +24,5 @@ 'use strict'; | ||
// TODO: share somehow with `InsertList` command | ||
var element = scribe.element; | ||
if (scribe.allowsBlockElements()) { | ||
@@ -26,0 +29,0 @@ scribe.el.addEventListener('keyup', function (event) { |
@@ -16,3 +16,5 @@ define([ | ||
'./undo-manager', | ||
'./event-emitter' | ||
'./event-emitter', | ||
'./element', | ||
'./node' | ||
], function ( | ||
@@ -33,3 +35,5 @@ defaults, | ||
buildUndoManager, | ||
EventEmitter | ||
EventEmitter, | ||
elementHelpers, | ||
nodeHelpers | ||
) { | ||
@@ -54,2 +58,5 @@ | ||
this.node = nodeHelpers; | ||
this.element = elementHelpers; | ||
var TransactionManager = buildTransactionManager(this); | ||
@@ -56,0 +63,0 @@ this.transactionManager = new TransactionManager(); |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
177077
1
67
3752
1
192
0
- Removedscribe-common@~0.0.11
- Removedscribe-common@0.0.11(transitive)