1 /**
  2  * color command.
  3  * @author yiminghe@gmail.com
  4  */
  5 KISSY.add("editor/plugin/color/cmd", function (S, Editor) {
  6     function applyColor(editor, c, styles) {
  7         var doc = editor.get("document")[0];
  8         editor.execCommand("save");
  9         if (c) {
 10             new Editor.Style(styles, {
 11                 color:c
 12             }).apply(doc);
 13         } else {
 14             // Value 'inherit'  is treated as a wildcard,
 15             // which will match any value.
 16             //清除已设格式
 17             new Editor.Style(styles, {
 18                 color:"inherit"
 19             }).remove(doc);
 20         }
 21         editor.execCommand("save");
 22     }
 23 
 24     return {
 25         applyColor:applyColor
 26     };
 27 }, {
 28     requires:['editor']
 29 });