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


TypeScript boulder.Objects类代码示例

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


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

示例1: function

const getFromExpandingItem = function (item) {
  const newItem = Merger.deepMerge(
    Objects.exclude(item, [ 'items' ]),
    {
      menu: true
    }
  );

  const rest = expand(item.items);

  const newMenus = Merger.deepMerge(
    rest.menus,
    Objects.wrap(
      item.title,
      rest.items
    )
  );
  const newExpansions = Merger.deepMerge(
    rest.expansions,
    Objects.wrap(item.title, item.title)
  );

  return {
    item: newItem,
    menus: newMenus,
    expansions: newExpansions
  };
};
开发者ID:abstask,项目名称:tinymce,代码行数:28,代码来源:StyleConversions.ts

示例2: function

 return Arr.map(items, function (item) {
   if (Objects.hasKey(item, 'items')) {
     const newItems = doEnrich(item.items);
     return Merger.deepMerge(
       enrichMenu(item),
       {
         items: newItems
       }
     );
   } else if (Objects.hasKey(item, 'format')) {
     return enrichSupported(item);
   } else {
     return enrichCustom(item);
   }
 });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:15,代码来源:StyleFormats.ts

示例3: function

 Logger.sync('getInfo ... ' + scenario.label + ', link: ' + scenario.linkHtml, function () {
   editorState.start.set(Element.fromHtml(scenario.linkHtml).dom());
   editorState.content.set(scenario.selection);
   const info = LinkBridge.getInfo(editor);
   RawAssertions.assertEq('Checking getInfo (link)', scenario.expected, Objects.narrow(info, [ 'url', 'text', 'target', 'title' ]));
   RawAssertions.assertEq('Checking link is set', true, info.link.isSome());
 });
开发者ID:abstask,项目名称:tinymce,代码行数:7,代码来源:LinkBridgeTest.ts

示例4: function

const convert = function (formats, memMenuThunk) {
  const mainMenu = makeMenu('Styles', [
  ].concat(
    Arr.map(formats.items, function (k) {
      return makeItem(getValue(k), k.title, k.isSelected(), k.getPreview(), Objects.hasKey(formats.expansions, getValue(k)));
    })
  ), memMenuThunk, false);

  const submenus = Obj.map(formats.menus, function (menuItems, menuName) {
    const items = Arr.map(menuItems, function (item) {
      return makeItem(
        getValue(item),
        item.title,
        item.isSelected !== undefined ? item.isSelected() : false,
        item.getPreview !== undefined ? item.getPreview() : '',
        Objects.hasKey(formats.expansions, getValue(item))
      );
    });
    return makeMenu(menuName, items, memMenuThunk, true);
  });

  const menus = Merger.deepMerge(submenus, Objects.wrap('styles', mainMenu));

  const tmenu = TieredMenu.tieredData('styles', menus, formats.expansions);

  return {
    tmenu
  };
};
开发者ID:abstask,项目名称:tinymce,代码行数:29,代码来源:StylesMenu.ts

示例5: process

const buildBasicSettingsDataset = (editor: Editor, settingName, defaults, delimiter: Delimiter): BasicSelectDataset => {
  const rawFormats = Objects.readOptFrom<string>(editor.settings, settingName).getOr(defaults);
  const data = process(split(rawFormats, delimiter));
  return {
    type: 'basic',
    data
  };
};
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:SelectDatasets.ts

示例6: getScopes

 editor.on(showContextToolbarEvent, (e) => {
   const scopes = getScopes();
   // TODO: Have this stored in a better structure
   Objects.readOptFrom<Toolbar.ContextToolbar | Toolbar.ContextForm>(scopes.lookupTable, e.toolbarKey).each((ctx) => {
     launchContext(ctx, e.target === editor ? Option.none() : Option.some(e as DomElement));
     // Forms launched via this way get immediate focus
     InlineView.getContent(contextbar).each(Keying.focusIn);
   });
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:ContextToolbar.ts

示例7:

const generateValueIfRequired = (item: SingleMenuItemApi): SingleMenuItemApi => {
  // Separators don't have a value, so just return the item
  if (isSeparator(item)) {
    return item;
  } else {
    // Use the value already in item if it has one.
    const itemValue = Objects.readOptFrom(item, 'value').getOrThunk(() => Id.generate('generated-menu-item'));
    return Merger.deepMerge({ value: itemValue }, item);
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:10,代码来源:MenuConversion.ts


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