本文整理汇总了TypeScript中tinymce/core/dom/DOMUtils.DOM.uniqueId方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.uniqueId方法的具体用法?TypeScript DOM.uniqueId怎么用?TypeScript DOM.uniqueId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tinymce/core/dom/DOMUtils.DOM
的用法示例。
在下文中一共展示了DOM.uniqueId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const processSelector = function (selector, group) {
if (isUniqueSelector(editor, selector, group, globallyUniqueSelectors)) {
markUniqueSelector(editor, selector, group, globallyUniqueSelectors);
const format = convertSelectorToFormat(editor, editor.plugins.importcss, selector, group);
if (format) {
const formatName = format.name || DOMUtils.DOM.uniqueId();
editor.formatter.register(formatName, format);
return Tools.extend({}, ctrl.settings.itemDefaults, {
text: format.title,
format: formatName
});
}
}
return null;
};
示例2: function
const getHtml = function (cols, rows, colorMap, hasColorPicker) {
let colors, color, html, last, x, y, i, count = 0;
const id = DOMUtils.DOM.uniqueId('mcearia');
const getColorCellHtml = function (color, title) {
const isNoColor = color === 'transparent';
return (
'<td class="mce-grid-cell' + (isNoColor ? ' mce-colorbtn-trans' : '') + '">' +
'<div id="' + id + '-' + (count++) + '"' +
' data-mce-color="' + (color ? color : '') + '"' +
' role="option"' +
' tabIndex="-1"' +
' style="' + (color ? 'background-color: ' + color : '') + '"' +
' title="' + I18n.translate(title) + '">' +
(isNoColor ? '×' : '') +
'</div>' +
'</td>'
);
};
colors = TextColor.mapColors(colorMap);
colors.push({
text: I18n.translate('No color'),
color: 'transparent'
});
html = '<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>';
last = colors.length - 1;
for (y = 0; y < rows; y++) {
html += '<tr>';
for (x = 0; x < cols; x++) {
i = y * cols + x;
if (i > last) {
html += '<td></td>';
} else {
color = colors[i];
html += getColorCellHtml(color.color, color.text);
}
}
html += '</tr>';
}
if (hasColorPicker) {
html += (
'<tr>' +
'<td colspan="' + cols + '" class="mce-custom-color-btn">' +
'<div id="' + id + '-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" ' +
'role="button" tabindex="-1" aria-labelledby="' + id + '-c" style="width: 100%">' +
'<button type="button" role="presentation" tabindex="-1">' + I18n.translate('Custom...') + '</button>' +
'</div>' +
'</td>' +
'</tr>'
);
html += '<tr>';
for (x = 0; x < cols; x++) {
html += getColorCellHtml('', 'Custom color');
}
html += '</tr>';
}
html += '</tbody></table>';
return html;
};
示例3: function
/**
* LoadCss.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
import DOMUtils from 'tinymce/core/dom/DOMUtils';
import Tools from 'tinymce/core/util/Tools';
const cssId = DOMUtils.DOM.uniqueId();
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);
}
};