當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Tools.map函數代碼示例

本文整理匯總了TypeScript中tinymce/core/api/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:abstask,項目名稱:tinymce,代碼行數:15,代碼來源:CropRect.ts

示例2: function

const toBlockElements = function (text: string, rootTag: string, rootAttrs: 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:abstask,項目名稱:tinymce,代碼行數: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:abstask,項目名稱:tinymce,代碼行數: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:abstask,項目名稱:tinymce,代碼行數: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:danielpunkass,項目名稱:tinymce,代碼行數: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:danielpunkass,項目名稱:tinymce,代碼行數: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:danielpunkass,項目名稱:tinymce,代碼行數:9,代碼來源:Selection.ts

示例8: 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:danielpunkass,項目名稱:tinymce,代碼行數:19,代碼來源:InsertButton.ts

示例9: 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:abstask,項目名稱:tinymce,代碼行數:10,代碼來源:Buttons.ts

示例10: callback

 fetch : (callback) => {
   const items = Tools.map(languageMenuItems, (languageItem) => {
     return {
       type: 'choiceitem',
       value: languageItem.data,
       text: languageItem.text
     };
   });
   callback(items);
 },
開發者ID:tinymce,項目名稱:tinymce,代碼行數:10,代碼來源:Buttons.ts


注:本文中的tinymce/core/api/util/Tools.map函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。