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


TypeScript CaretPosition.default函数代码示例

本文整理汇总了TypeScript中tinymce/core/caret/CaretPosition.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: function

  suite.test('isInSameEditingHost', function () {
    setupHtml(
      '<p>abc</p>' +
      'def' +
      '<span contentEditable="false">' +
      '<span contentEditable="true">ghi</span>' +
      '<span contentEditable="true">jkl</span>' +
      '</span>'
    );

    LegacyUnit.strictEqual(CaretUtils.isInSameEditingHost(
      CaretPosition(findElm('p:first').firstChild, 0),
      CaretPosition(findElm('p:first').firstChild, 1)
    ), true);

    LegacyUnit.strictEqual(CaretUtils.isInSameEditingHost(
      CaretPosition(findElm('p:first').firstChild, 0),
      CaretPosition(getRoot().childNodes[1], 1)
    ), true);

    LegacyUnit.strictEqual(CaretUtils.isInSameEditingHost(
      CaretPosition(findElm('span span:first').firstChild, 0),
      CaretPosition(findElm('span span:first').firstChild, 1)
    ), true);

    LegacyUnit.strictEqual(CaretUtils.isInSameEditingHost(
      CaretPosition(findElm('p:first').firstChild, 0),
      CaretPosition(findElm('span span:first').firstChild, 1)
    ), false);

    LegacyUnit.strictEqual(CaretUtils.isInSameEditingHost(
      CaretPosition(findElm('span span:first').firstChild, 0),
      CaretPosition(findElm('span span:last').firstChild, 1)
    ), false);
  });
开发者ID:enigmatic-user,项目名称:tinymce-1,代码行数:35,代码来源:CaretUtilsTest.ts

示例2: function

 suite.test('Constructor', function () {
   setupHtml('abc');
   LegacyUnit.equalDom(CaretPosition(getRoot(), 0).container(), getRoot());
   LegacyUnit.strictEqual(CaretPosition(getRoot(), 1).offset(), 1);
   LegacyUnit.equalDom(CaretPosition(getRoot().firstChild, 0).container(), getRoot().firstChild);
   LegacyUnit.strictEqual(CaretPosition(getRoot().firstChild, 1).offset(), 1);
 });
开发者ID:enigmatic-user,项目名称:tinymce-1,代码行数:7,代码来源:CaretPositionTest.ts

示例3: function

 suite.test('getClientRects at only one text node should return client rects', function () {
   setupHtml('<p>a<br>b</p>');
   LegacyUnit.equal(CaretPosition(getRoot().firstChild.firstChild, 0).getClientRects().length > 0, true);
   LegacyUnit.equal(CaretPosition(getRoot().firstChild.firstChild, 1).getClientRects().length > 0, true);
   LegacyUnit.equal(CaretPosition(getRoot().firstChild.lastChild, 0).getClientRects().length > 0, true);
   LegacyUnit.equal(CaretPosition(getRoot().firstChild.lastChild, 1).getClientRects().length > 0, true);
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:CaretPositionTest.ts

示例4: setupHtml

  suite.test('isBeforeContentEditableFalse', () => {
    setupHtml(
      '<span contentEditable="false"></span>' +
      '<span contentEditable="false"></span>a'
    );

    LegacyUnit.strictEqual(isBeforeContentEditableFalse(CaretPosition(getRoot(), 0)), true);
    LegacyUnit.strictEqual(isBeforeContentEditableFalse(CaretPosition(getRoot(), 1)), true);
    LegacyUnit.strictEqual(isBeforeContentEditableFalse(CaretPosition(getRoot(), 2)), false);
    LegacyUnit.strictEqual(isBeforeContentEditableFalse(CaretPosition(getRoot(), 3)), false);
  });
开发者ID:tinymce,项目名称:tinymce,代码行数:11,代码来源:CaretPositionPredicatesTest.ts

示例5: function

 suite.test('from index text node over comment', function () {
   setupHtml('abcd<!-- x -->abcd');
   CaretAsserts.assertCaretPosition(logicalCaret.next(CaretPosition(getRoot(), 0)), CaretPosition(getRoot().firstChild, 0));
   CaretAsserts.assertCaretPosition(logicalCaret.next(CaretPosition(getRoot(), 1)), CaretPosition(getRoot().lastChild, 0));
   CaretAsserts.assertCaretPosition(logicalCaret.prev(CaretPosition(getRoot(), 2)), CaretPosition(getRoot().firstChild, 4));
   CaretAsserts.assertCaretPosition(logicalCaret.prev(CaretPosition(getRoot(), 3)), CaretPosition(getRoot().lastChild, 4));
 });
开发者ID:mdgbayly,项目名称:tinymce,代码行数:7,代码来源:CaretWalkerTest.ts

示例6: setupHtml

    Step.sync(function () {
      setupHtml('<span contentEditable="false">1</span><span contentEditable="false">2</span>');

      CaretContainer.insertBlock('p', getRoot().childNodes[1], true);
      Assertions.assertEq('Should be block container', true, CaretContainer.isCaretContainerBlock(getRoot().childNodes[1]));

      const pos = CaretContainerRemove.removeAndReposition(getRoot().childNodes[1], CaretPosition(getRoot(), 3));
      Assertions.assertEq('Should be changed offset', 2, pos.offset());
      Assertions.assertDomEq('Should be unchanged container', Element.fromDom(getRoot()), Element.fromDom(pos.container()));
      Assertions.assertEq('Should not be block container', false, CaretContainer.isCaretContainerBlock(getRoot().childNodes[1]));
    })
开发者ID:abstask,项目名称:tinymce,代码行数:11,代码来源:CaretContainerRemoveTest.ts

示例7: function

  suite.test('downUntil', function () {
    let caretPosition, result, predicateCallCount = 0;

    const predicate = function () {
      predicateCallCount++;
      return false;
    };

    $(getRoot()).html('<p>a</p><p>b</p><p>c</p>');

    caretPosition = CaretPosition(getRoot().firstChild.firstChild, 0);
    result = LineWalker.downUntil(getRoot(), predicate, caretPosition);

    LegacyUnit.equal(result.length, 3);
    LegacyUnit.equal(result[0].line, 0);
    LegacyUnit.equal(result[1].line, 1);
    LegacyUnit.equal(result[2].line, 2);
    LegacyUnit.equal(predicateCallCount, 3);
  });
开发者ID:abstask,项目名称:tinymce,代码行数:19,代码来源:LineWalkerTest.ts

示例8: CaretPosition

 const findTextPos = function (selector, offset) {
   return CaretPosition(DomQuery(selector, getRoot())[0].firstChild, offset);
 };
开发者ID:mdgbayly,项目名称:tinymce,代码行数:3,代码来源:CaretWalkerTest.ts


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