mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
add a way to disable squire from taking over your iframe
This commit is contained in:
parent
de7d7011a7
commit
5628d7b1b8
4 changed files with 21 additions and 11 deletions
10
README.md
10
README.md
|
@ -60,6 +60,16 @@ If you are adding a UI to Squire, you'll probably want to show a button in diffe
|
|||
|
||||
The efficient way to determine the state for most buttons is to monitor the "pathChange" event in the editor, and determine the state from the new path. If the selection goes across nodes, you will need to call the `hasFormat` method for each of your buttons to determine whether the styles are active. See the `getPath` and `hasFormat` documentation for more information.
|
||||
|
||||
### Disabling squire from running in an iframe
|
||||
|
||||
By default, if you include squire in an iframe, squire will turn the iframe into an editable document. You can disable this by putting the follow script above squire:
|
||||
```html
|
||||
<script>
|
||||
DISABLE_SQUIRE = true;
|
||||
</script>
|
||||
```
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
|
|
|
@ -3837,15 +3837,15 @@ proto.removeList = command( 'modifyBlocks', removeList );
|
|||
proto.increaseListLevel = command( 'modifyBlocks', increaseListLevel );
|
||||
proto.decreaseListLevel = command( 'modifyBlocks', decreaseListLevel );
|
||||
|
||||
if ( top !== win ) {
|
||||
win.editor = new Squire( doc );
|
||||
if ( win.onEditorLoad ) {
|
||||
win.onEditorLoad( win.editor );
|
||||
win.onEditorLoad = null;
|
||||
}
|
||||
if ( typeof exports === 'object' ) {
|
||||
module.exports = Squire;
|
||||
} else {
|
||||
if ( typeof exports === 'object' ) {
|
||||
module.exports = Squire;
|
||||
if ( typeof win.DISABLE_SQUIRE === 'undefined' && top !== win ) {
|
||||
win.editor = new Squire( doc );
|
||||
if ( win.onEditorLoad ) {
|
||||
win.onEditorLoad( win.editor );
|
||||
win.onEditorLoad = null;
|
||||
}
|
||||
} else {
|
||||
win.Squire = Squire;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
|||
if ( typeof exports === 'object' ) {
|
||||
module.exports = Squire;
|
||||
} else {
|
||||
if ( top !== win ) {
|
||||
if ( typeof win.DISABLE_SQUIRE === 'undefined' && top !== win ) {
|
||||
win.editor = new Squire( doc );
|
||||
if ( win.onEditorLoad ) {
|
||||
win.onEditorLoad( win.editor );
|
||||
|
|
Loading…
Reference in a new issue