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


TypeScript Merger.deepMerge方法代码示例

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


在下文中一共展示了Merger.deepMerge方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:

const renderCommonSpec = (spec, actionOpt, extraBehaviours = [], dom, components) => {
  const action = actionOpt.fold(() => {
    return {};
  }, (action) => {
    return {
      action
    };
  });

  const common = {
    buttonBehaviours: Behaviour.derive([
      DisablingConfigs.button(spec.disabled),
      Tabstopping.config({}),
      AddEventsBehaviour.config('button press', [
        AlloyEvents.preventDefault('click'),
        AlloyEvents.preventDefault('mousedown')
      ])
    ].concat(extraBehaviours)),
    eventOrder: {
      click: ['button press', 'alloy.base.behaviour'],
      mousedown: ['button press', 'alloy.base.behaviour']
    },
    ...action
  };
  const domFinal = Merger.deepMerge(common, { dom });
  return Merger.deepMerge(domFinal, { components });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:27,代码来源:Button.ts

示例3: generateValueIfRequired

 return Arr.foldr(realItems, (acc, item) => {
   const itemWithValue = generateValueIfRequired(item);
   const newData = getFromItem(itemWithValue, menuItems);
   return {
     menus: Merger.deepMerge(acc.menus, newData.menus),
     items: [ newData.item ].concat(acc.items),
     expansions: Merger.deepMerge(acc.expansions, newData.expansions)
   };
 }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:MenuConversion.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: createPartialChoiceMenu

 }).map((items) => {
   return Option.from(createTieredDataFrom(
     Merger.deepMerge(
       createPartialChoiceMenu(
         Id.generate('menu-value'),
         items,
         (value) => {
           spec.onItemAction(getApi(comp), value);
         },
         spec.columns,
         spec.presets,
         ItemResponse.CLOSE_ON_EXECUTE,
         spec.select.getOr(() => false),
         providersBackstage
       ),
       {
         movement: deriveMenuMovement(spec.columns, spec.presets),
         menuBehaviours: SimpleBehaviours.unnamedEvents(spec.columns !== 'auto' ? [ ] : [
           AlloyEvents.runOnAttached((comp, se) => {
             detectSize(comp, 4, classForPreset(spec.presets)).each(({ numRows, numColumns }) => {
               Keying.setGridSize(comp, numRows, numColumns);
             });
           })
         ])
       } as TieredMenuTypes.PartialMenuSpec
     )
   ));
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:28,代码来源:ToolbarButtons.ts

示例6: toValidValues

 const updateDataWithForm = (form: AlloyComponent): void => {
   const formData = Representing.getValue(form);
   const validData = toValidValues(formData).getOr({ });
   const currentData = storedValue.get();
   const newData = Merger.deepMerge(currentData, validData);
   storedValue.set(newData);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:TabPanel.ts

示例7:

 const getAnchor = (position: Toolbar.ContextToolbarPosition, element: Option<Element>) => {
   const anchorage = position === 'node' ? extras.backstage.shared.anchors.node(element) : extras.backstage.shared.anchors.cursor();
   const anchor = Merger.deepMerge(
     anchorage,
     position === 'line' ? lineAnchorSpec : anchorSpec
   );
   return anchor;
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:ContextToolbar.ts

示例8: isSelectedFor

const processBasic = (item: { format: string }, isSelectedFor, getPreviewFor): FormatItem => {
  const formatterSpec: Partial<FormatItem> = {
    type: 'formatter',
    isSelected: isSelectedFor(item.format),
    getStylePreview: getPreviewFor(item.format)
  };
  return Merger.deepMerge(item, formatterSpec);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:FormatRegister.ts

示例9: next

  return Step.stateful(function (value, next, die) {
    const style = Element.fromTag('style');
    const head = Element.fromDom(doc.dom().head);
    Insert.append(head, style);
    Html.set(style, styles.join('\n'));

    next(Merger.deepMerge(value, {
      style
    }));
  });
开发者ID:abstask,项目名称:tinymce,代码行数:10,代码来源:GuiSetup.ts


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