当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript document.createRange方法代码示例

本文整理汇总了TypeScript中@ephox/dom-globals.document.createRange方法的典型用法代码示例。如果您正苦于以下问题:TypeScript document.createRange方法的具体用法?TypeScript document.createRange怎么用?TypeScript document.createRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ephox/dom-globals.document的用法示例。


在下文中一共展示了document.createRange方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 return Chain.mapper(function (viewBlock: any) {
   const container = Hierarchy.follow(Element.fromDom(viewBlock.get()), cursorPath).getOrDie();
   const rng = document.createRange();
   rng.setStart(container.dom(), cursorOffset);
   rng.setEnd(container.dom(), cursorOffset);
   return CefDeleteAction.read(viewBlock.get(), forward, rng);
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:CefDeleteActionTest.ts

示例2: next

 return Step.stateful(function (value, next, die) {
   const startContainer = Hierarchy.follow(Element.fromDom(viewBlock.get()), startPath).getOrDie();
   const endContainer = Hierarchy.follow(Element.fromDom(viewBlock.get()), endPath).getOrDie();
   const rng = document.createRange();
   rng.setStart(startContainer.dom(), startOffset);
   rng.setEnd(endContainer.dom(), endOffset);
   next(rng);
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:RangeNormalizerTest.ts

示例3: function

const rangeFromPositions = function (from, to) {
  const range = document.createRange();

  range.setStart(from.container(), from.offset());
  range.setEnd(to.container(), to.offset());

  return range;
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:InlineBoundaryDelete.ts

示例4: function

  const createRng = function (text, startOffset, endOffset) {

    const textNode = document.createTextNode(text);
    const rng = document.createRange();
    rng.setStart(textNode, startOffset);
    rng.setEnd(textNode, endOffset);

    return rng;
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:FindInlinePatternTest.ts

示例5: function

  suite.test('set range after ce=false element but lean forwards', function (editor) {
    editor.setContent('<p contenteditable="false">1</p><p contenteditable="false">2</p>');

    const rng = document.createRange();
    rng.setStartBefore(editor.dom.select('p[contenteditable=false]')[1]);
    rng.setEndBefore(editor.dom.select('p[contenteditable=false]')[1]);

    editor.selection.setRng(rng, true);
    LegacyUnit.equal(editor.selection.getNode().getAttribute('data-mce-caret'), 'before');
  });
开发者ID:tinymce,项目名称:tinymce,代码行数:10,代码来源:SelectionOverridesTest.ts

示例6:

    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 FragmentReader.read(Element.fromDom(viewBlock.get()), [rng]);
    });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:10,代码来源:FragmentReaderTest.ts

示例7:

    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 SelectionUtils.hasAllContentsSelected(Element.fromDom(viewBlock.get()), rng);
    });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:10,代码来源:SelectionUtilsTest.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: 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:tinymce,项目名称:tinymce,代码行数:10,代码来源:SelectionBookmarkInlineEditorTest.ts


注:本文中的@ephox/dom-globals.document.createRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。