本文整理匯總了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);
};