本文整理匯總了TypeScript中tinymce/core/caret/CaretContainer.insertBlock函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript insertBlock函數的具體用法?TypeScript insertBlock怎麽用?TypeScript insertBlock使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了insertBlock函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
suite.test('hasContent', function () {
setupHtml('<span contentEditable="false">1</span>');
const caretContainerBlock = CaretContainer.insertBlock('p', getRoot().firstChild, true);
LegacyUnit.equal(CaretContainer.hasContent(caretContainerBlock), false);
caretContainerBlock.insertBefore(document.createTextNode('a'), caretContainerBlock.firstChild);
LegacyUnit.equal(CaretContainer.hasContent(caretContainerBlock), true);
});
示例2: 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], new 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]));
})