本文整理汇总了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);
});
示例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);
});
示例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);
});
示例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);
});
示例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));
});
示例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]));
})
示例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);
});
示例8: CaretPosition
const findTextPos = function (selector, offset) {
return CaretPosition(DomQuery(selector, getRoot())[0].firstChild, offset);
};