command.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright 2009 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /**
  15. * @fileoverview Commands that the editor can execute.
  16. * @see ../demos/editor/editor.html
  17. */
  18. goog.provide('goog.editor.Command');
  19. /**
  20. * Commands that the editor can excute via execCommand or queryCommandValue.
  21. * @enum {string}
  22. */
  23. goog.editor.Command = {
  24. // Prepend all the strings of built in execCommands with a plus to ensure
  25. // that there's no conflict if a client wants to use the
  26. // browser's execCommand.
  27. UNDO: '+undo',
  28. REDO: '+redo',
  29. LINK: '+link',
  30. FORMAT_BLOCK: '+formatBlock',
  31. INDENT: '+indent',
  32. OUTDENT: '+outdent',
  33. REMOVE_FORMAT: '+removeFormat',
  34. STRIKE_THROUGH: '+strikeThrough',
  35. HORIZONTAL_RULE: '+insertHorizontalRule',
  36. SUBSCRIPT: '+subscript',
  37. SUPERSCRIPT: '+superscript',
  38. UNDERLINE: '+underline',
  39. BOLD: '+bold',
  40. ITALIC: '+italic',
  41. FONT_SIZE: '+fontSize',
  42. FONT_FACE: '+fontName',
  43. FONT_COLOR: '+foreColor',
  44. EMOTICON: '+emoticon',
  45. EQUATION: '+equation',
  46. BACKGROUND_COLOR: '+backColor',
  47. ORDERED_LIST: '+insertOrderedList',
  48. UNORDERED_LIST: '+insertUnorderedList',
  49. TABLE: '+table',
  50. JUSTIFY_CENTER: '+justifyCenter',
  51. JUSTIFY_FULL: '+justifyFull',
  52. JUSTIFY_RIGHT: '+justifyRight',
  53. JUSTIFY_LEFT: '+justifyLeft',
  54. BLOCKQUOTE: '+BLOCKQUOTE', // This is a nodename. Should be all caps.
  55. DIR_LTR: 'ltr', // should be exactly 'ltr' as it becomes dir attribute value
  56. DIR_RTL: 'rtl', // same here
  57. IMAGE: 'image',
  58. EDIT_HTML: 'editHtml',
  59. UPDATE_LINK_BUBBLE: 'updateLinkBubble',
  60. // queryCommandValue only: returns the default tag name used in the field.
  61. // DIV should be considered the default if no plugin responds.
  62. DEFAULT_TAG: '+defaultTag',
  63. // TODO(nicksantos): Try to give clients an API so that they don't need
  64. // these execCommands.
  65. CLEAR_LOREM: 'clearlorem',
  66. UPDATE_LOREM: 'updatelorem',
  67. USING_LOREM: 'usinglorem',
  68. // Modal editor commands (usually dialogs).
  69. MODAL_LINK_EDITOR: 'link'
  70. };