Skip to content

Commit 54c5c4a

Browse files
committed
Fixed IE bug with indent
1 parent ba319fe commit 54c5c4a

4 files changed

+9
-9
lines changed

minified/jquery.sceditor.bbcode.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

minified/jquery.sceditor.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

minified/jquery.sceditor.xhtml.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jquery.sceditor.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -3747,21 +3747,21 @@
37473747
// START_COMMAND: Indent
37483748
indent: {
37493749
state: function(parents, firstBlock) {
3750-
37513750
// Only works with lists, for now
37523751
// This is a nested list, so it will always work
37533752
var range, startContainerParent, endContainerParent,
3754-
$firstBlock = $(firstBlock),
3755-
listParentNum = $firstBlock.parents('ul,ol,menu').length;
3753+
$firstBlock = $(firstBlock),
3754+
parentLists = $firstBlock.parents('ul,ol,menu'),
3755+
parentList = parentLists.first();
37563756

37573757
// in case it's a list with only a single <li>
3758-
if (listParentNum > 1 || (listParentNum > 0 && firstBlock.parentNode.children.length > 1))
3758+
if (parentLists.length > 1 || parentList.children().length > 1)
37593759
return 0;
37603760

37613761
if ($firstBlock.is('ul,ol,menu')) {
37623762
// if the whole list is selected, then this must be invalidated because the browser will place a <blockquote> there
37633763
range = this.getRangeHelper().selectedRange();
3764-
if (range instanceof Range) {
3764+
if (window.Range && range instanceof Range) {
37653765
startContainerParent = range.startContainer.parentNode;
37663766
endContainerParent = range.endContainer.parentNode;
37673767

@@ -3774,7 +3774,7 @@
37743774
}
37753775
// it's IE... As it is impossible to know well when to accept, better safe than sorry
37763776
else
3777-
return $firstBlock.is('li') ? 0 : -1;
3777+
return $firstBlock.is('li,ul,ol,menu') ? 0 : -1;
37783778
}
37793779

37803780
return -1;

0 commit comments

Comments
 (0)