command.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * @description 封装 document.execCommand
  3. * @author wangfupeng
  4. */
  5. import { DomElement } from '../utils/dom-core';
  6. import Editor from './index';
  7. declare class Command {
  8. editor: Editor;
  9. constructor(editor: Editor);
  10. /**
  11. * 执行富文本操作的命令
  12. * @param name name
  13. * @param value value
  14. */
  15. do(name: string, value?: string | DomElement): void;
  16. /**
  17. * 插入 html
  18. * @param html html 字符串
  19. */
  20. private insertHTML;
  21. /**
  22. * 插入 DOM 元素
  23. * @param $elem DOM 元素
  24. */
  25. private insertElem;
  26. /**
  27. * 执行 document.execCommand
  28. * @param name name
  29. * @param value value
  30. */
  31. private execCommand;
  32. /**
  33. * 执行 document.queryCommandValue
  34. * @param name name
  35. */
  36. queryCommandValue(name: string): string;
  37. /**
  38. * 执行 document.queryCommandState
  39. * @param name name
  40. */
  41. queryCommandState(name: string): boolean;
  42. /**
  43. * 执行 document.queryCommandSupported
  44. * @param name name
  45. */
  46. queryCommandSupported(name: string): boolean;
  47. }
  48. export default Command;