本文整理汇总了TypeScript中tinymce/core/api/dom/DOMUtils.DOM.create方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.create方法的具体用法?TypeScript DOM.create怎么用?TypeScript DOM.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tinymce/core/api/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: HTMLElement = 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);
}
};