當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript sugar.Hierarchy類代碼示例

本文整理匯總了TypeScript中@ephox/sugar.Hierarchy的典型用法代碼示例。如果您正苦於以下問題:TypeScript Hierarchy類的具體用法?TypeScript Hierarchy怎麽用?TypeScript Hierarchy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Hierarchy類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

  const assertRange = function (root, range, startPath, startOffset, endPath, endOffset) {
    const sc = Hierarchy.follow(Element.fromDom(root), startPath).getOrDie();
    const ec = Hierarchy.follow(Element.fromDom(root), endPath).getOrDie();
    const actualRange = range.getOrDie('Should be some');

    Assertions.assertDomEq('Should be expected start container', sc, Element.fromDom(actualRange.startContainer));
    Assertions.assertEq('Should be expected start offset', startOffset, actualRange.startOffset);
    Assertions.assertDomEq('Should be expected end container', ec, Element.fromDom(actualRange.endContainer));
    Assertions.assertEq('Should be expected end offset', endOffset, actualRange.endOffset);
  };
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:10,代碼來源:NormalizeRangeTest.ts

示例2:

    return Chain.mapper(function (editor) {
      const startContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), startPath).getOrDie();
      const endContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), endPath).getOrDie();

      const rng = editor.dom.createRng();
      rng.setStart(startContainer.dom(), startOffset);
      rng.setEnd(endContainer.dom(), endOffset);

      return ExpandRange.expandRng(editor, rng, format, remove);
    });
開發者ID:abstask,項目名稱:tinymce,代碼行數:10,代碼來源:ExpandRangeTest.ts

示例3:

    return Chain.op(function (editor: any) {
      const startContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), startPath).getOrDie();
      const endContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), endPath).getOrDie();
      const rng = editor.dom.createRng();

      rng.setStart(startContainer.dom(), startOffset);
      rng.setEnd(endContainer.dom(), endOffset);

      editor.selection.setRng(rng);
    });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:10,代碼來源:EditorFocusTest.ts

示例4: function

    const setSelection = function (editor, start, soffset, finish, foffset) {
      const sc = Hierarchy.follow(Element.fromDom(editor.getBody()), start).getOrDie();
      const fc = Hierarchy.follow(Element.fromDom(editor.getBody()), start).getOrDie();

      const rng = document.createRange();
      rng.setStart(sc.dom(), soffset);
      rng.setEnd(fc.dom(), foffset);

      editor.selection.setRng(rng);
    };
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:10,代碼來源:SelectionBookmarkIframeEditorTest.ts

示例5:

    return Chain.mapper(function (viewBlock) {
      const sc = Hierarchy.follow(Element.fromDom(viewBlock.get()), startPath).getOrDie();
      const ec = Hierarchy.follow(Element.fromDom(viewBlock.get()), endPath).getOrDie();
      const rng = document.createRange();

      rng.setStart(sc.dom(), startOffset);
      rng.setEnd(ec.dom(), endOffset);

      return SelectionUtils.hasAllContentsSelected(Element.fromDom(viewBlock.get()), rng);
    });
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:10,代碼來源:SelectionUtilsTest.ts

示例6:

    return Chain.op(function (editor: any) {
      const startContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), startPath).getOrDie();
      const endContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), endPath).getOrDie();
      const rng = editor.selection.getRng();

      Assertions.assertDomEq('Should be expected from start container', startContainer, Element.fromDom(rng.startContainer));
      Assertions.assertEq('Should be expected from start offset', startOffset, rng.startOffset);
      Assertions.assertDomEq('Should be expected end container', endContainer, Element.fromDom(rng.endContainer));
      Assertions.assertEq('Should be expected end offset', endOffset, rng.endOffset);
    });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:10,代碼來源:EditorFocusTest.ts

示例7:

    return Chain.op(function (blockBoundaryOption: Option<any>) {
      const fromContainer = Hierarchy.follow(Element.fromDom(viewBlock.get()), fromPath).getOrDie();
      const toContainer = Hierarchy.follow(Element.fromDom(viewBlock.get()), toPath).getOrDie();
      const blockBoundary = blockBoundaryOption.getOrDie();

      Assertions.assertDomEq('Should be expected from container', fromContainer, Element.fromDom(blockBoundary.from().position().container()));
      Assertions.assertEq('Should be expected from offset', fromOffset, blockBoundary.from().position().offset());
      Assertions.assertDomEq('Should be expected to container', toContainer, Element.fromDom(blockBoundary.to().position().container()));
      Assertions.assertEq('Should be expected to offset', toOffset, blockBoundary.to().position().offset());
    });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:10,代碼來源:BlockMergeBoundaryTest.ts

示例8:

    return Chain.mapper(function (viewBlock: any) {
      const sc = Hierarchy.follow(Element.fromDom(viewBlock.get()), startPath).getOrDie();
      const ec = Hierarchy.follow(Element.fromDom(viewBlock.get()), endPath).getOrDie();
      const rng = document.createRange();

      rng.setStart(sc.dom(), startOffset);
      rng.setEnd(ec.dom(), endOffset);

      return NormalizeRange.normalize(DOMUtils(document, { root_element: viewBlock.get() }), rng);
    });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:10,代碼來源:NormalizeRangeTest.ts

示例9:

    return Chain.mapper(function (viewBlock) {
      const sc = Hierarchy.follow(Element.fromDom(viewBlock.get()), startPath).getOrDie();
      const ec = Hierarchy.follow(Element.fromDom(viewBlock.get()), endPath).getOrDie();
      const rng = document.createRange();

      rng.setStart(sc.dom(), startOffset);
      rng.setEnd(ec.dom(), endOffset);

      return FragmentReader.read(Element.fromDom(viewBlock.get()), [rng]);
    });
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:10,代碼來源:FragmentReaderTest.ts

示例10:

    return Chain.mapper(function () {
      const elm = Element.fromHtml(html);
      const sc = Hierarchy.follow(elm, startPath).getOrDie();
      const ec = Hierarchy.follow(elm, endPath).getOrDie();
      const rng = document.createRange();

      rng.setStart(sc.dom(), startOffset);
      rng.setEnd(ec.dom(), endOffset);

      return TableDeleteAction.getActionFromRange(elm, rng);
    });
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:11,代碼來源:TableDeleteActionTest.ts


注:本文中的@ephox/sugar.Hierarchy類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。