mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Fix bug in applying styles in Opera/IE.
Was removing the crucial empty text node that these browsers use to indicate and editable line.
This commit is contained in:
parent
d24aba73ad
commit
3f5233c61a
6 changed files with 10 additions and 16 deletions
|
@ -64,6 +64,7 @@
|
||||||
<span id="removeList">Unlist</span>
|
<span id="removeList">Unlist</span>
|
||||||
|
|
||||||
<span id="insertImage" class="prompt">Insert image</span>
|
<span id="insertImage" class="prompt">Insert image</span>
|
||||||
|
<span id="setHTML" class="prompt">Set HTML</span>
|
||||||
|
|
||||||
<span id="undo">Undo</span>
|
<span id="undo">Undo</span>
|
||||||
<span id="redo">Redo</span>
|
<span id="redo">Redo</span>
|
||||||
|
|
|
@ -7,7 +7,7 @@ Unlike other HTML5 rich text editors, squire was written as a component for writ
|
||||||
|
|
||||||
### Lightweight ###
|
### Lightweight ###
|
||||||
|
|
||||||
* Only 7KB of JS after minification and gzip (25KB before gzip).
|
* Only 8KB of JS after minification and gzip (26KB before gzip).
|
||||||
* Does not include its own XHR wrapper, widget library or lightbox overlays.
|
* Does not include its own XHR wrapper, widget library or lightbox overlays.
|
||||||
* No dependencies.
|
* No dependencies.
|
||||||
* No UI for a toolbar is supplied, allowing you to integrate seamlessly with the
|
* No UI for a toolbar is supplied, allowing you to integrate seamlessly with the
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
<!--[if IE 9]>
|
<!--[if IE 9]>
|
||||||
<script type="text/javascript">window.ie = 9;</script>
|
<script type="text/javascript">window.ie = 9;</script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<script type="text/javascript" src="squire.js"></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body></body>
|
<body><script type="text/javascript" src="squire.js"></script></body>
|
||||||
</html>
|
</html>
|
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/*global Range, window, document, setTimeout */
|
/*global Range, window, document, setTimeout */
|
||||||
|
|
||||||
document.addEventListener( 'DOMContentLoaded', function () {
|
( function ( doc ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -16,13 +16,12 @@ document.addEventListener( 'DOMContentLoaded', function () {
|
||||||
FILTER_ACCEPT = 1, // NodeFilter.FILTER_ACCEPT,
|
FILTER_ACCEPT = 1, // NodeFilter.FILTER_ACCEPT,
|
||||||
FILTER_SKIP = 3; // NodeFilter.FILTER_SKIP;
|
FILTER_SKIP = 3; // NodeFilter.FILTER_SKIP;
|
||||||
|
|
||||||
var doc = document,
|
var win = doc.defaultView,
|
||||||
win = doc.defaultView,
|
|
||||||
body = doc.body;
|
body = doc.body;
|
||||||
|
|
||||||
var isOpera = !!win.opera;
|
var isOpera = !!win.opera;
|
||||||
var isIE = !!win.ie;
|
var isIE = !!win.ie;
|
||||||
var useTextFixer = isOpera || isOpera;
|
var useTextFixer = isIE || isOpera;
|
||||||
|
|
||||||
// --- DOM Sugar ---
|
// --- DOM Sugar ---
|
||||||
|
|
||||||
|
@ -528,12 +527,8 @@ document.addEventListener( 'DOMContentLoaded', function () {
|
||||||
// If not at least partially contained, wrap entire contents
|
// If not at least partially contained, wrap entire contents
|
||||||
// in a clone of the tag we're removing and we're done.
|
// in a clone of the tag we're removing and we're done.
|
||||||
if ( !range.containsNode( node, true ) ) {
|
if ( !range.containsNode( node, true ) ) {
|
||||||
// Tidy up as we go...
|
|
||||||
if ( isText && !node.length ) {
|
|
||||||
node.detach();
|
|
||||||
}
|
|
||||||
// Ignore bookmarks
|
// Ignore bookmarks
|
||||||
else if ( node.nodeName !== 'INPUT' ) {
|
if ( node.nodeName !== 'INPUT' ) {
|
||||||
toWrap.push([ exemplar, node ]);
|
toWrap.push([ exemplar, node ]);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1585,4 +1580,4 @@ document.addEventListener( 'DOMContentLoaded', function () {
|
||||||
body.setAttribute( 'contenteditable', 'true' );
|
body.setAttribute( 'contenteditable', 'true' );
|
||||||
win.editor.setHTML( '' );
|
win.editor.setHTML( '' );
|
||||||
|
|
||||||
}, false );
|
}( document ) );
|
|
@ -51,7 +51,6 @@
|
||||||
<!--[if IE 9]>
|
<!--[if IE 9]>
|
||||||
<script type="text/javascript">window.ie = 9;</script>
|
<script type="text/javascript">window.ie = 9;</script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<script type="text/javascript" src="squire.js"></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body></body>
|
<body><script type="text/javascript" src="squire.js"></script></body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue