Permalink
Browse files

wip

  • Loading branch information...
1 parent 0cccddb commit 318cc78c3e8d06dee02f2e6e7e24e08fd3d2e1d9 @tiff tiff committed Sep 8, 2012
Showing with 9 additions and 9 deletions.
  1. +1 −1 examples/advanced.html
  2. +4 −4 src/commands/insertOrderedList.js
  3. +4 −4 src/commands/insertUnorderedList.js
View
@@ -38,7 +38,7 @@
#toolbar,
textarea {
- width: 900px;
+ width: 920px;
padding: 5px;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
@@ -8,7 +8,7 @@ wysihtml5.commands.insertOrderedList = {
isEmpty,
tempElement;
- if (composer.commands.support(command)) {
+ if (!list && !otherList && composer.commands.support(command)) {
doc.execCommand(command, false, null);
return;
}
@@ -18,23 +18,23 @@ wysihtml5.commands.insertOrderedList = {
// <ol><li>foo</li><li>bar</li></ol>
// becomes:
// foo<br>bar<br>
- composer.selection.executeAndRestoreSimple(function() {
+ composer.selection.executeAndRestore(function() {
wysihtml5.dom.resolveList(list, composer.config.useLineBreaks);
});
} else if (otherList) {
// Turn an unordered list into an ordered list
// <ul><li>foo</li><li>bar</li></ul>
// becomes:
// <ol><li>foo</li><li>bar</li></ol>
- composer.selection.executeAndRestoreSimple(function() {
+ composer.selection.executeAndRestore(function() {
wysihtml5.dom.renameElement(otherList, "ol");
});
} else {
// Create list
composer.commands.exec("formatBlock", "div", tempClassName);
tempElement = doc.querySelector("." + tempClassName);
isEmpty = tempElement.innerHTML === "" || tempElement.innerHTML === wysihtml5.INVISIBLE_SPACE || tempElement.innerHTML === "<br>";
- composer.selection.executeAndRestoreSimple(function() {
+ composer.selection.executeAndRestore(function() {
list = wysihtml5.dom.convertToList(tempElement, "ol");
});
if (isEmpty) {
@@ -8,7 +8,7 @@ wysihtml5.commands.insertUnorderedList = {
isEmpty,
tempElement;
- if (composer.commands.support(command)) {
+ if (!list && !otherList && composer.commands.support(command)) {
doc.execCommand(command, false, null);
return;
}
@@ -18,23 +18,23 @@ wysihtml5.commands.insertUnorderedList = {
// <ul><li>foo</li><li>bar</li></ul>
// becomes:
// foo<br>bar<br>
- composer.selection.executeAndRestoreSimple(function() {
+ composer.selection.executeAndRestore(function() {
wysihtml5.dom.resolveList(list, composer.config.useLineBreaks);
});
} else if (otherList) {
// Turn an ordered list into an unordered list
// <ol><li>foo</li><li>bar</li></ol>
// becomes:
// <ul><li>foo</li><li>bar</li></ul>
- composer.selection.executeAndRestoreSimple(function() {
+ composer.selection.executeAndRestore(function() {
wysihtml5.dom.renameElement(otherList, "ul");
});
} else {
// Create list
composer.commands.exec("formatBlock", "div", tempClassName);
tempElement = doc.querySelector("." + tempClassName);
isEmpty = tempElement.innerHTML === "" || tempElement.innerHTML === wysihtml5.INVISIBLE_SPACE || tempElement.innerHTML === "<br>";
- composer.selection.executeAndRestoreSimple(function() {
+ composer.selection.executeAndRestore(function() {
list = wysihtml5.dom.convertToList(tempElement, "ul");
});
if (isEmpty) {

0 comments on commit 318cc78

Please sign in to comment.