util.d.ts 1.0 KB

123456789101112131415161718192021222324252627
  1. /**
  2. * 获取除了包裹在整行区域的顶级Node
  3. * @param node 最外层node下的某个childNode
  4. * @param topText 最外层node中文本内容
  5. */
  6. declare function getTopNode(node: Node, topText: string): Node;
  7. /**
  8. * 生成html的string形式
  9. * @param tagName 标签名
  10. * @param content 需要包裹的内容
  11. */
  12. declare function makeHtmlString(node: Node, content: string): string;
  13. /**
  14. * 生成开始或者结束位置的html字符片段
  15. * @param topText 选区所在的行的文本内容
  16. * @param node 选区给出的node节点
  17. * @param startPos node文本内容选取的开始位置
  18. * @param endPos node文本内容选取的结束位置
  19. */
  20. declare function createPartHtml(topText: string, node: Node, startPos: number, endPost?: number): string;
  21. /**
  22. * 生成需要插入的html内容的字符串形式
  23. * @param selection 选区对象
  24. * @param topNode 选区所在行的顶级node节点
  25. */
  26. declare function insertHtml(selection: Selection, topNode: Node): string;
  27. export { getTopNode, makeHtmlString, createPartHtml, insertHtml };