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


TypeScript agar.Cursors類代碼示例

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


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

示例1: function

 const createDomSelection = function (container, sPath, soffset, fPath, foffset) {
   const path = Cursors.path({
     startPath: sPath,
     soffset,
     finishPath: fPath,
     foffset
   });
   return toDomRange(Cursors.calculate(container, path));
 };
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:9,代碼來源:TableAsBodyTest.ts

示例2: function

  const sTestBookmark = function (html, path) {
    const dom = DOMUtils.DOM;
    const elm = TinyDom.fromDom(dom.create('div', {}, html));

    return Chain.asStep(elm, [
      Cursors.cFollowPath(Cursors.pathFrom(path)),
      Chain.mapper(toNativeRange),
      Chain.mapper(rangeToBookmark(dom)),
      Chain.mapper(bookmarkToRange(dom)),
      cAssertRangeEq(Cursors.calculate(elm, Cursors.pathFrom(path)))
    ]);
  };
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:12,代碼來源:BookmarkTest.ts

示例3:

    return Step.sync(function () {
      const x = Cursors.calculateOne(Element.fromDom(editor.getBody()), path);
      const rng = editor.dom.createRng();
      rng.setStart(x.dom(), offset);
      rng.setEnd(x.dom(), offset);

      ScrollIntoView.scrollRangeIntoView(editor, rng);
    });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:8,代碼來源:ScrollIntoViewTest.ts

示例4: function

const sOpenToolbarOn = function (editor, selector, path) {
  return Chain.asStep(TinyDom.fromDom(editor.getBody()), [
    UiFinder.cFindIn(selector),
    Cursors.cFollow(path),
    Chain.op(function (target) {
      editor.selection.select(target.dom());
    }),
    Mouse.cClick
  ]);
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:10,代碼來源:TableTestUtils.ts

示例5: function

 const assertPath = function (label, root, expPath, expOffset, actElement, actOffset) {
   const expected = Cursors.calculateOne(root, expPath);
   const message = function () {
     const actual = Element.fromDom(actElement);
     const actPath = Hierarchy.path(root, actual).getOrDie('could not find path to root');
     return 'Expected path: ' + JSON.stringify(expPath) + '.\nActual path: ' + JSON.stringify(actPath);
   };
   Assertions.assertEq('Assert incorrect for ' + label + '.\n' + message(), true, expected.dom() === actElement);
   Assertions.assertEq('Offset mismatch for ' + label + ' in :\n' + Html.getOuter(expected), expOffset, actOffset);
 };
開發者ID:howardjing,項目名稱:tinymce,代碼行數:10,代碼來源:SelectionBookmarkInlineEditorTest.ts

示例6: insert

 const sInsertEmptyTextNodesAt = (editor: Editor, count: number, path: number[], insert: (marker: Element, element: Element) => void) => {
   return Chain.asStep(Element.fromDom(editor.getBody()), [
     Cursors.cFollow(path),
     Chain.op((elm) => {
       Arr.each(Arr.range(count, Fun.identity), () => {
         insert(elm, Element.fromDom(document.createTextNode('')));
       });
     })
   ]);
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:10,代碼來源:InsertKeysTest.ts

示例7:

 WindowSelection.getExact(win).orThunk(function () {
   const fbody = Element.fromDom(frame.dom().contentWindow.document.body);
   const elem = Cursors.calculateOne(fbody, [ 0 ]);
   WindowSelection.setExact(win, elem, 0, elem, 0);
   return Option.none();
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:6,代碼來源:TestFrameEditor.ts


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