• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript katamari.Merger类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Merger类的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: styleTDTH

const applyDataToElement = (editor: Editor, tableElm, data: TableData) => {
  const dom = editor.dom;
  const attrs: any = {};
  const styles: any = {};

  attrs.class = data.class;

  styles.height = Util.addSizeSuffix(data.height);

  if (dom.getAttrib(tableElm, 'width') && !shouldStyleWithCss(editor)) {
    attrs.width = Util.removePxSuffix(data.width);
  } else {
    styles.width = Util.addSizeSuffix(data.width);
  }

  if (shouldStyleWithCss(editor)) {
    styles['border-width'] = Util.addSizeSuffix(data.border);
    styles['border-spacing'] = Util.addSizeSuffix(data.cellspacing);
  } else {
    attrs.border = data.border;
    attrs.cellpadding = data.cellpadding;
    attrs.cellspacing = data.cellspacing;
  }

  // TODO: this has to be reworked somehow, for example by introducing dedicated option, which
  // will control whether child TD/THs should be processed or not
  if (shouldStyleWithCss(editor) && tableElm.children) {
    for (let i = 0; i < tableElm.children.length; i++) {
      styleTDTH(dom, tableElm.children[i], {
        'border-width': Util.addSizeSuffix(data.border),
        'padding': Util.addSizeSuffix(data.cellpadding),
      });
      if (hasAdvancedTableTab(editor)) {
        styleTDTH(dom, tableElm.children[i], {
          'border-color': data.bordercolor,
        });
      }
    }
  }

  if (hasAdvancedTableTab(editor)) {
    styles['background-color'] = data.backgroundcolor;
    styles['border-color'] = data.bordercolor;
    styles['border-style'] = data.borderstyle;
  }

  attrs.style = dom.serializeStyle(Merger.merge(getDefaultStyles(editor), styles));
  dom.setAttribs(tableElm, Merger.merge(getDefaultAttributes(editor), attrs));
};
开发者ID:tinymce,项目名称:tinymce,代码行数:49,代码来源:TableDialog.ts


示例5: 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


示例6: withRoot

 withRoot((_) => {
   const prevData = instanceApi.getData();
   const mergedData = Merger.merge(prevData, newData);
   const newInternalData = validateData(access, mergedData);
   const form = access.getFormWrapper();
   Representing.setValue(form, newInternalData);
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:SilverDialogInstanceApi.ts


示例7: function

 const serialize = function (node, parserArgs?) {
   const args = Merger.merge({ format: 'html' }, parserArgs ? parserArgs : {});
   const targetNode = DomSerializerPreProcess.process(editor, node, args);
   const html = getHtmlFromNode(dom, targetNode, args);
   const rootNode = parseHtml(htmlParser, html, args);
   return args.format === 'tree' ? rootNode : toHtml(editor, settings, schema, rootNode, args);
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:DomSerializer.ts


示例8:

const renderNormalItemStructure = (info: NormalItemSpec, icon: Option<string>, renderIcons: boolean, textRender: (text: string) => AlloySpec, rtlClass: boolean): ItemStructure => {
  // checkmark has priority, otherwise render icon if we have one, otherwise empty icon for spacing
  const leftIcon = renderIcons ? info.checkMark.orThunk(() => icon.or(Option.some('')).map(renderIcon)) : Option.none();
  const domTitle = info.ariaLabel.map((label): {attributes?: {title: string}} => {
    return {
      attributes: {
        // TODO: AP-213 change this temporary solution to use tooltips, ensure its aria readable still.
        // for icon only implementations we need either a title or aria label to satisfy aria requirements.
        title: I18n.translate(label)
      }
    };
  }).getOr({});

  const dom = Merger.merge({
    tag: 'div',
    classes: [ ItemClasses.navClass, ItemClasses.selectableClass ].concat(rtlClass ? [ ItemClasses.iconClassRtl ] : []),
  }, domTitle);

  const menuItem = {
    dom,
    optComponents: [
      leftIcon,
      info.textContent.map(textRender),
      info.shortcutContent.map(renderShortcut),
      info.caret
    ]
  };
  return menuItem;
};
开发者ID:tinymce,项目名称:tinymce,代码行数:29,代码来源:ItemStructure.ts


示例9: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript katamari.Obj类代码示例发布时间:2022-05-28
下一篇:
TypeScript katamari.LazyValue类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap