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


TypeScript Merger.merge方法代碼示例

本文整理匯總了TypeScript中@ephox/katamari.Merger.merge方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Merger.merge方法的具體用法?TypeScript Merger.merge怎麽用?TypeScript Merger.merge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@ephox/katamari.Merger的用法示例。


在下文中一共展示了Merger.merge方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

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

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

示例3:

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

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

示例5: unwrap

  const getSourceData = (api) => {
    const data = unwrap(api.getData());

    return Settings.hasDimensions(editor) ? Merger.merge(data, {
      width: data.dimensions.width,
      height: data.dimensions.height
    }) : data;
  };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:8,代碼來源:Dialog.ts

示例6: createMenuItemFromBridge

 Arr.map(items, (item: SingleMenuItemApi) => {
   const createItem = (i: SingleMenuItemApi) => createMenuItemFromBridge(i, itemResponse, backstage, hasIcons);
   if (item.type === 'nestedmenuitem' && item.getSubmenuItems().length <= 0) {
     return createItem(Merger.merge(item, {disabled: true}));
   } else {
     return createItem(item);
   }
 })
開發者ID:tinymce,項目名稱:tinymce,代碼行數:8,代碼來源:SingleMenu.ts

示例7: function

 const cCreateInlineEditor = function (settings) {
   return Chain.control(
     McEditor.cFromSettings(Merger.merge(settings, {
       inline: true,
       base_url: '/project/tinymce/js/tinymce'
     })),
     Guard.addLogging('Create inline editor')
   );
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:9,代碼來源:PasteSettingsTest.ts

示例8: function

 const event = function (evt) {
   return Merger.merge({
     shiftKey: false,
     altKey: false,
     ctrlKey: false,
     metaKey: false,
     keyCode: 0
   }, evt);
 };
開發者ID:abstask,項目名稱:tinymce,代碼行數:9,代碼來源:MatchKeysTest.ts

示例9: function

 const cCreateEditorFromSettings = function (settings, html?) {
   return Chain.control(
     McEditor.cFromSettings(Merger.merge(settings, {
       base_url: '/project/tinymce/js/tinymce',
       indent: false
     })),
     Guard.addLogging(`Create editor from ${settings}`)
   );
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:9,代碼來源:PlainTextPasteTest.ts


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