This repository has been archived by the owner on Jun 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removes lodash as a dependency. Updates to Node 5. Merges in master
- Loading branch information
Showing
18 changed files
with
370 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
# Decisions log | ||
|
||
## 2016-04-16 Event namespacing | ||
|
||
Events in Scribe are generally only propogated within the Scribe instance so we haven't namespaced them before. However within the Guardian products that Scribe is used we do tend to namespace all events as we have had problems with event clashes between browser extensions/add-ons and third-party code. | ||
|
||
Therefore without removing the current legacy `content-changed` event, which would cause too much grief in the plugin ecosystem, event names in Scribe will now be prefixed with "scribe". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<!-- | ||
This example demonstrates how to consume the Scribe | ||
editor using RequireJS and the AMD module syntax. | ||
Note that you'll need to install scribe's dependencies through | ||
`bower install`. See http://bower.io/ if you are unfamiliar. | ||
--> | ||
<style> | ||
button { | ||
height: 3em; | ||
} | ||
|
||
.active { | ||
border-style: inset; | ||
} | ||
|
||
.rte, .rte-toolbar { | ||
display: block; | ||
} | ||
|
||
p { | ||
margin-top: 0; | ||
} | ||
|
||
.rte { | ||
border: 1px solid gray; | ||
height: 300px; | ||
overflow: auto; | ||
} | ||
.rte-output { | ||
width: 100%; | ||
height: 10em; | ||
} | ||
</style> | ||
<script src="../bower_components/requirejs/require.js"></script> | ||
<script> | ||
require({ | ||
paths: { | ||
'scribe-common': '../bower_components/scribe-common', | ||
'lodash-amd': '../bower_components/lodash-amd', | ||
'html-janitor': '../bower_components/html-janitor/html-janitor', | ||
'immutable': '../bower_components/immutable/dist/immutable' | ||
} | ||
}, [ | ||
'../src/scribe', | ||
'../bower_components/scribe-plugin-toolbar/src/scribe-plugin-toolbar', | ||
'../bower_components/scribe-plugin-formatter-plain-text-convert-new-lines-to-html/src/scribe-plugin-formatter-plain-text-convert-new-lines-to-html', | ||
'../bower_components/scribe-plugin-sanitizer/src/scribe-plugin-sanitizer', | ||
'../bower_components/scribe-plugin-inline-styles-to-elements/src/scribe-plugin-inline-styles-to-elements', | ||
'../bower_components/scribe-plugin-heading-command/src/scribe-plugin-heading-command', | ||
'../bower_components/scribe-plugin-link-prompt-command/src/scribe-plugin-link-prompt-command', | ||
'../bower_components/scribe-plugin-blockquote-command/src/scribe-plugin-blockquote-command' | ||
|
||
], function ( | ||
Scribe, | ||
scribePluginToolbar, | ||
scribePluginFormatterPlainTextConvertNewLinesToHtml, | ||
scribePluginSanitizer, | ||
scribePluginInlineStyles, | ||
scribePluginHeadingCommand, | ||
scribePluginLinkPromptCommand, | ||
scribePluginBlockquoteCommand | ||
) { | ||
var scribe = new Scribe(document.querySelector('.rte'), | ||
{allowBlockElements: false}); | ||
window.scribe = scribe; | ||
|
||
scribe.setContent('<p>Hello, World!<\/p>'); | ||
|
||
scribe.use(scribePluginToolbar(document.querySelector('.rte-toolbar'))); | ||
scribe.use(scribePluginFormatterPlainTextConvertNewLinesToHtml()); | ||
scribe.use(scribePluginInlineStyles()); | ||
scribe.use(scribePluginHeadingCommand(2)); | ||
scribe.use(scribePluginBlockquoteCommand()); | ||
scribe.use(scribePluginSanitizer({ tags: { | ||
p: {}, | ||
b: {}, | ||
i: {}, | ||
br: {}, | ||
h2: {}, | ||
a: {}, | ||
blockquote: {} | ||
}})); | ||
scribe.use(scribePluginLinkPromptCommand()); | ||
|
||
scribe.on('content-changed', updateHtml); | ||
|
||
function updateHtml() { | ||
document.querySelector('.rte-output').value = scribe.getHTML(); | ||
} | ||
|
||
updateHtml(); | ||
}); | ||
</script> | ||
<div class="rte-toolbar"> | ||
<button data-command-name="bold">Bold</button> | ||
<button data-command-name="italic">Italic</button> | ||
<button data-command-name="linkPrompt">Link</button> | ||
<button data-command-name="h2">H2</button> | ||
<button data-command-name="blockquote">Blockquote</button> | ||
</div> | ||
<div class="rte"></div> | ||
<section> | ||
<h1>Output</h1> | ||
<textarea class="rte-output" readonly></textarea> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<!-- | ||
This example demonstrates how to consume the Scribe | ||
editor using RequireJS and the AMD module syntax. | ||
Note that you'll need to install scribe's dependencies through | ||
`bower install`. See http://bower.io/ if you are unfamiliar. | ||
--> | ||
<style> | ||
button { | ||
height: 3em; | ||
} | ||
|
||
.active { | ||
border-style: inset; | ||
} | ||
|
||
.rte, .rte-toolbar { | ||
display: block; | ||
} | ||
|
||
p { | ||
margin-top: 0; | ||
} | ||
|
||
.rte { | ||
border: 1px solid gray; | ||
height: 300px; | ||
overflow: auto; | ||
} | ||
.rte-output { | ||
width: 100%; | ||
height: 10em; | ||
} | ||
|
||
.raw-content-editable { | ||
width: 100%; | ||
min-height: 2rem; | ||
border: solid 1px lightgray; | ||
} | ||
</style> | ||
<script src="../bower_components/requirejs/require.js"></script> | ||
<script> | ||
require({ | ||
paths: { | ||
'lodash-amd': '../bower_components/lodash-amd', | ||
'immutable': '../bower_components/immutable/dist/immutable' | ||
} | ||
}, [ | ||
'../src/scribe', | ||
'../bower_components/scribe-plugin-toolbar/src/scribe-plugin-toolbar', | ||
'../bower_components/scribe-plugin-formatter-plain-text-convert-new-lines-to-html/src/scribe-plugin-formatter-plain-text-convert-new-lines-to-html', | ||
], function ( | ||
Scribe, | ||
scribePluginToolbar | ||
) { | ||
var scribe = new Scribe(document.querySelector('.rte')); | ||
window.scribe = scribe; | ||
|
||
scribe.setContent('<p>Hello, World!<\/p>'); | ||
|
||
scribe.use(scribePluginToolbar(document.querySelector('.rte-toolbar'))); | ||
|
||
scribe.on('content-changed', updateHtml); | ||
|
||
function updateHtml() { | ||
document.querySelector('.rte-output').value = scribe.getHTML(); | ||
} | ||
|
||
updateHtml(); | ||
}); | ||
</script> | ||
<div class="rte-toolbar"> | ||
<button data-command-name="bold">Bold</button> | ||
<button data-command-name="italic">Italic</button> | ||
<button data-command-name="h2">H2</button> | ||
</div> | ||
<div class="rte"> | ||
</div> | ||
|
||
<section> | ||
<h1>Output</h1> | ||
<textarea class="rte-output" readonly></textarea> | ||
</section> | ||
|
||
<section> | ||
<h1>Basic content-editable</h1> | ||
|
||
<div class="raw-content-editable" contenteditable="true"></div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
define([], function() { | ||
|
||
'use strict'; | ||
|
||
return { | ||
contentChanged: "scribe:content-changed", | ||
legacyContentChanged: "content-changed", | ||
destroy: "scribe:destroy" | ||
}; | ||
}); |
Oops, something went wrong.