How to use the @ephox/katamari.Arr.map function in @ephox/katamari

To help you get started, we’ve selected a few @ephox/katamari examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / core / complex / utils / FormatRegister.ts View on Github external
const doEnrich = (items): FormatItem[] => {
    return Arr.map(items, (item) => {
      const keys = Obj.keys(item);
      // If it is a submenu, enrich all the subitems.
      if (Objects.hasKey(item, 'items')) {
        const newItems = doEnrich(item.items);
        return Merger.deepMerge(
          enrichMenu(item),
          {
            getStyleItems: () => newItems
          }
        ) as FormatItem;
      } else if (Objects.hasKey(item, 'format')) {
        return enrichSupported(item);

        // NOTE: This branch is added from the original StyleFormats in mobile
      } else if (keys.length === 1 && Arr.contains(keys, 'title')) {
        return Merger.deepMerge(item, { type: 'separator' }) as FormatItem;
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / core / complex / FontSelect.ts View on Github external
const splitFonts = (fontFamily: string): string[] => {
  const fonts = fontFamily.split(/\s*,\s*/);
  return Arr.map(fonts, (font) => font.replace(/^['"]+|['"]+$/g, ''));
};
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / api / Settings.ts View on Github external
const getMultipleToolbarsSetting = (editor: Editor): Option => {
  const keys = Obj.keys(editor.settings);
  const toolbarKeys = Arr.filter(keys, (key) => /^toolbar([1-9])$/.test(key));
  const toolbars = Arr.map(toolbarKeys, (key) => editor.getParam(key, false, 'string'));
  const toolbarArray = Arr.filter(toolbars, (toolbar) => typeof toolbar === 'string');
  return toolbarArray.length > 0 ? Option.some(toolbarArray) : Option.none();
};
github tinymce / tinymce / modules / tinymce / src / core / main / ts / commands / IndentOutdent.ts View on Github external
const getBlocksToIndent = (editor: Editor) => {
  return Arr.filter(Arr.map(editor.selection.getSelectedBlocks(), Element.fromDom), (el) =>
    !isListComponent(el) && !parentIsListComponent(el) && isEditable(el)
  ) as Element[];
};
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / dialog / Table.ts View on Github external
const renderHeader = (header: string[]) => ({
    dom: {
      tag: 'thead'
    },
    components: [
      {
        dom: {
          tag: 'tr'
        },
        components: Arr.map(header, renderTh)
      }
    ]
  });
  const renderTd = (text: string) => ({ dom: { tag: 'td', innerHtml: providersBackstage.translate(text) } });
github tinymce / tinymce / modules / tinymce / src / core / main / ts / annotate / Wrapping.ts View on Github external
const processNodes = (nodes) => {
    const elems = Arr.map(nodes, Element.fromDom);
    processElements(elems);
  };
github tinymce / tinymce / modules / tinymce / src / themes / silver / demo / ts / components / DialogComponentsDemo.ts View on Github external
getItems: (value) => {
      return Arr.map([
        {
          text: 'Cat'
        },
        {
          text: 'Dog'
        }
      ], (d) => makeItem(d.text));
    }
  }, backstage);
github tinymce / tinymce / modules / tinymce / src / plugins / table / main / ts / api / Api.ts View on Github external
}, function (rows) {
    return Arr.map(rows, function (row) {
      return row.dom();
    });
  });
};
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / dialog / Table.ts View on Github external
  const renderRows = (rows: string[][]) => ({ dom: { tag: 'tbody' }, components: Arr.map(rows, renderTr) });
  return {
github tinymce / tinymce / modules / tinymce / src / plugins / charmap / main / ts / ui / Dialog.ts View on Github external
const makeTabs = () => {
    return Arr.map(charMap, (charGroup) => {
      return {
        title: charGroup.name,
        name: charGroup.name,
        items: makeGroupItems()
      };
    });
  };