diff --git a/.gitignore b/.gitignore
index fcda3e64..73741658 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@
.tern-port
.npm-debug.log
.DS_Store
+dist
diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 00000000..7ed6ff82
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+5
diff --git a/.travis.yml b/.travis.yml
index 1f603889..16de9713 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
language: node_js
node_js:
- - 0.10
+ - "5.11"
sudo: false
@@ -10,20 +10,6 @@ cache:
- node_modules
- bower_components
-addons:
- sauce_connect: true
-
-env:
- matrix:
- - BROWSER_NAME='firefox' BROWSER_VERSION='36' PLATFORM='Windows 7'
- - BROWSER_NAME='firefox' BROWSER_VERSION='36' PLATFORM='OSX 10.9'
- - BROWSER_NAME='chrome' BROWSER_VERSION='39' PLATFORM='OSX 10.8'
- - BROWSER_NAME='chrome' BROWSER_VERSION='41' PLATFORM='OSX 10.9'
- - BROWSER_NAME='chrome' BROWSER_VERSION='41' PLATFORM='Windows 7'
- global:
- - secure: OaF1EHbUU+0vO3zdO70VlLVOuojRMnWhF02Lj3S7sP4+lbM3CY3JmEyB8G18G3x2aVyqgBEWLkh5WXahNuQIwnTYfidpbeJhvZD4xcP4zxgVyV6DLbxVN+lUpY2maOgCyDPGAix08HMWwuJss2Cw83bdmm0cJv/r2x6YXa/FpUA=
- - secure: AdCl4LiKCMEOBAdltT/aAQVSmqnPZfCc/z2z7VPKCR/s1LbiD1i3ADJin5SgsglhWnmJToam5msNXEvL4gaT0dtlxtiw8ygutzQwEewPSLyekXuAF2NCt+63IdWWt6z470Cb6Nojrz0hRkiKzzeEjF2j1GFmrWkYzgYahlvi4sE=
-
before_script:
- npm install -g bower
- bower install
diff --git a/BROWSERINCONSISTENCIES.md b/BROWSERINCONSISTENCIES.md
index 3e8fd736..6ef1976c 100644
--- a/BROWSERINCONSISTENCIES.md
+++ b/BROWSERINCONSISTENCIES.md
@@ -73,6 +73,9 @@ Playground: http://jsbin.com/iwEWUXo/2/edit?js,console,output
* `subscript`: Firefox: Returns false when a whole `SUB` is selected:
http://jsbin.com/marox/1/edit?js,console,output
- True for all inline elements?
+* Firefox throws `NS_ERROR_UNEXPECTED` error for `insertUnorderedList` and
+ `insertOrderedList` when a contenteditable is not focussed, see:
+ https://github.com/guardian/scribe/issues/208
### `Element.focus`
* Firefox: Giving focus to a `contenteditable` will place the caret outside of
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 46011a2b..e94f8591 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,179 @@
+# 3.3.0
+
+Merges a range of bug fixes including removing the dependency on lodash, use of ES6 `const` not inserting ` ` tags into custom elements and a sanity check to ensure a `listElement` exists before inserting a list.
+
+Thank you [Dan Burzo](https://github.com/danburzo), [James Lawson](https://github.com/jameslawson), [code-smith](https://github.com/code-smith), [Nazar Mokrynskyi](https://github.com/nazar-pc), [Rob Rees](https://github.com/rrees) and [Oliver J Ash](https://github.com/OliverJAsh) for contributing to these fixes.
+
+We hope to move towards more granular releases from now on.
+
+# 3.2.0
+
+This changes the key bindings for undo and redo so that they are more specific and should no longer capture the key sequence for certain Polish letters. See #448 for details.
+
+Thank you [Dan Burzo](https://github.com/danburzo) for contributing this fix.
+
+# 3.1.0
+
+Updates the version of Immutable Scribe uses to 3.8.x.
+
+# 3.0.0
+
+Replaces the last Lodash call with `Object.assign`. This was already available in the browsers Scribe is targeted at but in addition the build process has been changed to use later versions of Node.
+
+# 2.3.0
+
+Introduces a destroy event that plugins can use to clean up after themselves.
+
+This re-implements an initial implementation by [Craig Speath](https://github.com/craigspaeth), thanks for the contribution.
+
+# 2.2.5
+
+Switches the events from literal strings to using identities from an events module.
+
+# 2.2.4
+
+Attempts to simplify the code in the `inline-elements-mode` plugin as per the suggestions from [Rasmus Schultz](https://github.com/mindplay-dk).
+
+This change also covers the code with a unit test in case it needs to be modified in future.
+
+# 2.2.3
+
+Removes unneeded paramters from calls to `setStartAfter` and `setEndAfter`.
+
+Thanks to [Rasmus Schultz](https://github.com/mindplay-dk) for reporting the issue.
+
+# 2.2.2
+
+Removes the observable check function introduced in 2.1.0. As this was not exported I'm treating it as a non-breaking change.
+
+# 2.2.1
+
+Corrects a small style issue where one of the tests was relying on the default coercion of the empty string to the false boolean. The test is now explicit.
+
+# 2.2.0
+
+Addresses issue #456 where one of the core plugins (enforce-p-elements) would wrap empty text nodes in paragraph elements. This behaviour was hidden by the use of the HTML Sanitizer.
+
+Text nodes consisting just of whitespace are not changed now when the plugin runs.
+
+Thanks to [Rasmus Schultz](https://github.com/mindplay-dk) for reporting the issue.
+
+# 2.1.2
+
+Fixes an issue where the undo manager could not be disabled due to an unconditional execution of the manager code in the setHTML method (issue #452).
+
+# 2.1.1
+
+Fixes an issue where the window global was still being referenced so the module still couldn't be used server-side.
+
+# 2.1.0
+
+Changes the way the mutation observer is determined and changes the way that nodes with certain classes are checked for. Both of these changes are aimed at offerring better support for server-side rendering.
+
+Thank you [Sergey Zyablitsky](https://github.com/szyablitsky) and [Simon Degraeve](https://github.com/SimonDegraeve) for your contributions towards this goal.
+
+# 2.0.2
+
+Adds a workaround to allow paste events to work on Android. Thanks to [crasu](https://github.com/crasu) for the contribution.
+
+# 2.0.1
+
+The code for handling manual navigation in list elements now passes the event to its associated command for plugins to use in their response.
+
+Thank you to [Josh Moore](https://github.com/josh-infusionsoft) for contributing this change. Please raise issues on how you think this should work generally if you are interested.
+
+# 2.0.0
+
+A split text node will [no longer be replaced by a non-breaking backspace](https://github.com/guardian/scribe/pull/421) but instead should be a regular space character.
+
+Thanks [Jeffrey Wear](https://github.com/wearhere) for this change/fix
+
+# 1.4.15
+
+Stripping of Chrome artifacts has been consolidated into a single function. Thanks [Regis Kuckaertz](https://github.com/regiskuckaertz)
+
+# 1.4.14
+
+The undo manager has been re-written to use Immutable data structures. Thanks [Regis Kuckaertz](https://github.com/regiskuckaertz)
+
+# 1.4.13
+
+A more elegant fix for [#401](https://github.com/guardian/scribe/issues/401) from [Alexy Golev](https://github.com/alexeygolev), thanks!
+
+# 1.4.12
+
+Restores `scribe.element` (lost in release 1.4.9) to avoid breaking backwards compatibility
+
+# 1.4.11
+
+Another attempt to fix [#401](https://github.com/guardian/scribe/issues/401), this time using Immutable data and Array.prototype.slice.
+
+# 1.4.10
+
+The `NS_ERROR_UNEXPECTED` is now caught and supressed. This exeception is being [thrown by Firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=562623) and seems to be a browser specific bug to do with element focus. This change just avoids lots of supurious errors being thrown.
+
+We should remove it once the bug has been fixed.
+
+# 1.4.9
+
+Consolidates a number of api operations into the node module.
+
+Restructing by [Regis Kuckaertz](https://github.com/regiskuckaertz)
+
+# 1.4.8
+
+Short-circuits the mutation evaluation via use of Array.prototype.some
+
+[Regis Kuckaertz](https://github.com/regiskuckaertz)
+
+# 1.4.7
+
+Not a valid build, issues between Bower and NPM
+
+# 1.4.6
+
+Treat the clipboard data types variable as an array to avoid issues with future releases of Chrome (and other browsers). Resolves [#401](https://github.com/guardian/scribe/issues/401).
+
+# 1.4.5
+
+Corrects the NPM version of the ImmutableJS dependency
+
+# 1.4.4
+
+Replaces some of the use of Lodash contains with Immutable data structures and `includes`.
+
+# 1.4.3
+
+Changes the require alias so that the Immutable import path is simplified.
+
+# 1.4.2
+
+A number of performance improvements have been contributed by [Regis Kuckaertz](https://github.com/regiskuckaertz). Primarily these include avoiding TreeWalker where it isn't needed and moving a number of function definitions to the parse phase. See the individual PRs for details.
+
+# 1.4.1
+
+Small optimisation to avoid a relayout as a result of placing Scribe markers.
+
+Thanks for improvement [Brad Vogel](https://github.com/bradvogel)
+
+# 1.4.0
+
+Changes the cleanup for Chrome inline style tags that happens in the patch for the `insertHTML` command. Previously span tags were aggressively stripped whereas now they are less aggressively removed to limit the fix just to the type of spans that Chrome inserts.
+
+Thanks [Christopher Liu](https://github.com/christopherliu) for contributing this change.
+
+# 1.3.9
+
+Stops Scribe failing on a focus event if the content of the Scribe element is set to empty. Previously the code assumed that a child node is available, now the focus node will be the parent element if there are no children.
+
+Based on contributions from [Ryan Fitzgerald](https://github.com/rf-)
+
+# 1.3.7
+
+Fixes a bug where em tags were being stripped where we meant to strip Scribe markers instead.
+
+Thanks [Abdulrahman Alsaleh](https://github.com/aaalsaleh) for the fix
+
# 1.3.6
Fixes a bug preventing individual events being switched off events in the event-emitter
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 00000000..8b0942e4
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,50 @@
+module.exports = function(grunt) {
+
+ // Add the grunt-mocha-test tasks.
+ grunt.loadNpmTasks('grunt-mocha-test');
+ grunt.loadNpmTasks('grunt-contrib-requirejs');
+
+ grunt.initConfig({
+ // Configure a mochaTest task
+ mochaTest: {
+ test: {
+ options: {
+ reporter: 'spec',
+ },
+ src: ['test/**/*.spec.js']
+ }
+ },
+ });
+
+ function requireConfiguration(optimize, outputFilename) {
+ return {
+ compile: {
+ options: {
+ baseUrl: "src",
+ name: "scribe",
+ paths: {
+ 'lodash-amd': '../bower_components/lodash-amd',
+ 'immutable': '../bower_components/immutable/dist/immutable'
+ },
+ optimize: optimize,
+ preserveLicenseComments: false,
+ generateSourceMaps: true,
+ out: "build/" + outputFilename
+ }
+ }
+ }
+ }
+
+ grunt.registerTask('build', 'Build output files', function() {
+ grunt.config('requirejs', requireConfiguration('uglify2', 'scribe.min.js'));
+ grunt.task.run('requirejs');
+
+ grunt.config('requirejs', requireConfiguration('none', 'scribe.js'));
+ grunt.task.run('requirejs');
+ });
+
+ grunt.registerTask('test', ['mochaTest']);
+
+ grunt.registerTask('default', 'test');
+
+};
diff --git a/LICENSE b/LICENSE
index 9c8703c5..4aef5caf 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,13 +1,201 @@
-Copyright 2014 Guardian News & Media Ltd
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
- http://www.apache.org/licenses/LICENSE-2.0
+ 1. Definitions.
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2014-2017 Guardian News & Media Ltd
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/Plumbing.js b/Plumbing.js
index 199a8504..ee29e43c 100644
--- a/Plumbing.js
+++ b/Plumbing.js
@@ -17,7 +17,7 @@ module.exports = function (pipelines) {
preserveLicenseComments: false,
paths: {
'lodash-amd': '../bower_components/lodash-amd',
- 'immutable': '../bower_components/immutable'
+ 'immutable': '../bower_components/immutable/dist/immutable'
}
});
diff --git a/README.md b/README.md
index d2113a49..fd57f319 100644
--- a/README.md
+++ b/README.md
@@ -1,40 +1,40 @@
-Scribe [](https://travis-ci.org/guardian/scribe)
-======
+**THIS PROJECT IS DEPRECATED** - You can find more information about this in our blog post, [Leaving Scribe](https://www.theguardian.com/info/2019/jan/24/leaving-scribe). In summary:
+
+- We have no plans to add features to Scribe but may make critical updates throughout the period that we continue to use instances of Scribe internally
+- We recommend forking the project in order to do any feature work as we will not be moving the Scribe repository out of the Guardian organisation
+- In time we hope to be able to open source the new text editor we are working on
+
+# Scribe
A rich text editor framework for the web platform, with patches for
browser inconsistencies and sensible defaults.
+## Status
+
+ [](https://travis-ci.org/guardian/scribe) [](https://gitter.im/guardian/scribe?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+## Description
+
For an introduction, you may want to read the blog post [Inside the Guardian’s CMS: meet Scribe, an extensible rich text editor](http://www.theguardian.com/info/developer-blog/2014/mar/20/inside-the-guardians-cms-meet-scribe-an-extensible-rich-text-editor).
-**Please note:** There is a lot of missing documentation for Scribe and many of
-its plugins. We plan to improve this, however in the meantime we encourage
-you to look at the code. Scribe is very small in comparison to other libraries
-of its kind.
+**Please note:** There is a lot of missing documentation for Scribe and many of its plugins. We plan to improve this, however in the meantime we encourage you to look at the code. Scribe is very small in comparison to other libraries of its kind.
You can join us on IRC at [#scribejs] on freenode, or via the [Google Group](https://groups.google.com/forum/#!forum/scribe-editor).
[See an example][example].
+Scribe only actively supports a [sub-set of browsers](https://github.com/guardian/scribe/wiki/Browser-support).
+
## Core
At the core of Scribe we have:
* [Patches for many browser inconsistencies surrounding `contenteditable`](#patches);
-* [Inline and block element modes](#modes).
+* [Inline and block element modes](https://github.com/guardian/scribe/wiki/Modes#).
### Patches
-Scribe patches [many browser inconsistencies][browser inconsistencies] in the
-[native command API][Executing Commands].
-
-### Modes
-
-Natively, `contenteditable` will produce DIVs for new lines. This is not a bug.
-However, this is not ideal because in most cases we require semantic HTML to be
-produced.
-
-Scribe overrides this behaviour to produce paragraphs (Ps; default) or BRs (with
-block element mode turned off) for new lines instead.
+Scribe patches [many browser inconsistencies][browser inconsistencies] in the [native command API][Executing Commands].
## Installation
```
@@ -43,17 +43,6 @@ bower install scribe
Alternatively, you can [access the distribution files through GitHub releases](https://github.com/guardian/scribe/releases).
-## Options
-
-
-
allowBlockElements
-
Enable/disable block element mode (enabled by default)
-
defaultCommandPatches
-
Defines which command patches should be loaded by default
-
undo: { enabled: false }
-
Enable/disable Scribe's custom undo manager
-
-
## Usage Example
Scribe is an AMD module:
@@ -72,11 +61,28 @@ require(['scribe', 'scribe-plugin-blockquote-command', 'scribe-plugin-toolbar'],
});
```
-You can [see a live example here][example], or [view the code here](https://github.com/guardian/scribe/tree/gh-pages).
+You can [see a live example here][example], or [view the code here](https://github.com/guardian/scribe).
Also be sure to check the [`examples`](./examples) directory for an
AMD syntax example as well as a CommonJS (browserify) example.
+## Options
+
+
+
allowBlockElements
+
Enable/disable block element mode (enabled by default)
+
undo: { enabled: false }
+
Enable/disable Scribe's custom undo manager
+
defaultCommandPatches
+
Defines which command patches should be loaded by default
+
defaultPlugins
+
Defines which of Scribe's built-in plugins should be active
+
defaultFormatters
+
Defines which of Scribe's default formatters should be active
+
+
+For detailed documentation see the [wiki page on options](https://github.com/guardian/scribe/wiki/Scribe-configuration-options).
+
## Architecture
* [Everything is a plugin](https://github.com/guardian/scribe/tree/master/src/plugins).
@@ -109,93 +115,17 @@ function myPlugin(scribe) {
### Browser Support
-Theoretically, Scribe should work in any browser with the
-[Selection][Selection API] API, the [Range][Range API] API, and support for most
-of the non-standardised list of commands that appears in
-[this MDN article][Executing Commands]. It has been tested in Firefox >= 36,
-Chrome >= 41.
-
-See the [status of our integration tests](https://travis-ci.org/guardian/scribe)
-for more up-to-date support information.
-
-
-### Commands
-
-Commands are objects that describe formatting operations. For example,
-the bold command.
-
-Commands tell Scribe:
-
-* how to format some HTML when executed (similar to `document.queryCommand`);
-* how to query for whether the given command has been executed on the current selection (similar to `document.queryCommandState`);
-* how to query for whether the command can be executed on the document in its current state (similar to `document.queryCommandEnabled`)
-
-To ensure a separation of concerns, commands are split into multiple layers.
-When a command method is called by Scribe, it will be filtered through these
-layers sequentially.
-
-
-
Scribe
-
Where custom behaviour is defined.
-
Scribe Patches
-
Where patches for brower inconsistencies in native commands are defined.
-
Native
-
+[Moved to the Github Wiki](https://github.com/guardian/scribe/wiki/Browser-support)
## Plugins
-We have created a collection of plugins for advanced rich text editing purposes,
-all of which can be seen in use in our [example][example].
-
-* [scribe-plugin-blockquote-command](https://github.com/guardian/scribe-plugin-blockquote-command)
-* [scribe-plugin-code-command](https://github.com/guardian/scribe-plugin-code-command)
-* [scribe-plugin-curly-quotes](https://github.com/guardian/scribe-plugin-curly-quotes)
-* [scribe-plugin-formatter-html-ensure-semantic-elements](https://github.com/guardian/scribe-plugin-formatter-html-ensure-semantic-elements)
-* [scribe-plugin-formatter-plain-text-convert-new-lines-to-html](https://github.com/guardian/scribe-plugin-formatter-plain-text-convert-new-lines-to-html)
-* [scribe-plugin-heading-command](https://github.com/guardian/scribe-plugin-heading-command)
-* [scribe-plugin-inline-styles-to-elements](https://github.com/guardian/scribe-plugin-inline-styles-to-elements)
-* [scribe-plugin-intelligent-unlink-command](https://github.com/guardian/scribe-plugin-intelligent-unlink-command)
-* [scribe-plugin-keyboard-shortcuts](https://github.com/guardian/scribe-plugin-keyboard-shortcuts)
-* [scribe-plugin-link-prompt-command](https://github.com/guardian/scribe-plugin-link-prompt-command)
-* [scribe-plugin-noting](https://github.com/guardian/scribe-plugin-noting)
-* [scribe-plugin-sanitizer](https://github.com/guardian/scribe-plugin-sanitizer)
-* [scribe-plugin-smart-lists](https://github.com/guardian/scribe-plugin-smart-lists)
-* [scribe-plugin-toolbar](https://github.com/guardian/scribe-plugin-toolbar)
-
-## FAQ
-
-### Is it production ready?
-
-Yes. [The Guardian](http://gu.com) is using Scribe as the basis for their
-internal CMS’ rich text editor.
-
-It is likely that there will be unknown edge cases, but these will be addressed
-when they are discovered.
+Scribe has a rich plugin ecosystem that expands and customises what it can do.
-### How do I run tests?
+See the wiki for a [list of plugins and how to create new ones](https://github.com/guardian/scribe/wiki/Plugins)
-See [CONTRIBUTING.md](CONTRIBUTING.md) for information about running tests.
-
-### Why does Scribe have a custom undo manager?
-
-The [native API for formatting content in a
-`contenteditable`][Executing Commands] has [many browser inconsistencies][browser inconsistencies].
-Scribe has to manipulate the DOM directly on top of using these commands in order to patch
-those inconsistencies. What’s more, there is no widely supported command for
-telling `contenteditable` to insert Ps or BRs for line breaks. Thus, to add
-this behaviour Scribe needs to manipulate the DOM once again.
-
-The undo stack breaks whenever DOM manipulation is used instead of the native
-command API, therefore we have to use our own.
+## FAQ
-Scribe's undo manager can be turned off by configuration eg:
-``` js
-var scribe = new Scribe(scribeElement, {
- undo: {
- enabled: false
- }
-})
-```
+See the wiki's [FAQ](https://github.com/guardian/scribe/wiki/FAQ)
[browser inconsistencies]: https://github.com/guardian/scribe/blob/master/BROWSERINCONSISTENCIES.md
[Executing Commands]: https://developer.mozilla.org/en-US/docs/Rich-Text_Editing_in_Mozilla#Executing_Commands
diff --git a/TODO b/TODO
deleted file mode 100644
index 1d776dc7..00000000
--- a/TODO
+++ /dev/null
@@ -1,20 +0,0 @@
-# Other
-* Test older Safari versions
-* Run integration tests in Safari
-* Encrypt/hide access token for Sauce Labs. This environment variable cannot be
- encrypted because Travis will not send it to PRs.
- See: http://docs.travis-ci.com/user/pull-requests/#Security-Restrictions-when-testing-Pull-Requests
- and https://github.com/travis-ci/travis-ci/issues/1946
-
-# Feature Development
-* Remove event listeners, emit unbind to plugins so that can too
-* Grammar for nesting elements, shared with sanitizer/commands
-* Intersect commands to run formatters
-
-# Known Bugs (which we could write failing tests for)
-* Focus should select all content
-* Applying the outdent command on a top level list item breaks P mode.
-* When inserting lists we remove any SPANs from the inside to fix a Chrome bug,
- but what if the user actually wants a SPAN?
-* Possible to paste blockquotes inside of blockquotes
-* Chrome: "1|2", ENTER,