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


TypeScript Tools.map函数代码示例

本文整理汇总了TypeScript中tinymce/core/util/Tools.map函数的典型用法代码示例。如果您正苦于以下问题:TypeScript map函数的具体用法?TypeScript map怎么用?TypeScript map使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了map函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: toggleVisibility

  function toggleVisibility(state) {
    let selectors;

    selectors = Tools.map(handles, function (handle) {
      return '#' + id + '-' + handle.name;
    }).concat(Tools.map(blockers, function (blocker) {
      return '#' + id + '-' + blocker;
    })).join(',');

    if (state) {
      DomQuery(selectors, containerElm).show();
    } else {
      DomQuery(selectors, containerElm).hide();
    }
  }
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:15,代码来源:CropRect.ts

示例2: function

const toBlockElements = function (text, rootTag, rootAttrs) {
  const blocks = text.split(/\n\n/);
  const tagOpen = openContainer(rootTag, rootAttrs);
  const tagClose = '</' + rootTag + '>';

  const paragraphs = Tools.map(blocks, function (p) {
    return p.split(/\n/).join('<br />');
  });

  const stitch = function (p) {
    return tagOpen + p + tagClose;
  };

  return paragraphs.length === 1 ? paragraphs[0] : Tools.map(paragraphs, stitch).join('');
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:15,代码来源:Newlines.ts

示例3: function

const createSidebar = function (editor) {
  const buttons = Tools.map(editor.sidebars, function (sidebar) {
    const settings = sidebar.settings;

    return {
      type: 'button',
      icon: settings.icon,
      image: settings.image,
      tooltip: settings.tooltip,
      onclick: showPanel(editor, sidebar.name, editor.sidebars)
    };
  });

  return {
    type: 'panel',
    name: 'sidebar',
    layout: 'stack',
    classes: 'sidebar',
    items: [
      {
        type: 'toolbar',
        layout: 'stack',
        classes: 'sidebar-toolbar',
        items: buttons
      }
    ]
  };
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:28,代码来源:Sidebar.ts

示例4: function

const getFontItems = function (editor) {
  const defaultFontsFormats = (
    'Andale Mono=andale mono,monospace;' +
    'Arial=arial,helvetica,sans-serif;' +
    'Arial Black=arial black,sans-serif;' +
    'Book Antiqua=book antiqua,palatino,serif;' +
    'Comic Sans MS=comic sans ms,sans-serif;' +
    'Courier New=courier new,courier,monospace;' +
    'Georgia=georgia,palatino,serif;' +
    'Helvetica=helvetica,arial,sans-serif;' +
    'Impact=impact,sans-serif;' +
    'Symbol=symbol;' +
    'Tahoma=tahoma,arial,helvetica,sans-serif;' +
    'Terminal=terminal,monaco,monospace;' +
    'Times New Roman=times new roman,times,serif;' +
    'Trebuchet MS=trebuchet ms,geneva,sans-serif;' +
    'Verdana=verdana,geneva,sans-serif;' +
    'Webdings=webdings;' +
    'Wingdings=wingdings,zapf dingbats'
  );

  const fonts = createFormats(editor.settings.font_formats || defaultFontsFormats);

  return Tools.map(fonts, function (font) {
    return {
      text: { raw: font[0] },
      value: font[1],
      textStyle: font[1].indexOf('dings') === -1 ? 'font-family:' + font[1] : ''
    };
  });
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:31,代码来源:FontSelect.ts

示例5: function

      colorPickerCallback.call(editor, function (value) {
        const tableElm = buttonCtrl.panel.getEl().getElementsByTagName('table')[0];
        let customColorCells, div, i;

        customColorCells = Tools.map(tableElm.rows[tableElm.rows.length - 1].childNodes, function (elm) {
          return elm.firstChild;
        });

        for (i = 0; i < customColorCells.length; i++) {
          div = customColorCells[i];
          if (!div.getAttribute('data-mce-color')) {
            break;
          }
        }

        // Shift colors to the right
        // TODO: Might need to be the left on RTL
        if (i === cols) {
          for (i = 0; i < cols - 1; i++) {
            setDivColor(customColorCells[i], customColorCells[i + 1].getAttribute('data-mce-color'));
          }
        }

        setDivColor(div, value);
        selectColor(value);
      }, currentColor);
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:26,代码来源:Buttons.ts

示例6: function

const toMenuItems = function (styles) {
  return Tools.map(styles, function (styleValue) {
    const text = styleValueToText(styleValue);
    const data = styleValue === 'default' ? '' : styleValue;

    return { text, data };
  });
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:8,代码来源:ListStyles.ts

示例7: function

const findParentListItemsNodes = function (editor, elms) {
  const listItemsElms = Tools.map(elms, function (elm) {
    const parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm));

    return parentLi ? parentLi : elm;
  });

  return DomQuery.unique(listItemsElms);
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:9,代码来源:Selection.ts

示例8: function

const getItems = function (editor) {
  return Tools.map(Settings.getLanguages(editor).split(','), function (langPair) {
    langPair = langPair.split('=');

    return {
      name: langPair[0],
      value: langPair[1]
    };
  });
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:10,代码来源:Buttons.ts

示例9: function

const createCustomMenuItems = function (editor, names) {
  let items, nameList;

  if (typeof names === 'string') {
    nameList = names.split(' ');
  } else if (Tools.isArray(names)) {
    return Arr.flatten(Tools.map(names, function (names) {
      return createCustomMenuItems(editor, names);
    }));
  }

  items = Tools.grep(nameList, function (name) {
    return name === '|' || name in editor.menuItems;
  });

  return Tools.map(items, function (name) {
    return name === '|' ? { text: '-' } : editor.menuItems[name];
  });
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:19,代码来源:InsertButton.ts

示例10: function

const buildMenuItems = function (editor, blocks) {
  return Tools.map(blocks, function (block) {
    return {
      text: block[0],
      onclick: FormatUtils.toggleFormat(editor, block[1]),
      textStyle () {
        return editor.formatter.getCssText(block[1]);
      }
    };
  });
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:11,代码来源:FormatSelect.ts


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