'); }},
removeFormat: { result: function() { return exec('removeFormat'); }},
orderedList: {
- state: function() { return queryCommandState('insertOrderedList'); },
+ state: function() { return !checkboxNode(window.getSelection().anchorNode) && queryCommandState('insertOrderedList'); },
result: function() { if (!!checkboxNode(window.getSelection().anchorNode)) return;return exec('insertOrderedList'); }
},
unorderedList: {
- state: function() {
- return !checkboxNode(window.getSelection().anchorNode) && queryCommandState('insertUnorderedList');
- },
+ state: function() { return queryCommandState('insertUnorderedList');},
result: function() { if (!!checkboxNode(window.getSelection().anchorNode)) return; return exec('insertUnorderedList');}
},
code: { result: function() { return exec(formatBlock, ''); }},
@@ -310,7 +316,7 @@ function createHTML(options = {}) {
if (!!box){
cancelCheckboxList(box.parentNode);
} else {
- !queryCommandState('insertUnorderedList') && execCheckboxList(pNode);
+ !queryCommandState('insertOrderedList') && execCheckboxList(pNode);
}
}
},
@@ -433,7 +439,7 @@ function createHTML(options = {}) {
formatParagraph(true);
} else if (anchorNode.innerHTML === '
' && anchorNode.parentNode !== editor.content){
// setCollapse(editor.content);
- } else if (queryCommandState('insertUnorderedList') && !!(box = checkboxNode(anchorNode))){
+ } else if (queryCommandState('insertOrderedList') && !!(box = checkboxNode(anchorNode))){
var node = anchorNode && anchorNode.childNodes[1];
if (node && node.nodeName === 'BR'){
cancelCheckboxList(box.parentNode);
@@ -504,7 +510,8 @@ function createHTML(options = {}) {
onChange: function (){
clearTimeout(_handleCTime);
_handleCTime = setTimeout(function(){
- postAction({type: 'CONTENT_CHANGE', data: Actions.content.getHtml()});
+ var html = Actions.content.getHtml();
+ postAction({type: 'CONTENT_CHANGE', data: html});
}, 50);
}
})
@@ -529,4 +536,4 @@ function createHTML(options = {}) {
}
const HTML = createHTML();
-export {HTML, createHTML};
+export {HTML, createHTML, getContentCSS};
diff --git a/src/index.js b/src/index.js
index 6f58e9e..b217739 100755
--- a/src/index.js
+++ b/src/index.js
@@ -1,6 +1,6 @@
import RichEditor from './RichEditor';
import RichToolbar, {defaultActions} from './RichToolbar';
import {actions} from './const';
-import {createHTML} from './editor';
+import {createHTML, getContentCSS} from './editor';
-export {RichEditor, RichToolbar, actions, defaultActions, createHTML};
+export {RichEditor, RichToolbar, actions, defaultActions, createHTML, getContentCSS};