scribe-editor
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "scribe", | ||
"dependencies": { | ||
"lodash-amd": "2.4.1" | ||
"lodash-amd": "2.4.1", | ||
"immutable" : "3.2.1" | ||
}, | ||
@@ -6,0 +7,0 @@ "devDependencies": { |
@@ -0,1 +1,7 @@ | ||
# 1.1.0 | ||
Introduces [ImmutableJS](https://github.com/facebook/immutable-js) (which is also exposed via scribe.immutable) and starts to convert some the internal workings of Scribe to use immutable data structures. | ||
Adds 55K of needless bloat according to @theefer but I am heartless and laugh at his tears. | ||
# 1.0.0 | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "scribe-editor", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"main": "src/scribe.js", | ||
"dependencies": { | ||
"lodash-amd": "~2.4.1" | ||
"lodash-amd": "~2.4.1", | ||
"immutable" : "~3.2.1" | ||
}, | ||
@@ -25,3 +26,3 @@ "devDependencies": { | ||
"selenium-webdriver": "~2.41.0", | ||
"scribe-test-harness": "~0.0.6" | ||
"scribe-test-harness": "~0.0.7" | ||
}, | ||
@@ -28,0 +29,0 @@ "scripts": { |
@@ -19,3 +19,4 @@ /* | ||
paths: { | ||
'lodash-amd': '../bower_components/lodash-amd' | ||
'lodash-amd': '../bower_components/lodash-amd', | ||
'immutable': '../bower_components/immutable' | ||
} | ||
@@ -22,0 +23,0 @@ }); |
define([ | ||
'lodash-amd/modern/objects/defaults', | ||
'lodash-amd/modern/arrays/flatten', | ||
'./plugins/core/commands', | ||
@@ -18,6 +17,6 @@ './plugins/core/events', | ||
'./element', | ||
'./node' | ||
'./node', | ||
'immutable/dist/immutable' | ||
], function ( | ||
defaults, | ||
flatten, | ||
commands, | ||
@@ -37,3 +36,4 @@ events, | ||
elementHelpers, | ||
nodeHelpers | ||
nodeHelpers, | ||
Immutable | ||
) { | ||
@@ -61,2 +61,4 @@ | ||
this.Immutable = Immutable; | ||
var TransactionManager = buildTransactionManager(this); | ||
@@ -251,7 +253,9 @@ this.transactionManager = new TransactionManager(); | ||
Scribe.prototype.registerHTMLFormatter = function (phase, fn) { | ||
this._htmlFormatterFactory.formatters[phase].push(fn); | ||
this._htmlFormatterFactory.formatters[phase] | ||
= this._htmlFormatterFactory.formatters[phase].push(fn); | ||
}; | ||
Scribe.prototype.registerPlainTextFormatter = function (fn) { | ||
this._plainTextFormatterFactory.formatters.push(fn); | ||
this._plainTextFormatterFactory.formatters | ||
= this._plainTextFormatterFactory.formatters.push(fn); | ||
}; | ||
@@ -261,3 +265,3 @@ | ||
function FormatterFactory() { | ||
this.formatters = []; | ||
this.formatters = Immutable.List(); | ||
} | ||
@@ -275,3 +279,2 @@ | ||
function HTMLFormatterFactory() { | ||
// Object[String,Array[Formatter]] | ||
// Define phases | ||
@@ -282,6 +285,6 @@ // For a list of formatters, see https://github.com/guardian/scribe/issues/126 | ||
// elements | ||
sanitize: [], | ||
sanitize: Immutable.List(), | ||
// Normalize content to ensure it is ready for interaction | ||
normalize: [], | ||
'export': [] | ||
normalize: Immutable.List(), | ||
'export': Immutable.List() | ||
}; | ||
@@ -294,5 +297,4 @@ } | ||
HTMLFormatterFactory.prototype.format = function (html) { | ||
// Flatten the phases | ||
// Map the object to an array: Array[Formatter] | ||
var formatters = flatten([this.formatters.sanitize, this.formatters.normalize]); | ||
var formatters = this.formatters.sanitize.concat(this.formatters.normalize); | ||
var formatted = formatters.reduce(function (formattedData, formatter) { | ||
@@ -299,0 +301,0 @@ return formatter(formattedData); |
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
177800
68
3754
2
1
+ Addedimmutable@~3.2.1
+ Addedimmutable@3.2.1(transitive)