本文整理匯總了TypeScript中tinymce/core/dom/DOMUtils.DOM.create方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript DOM.create方法的具體用法?TypeScript DOM.create怎麽用?TypeScript DOM.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tinymce/core/dom/DOMUtils.DOM
的用法示例。
在下文中一共展示了DOM.create方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
suite.test('isUIElement on valid element', function (editor) {
const uiElm1 = DOMUtils.DOM.create('div', { class: 'mce-abc' }, null);
const uiElm2 = DOMUtils.DOM.create('div', { class: 'mcex-abc' }, null);
const noUiElm = DOMUtils.DOM.create('div', { class: 'mcey-abc' }, null);
editor.settings.custom_ui_selector = '.mcex-abc';
LegacyUnit.equal(FocusController.isUIElement(editor, uiElm1), true, 'Should be true since mce- is a ui prefix');
LegacyUnit.equal(FocusController.isUIElement(editor, uiElm2), true, 'Should be true since mcex- is a ui prefix');
LegacyUnit.equal(FocusController.isUIElement(editor, noUiElm), false, 'Should be true since mcey- is not a ui prefix');
delete editor.settings.custom_ui_selector;
});
示例2: function
export default function () {
const domElm = DOMUtils.DOM.create('div', {
style: 'position: absolute; right: 10px; top: 10px;'
});
const attach = function (preventDuplicates?) {
if (preventDuplicates && domElm.parentNode === document.body) {
detach();
}
document.body.appendChild(domElm);
};
const detach = function () {
DOMUtils.DOM.remove(domElm);
};
const update = function (html) {
DOMUtils.DOM.setHTML(domElm, html);
};
const get = function () {
return domElm;
};
return {
attach,
update,
detach,
get
};
}
示例3: function
const load = function (doc, url) {
const linkElements = Tools.toArray(doc.getElementsByTagName('link'));
const matchingLinkElms = Tools.grep(linkElements, function (head) {
return head.id === cssId;
});
if (matchingLinkElms.length === 0) {
const linkElm = DOMUtils.DOM.create('link', {
id: cssId,
rel: 'stylesheet',
href: url
});
doc.getElementsByTagName('head')[0].appendChild(linkElm);
}
};