当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript DOM.uniqueId方法代码示例

本文整理汇总了TypeScript中tinymce/core/api/dom/DOMUtils.DOM.uniqueId方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.uniqueId方法的具体用法?TypeScript DOM.uniqueId怎么用?TypeScript DOM.uniqueId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tinymce/core/api/dom/DOMUtils.DOM的用法示例。


在下文中一共展示了DOM.uniqueId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
    };
开发者ID:abstask,项目名称:tinymce,代码行数:18,代码来源:ImportCss.ts

示例2: function

    const processSelector = function (selector: string, group: StyleGroup) {
      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);

          // NOTE: itemDefaults has been removed as it was not supported by bridge and its concept
          // is handled elsewhere.
          return Tools.extend({}, {
            title: format.title,
            format: formatName
          });
        }
      }

      return null;
    };
开发者ID:tinymce,项目名称:tinymce,代码行数:20,代码来源:ImportCss.ts

示例3: 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 ? '&#215;' : '') +
      '</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;
};
开发者ID:abstask,项目名称:tinymce,代码行数:72,代码来源:ColorPickerHtml.ts

示例4: function

/**
 * Copyright (c) Tiny Technologies, Inc. All rights reserved.
 * Licensed under the LGPL or a commercial license.
 * For LGPL see License.txt in the project root for license information.
 * For commercial licenses see https://www.tiny.cloud/
 */

import DOMUtils from 'tinymce/core/api/dom/DOMUtils';
import Tools from 'tinymce/core/api/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);
  }
};

export default {
  load
开发者ID:danielpunkass,项目名称:tinymce,代码行数:31,代码来源:LoadCss.ts


注:本文中的tinymce/core/api/dom/DOMUtils.DOM.uniqueId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。