当前位置: 首页>>代码示例>>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;未经允许,请勿转载。