How to use the @ephox/katamari.Merger.merge 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 / plugins / media / main / ts / ui / Dialog.ts View on Github external
const unwrap = (data: DialogData): MediaData => {
  const unwrapped = Merger.merge(data, {
    source1: data.source1.value,
    source2: Obj.get(data, 'source2').bind((source2) => Obj.get(source2, 'value')).getOr(''),
    poster: Obj.get(data, 'poster').bind((poster) => Obj.get(poster, 'value')).getOr('')
  });

  // Add additional size values that may or may not have been in the data
  Obj.get(data, 'dimensions').each((dimensions) => {
    Arr.each([ 'width', 'height' ] as ('width' | 'height')[], (prop) => {
      Obj.get(dimensions, prop).each((value) => unwrapped[prop] = value);
    });
  });

  return unwrapped;
};
github tinymce / tinymce / modules / tinymce / src / plugins / emoticons / main / ts / core / EmojiDatabase.ts View on Github external
return Obj.map(userDefinedEmoticons, (value: RawEmojiEntry) => {
    // Set some sane defaults for the custom emoji entry
    return Merger.merge({ keywords: [], category: 'user' }, value);
  });
};
github tinymce / tinymce / modules / tinymce / src / plugins / media / main / ts / ui / Dialog.ts View on Github external
const wrap = (data: MediaData): DialogData => {
  const wrapped = Merger.merge(data, {
    source1: { value: Obj.get(data, 'source1').getOr('') },
    source2: { value: Obj.get(data, 'source2').getOr('') },
    poster: { value: Obj.get(data, 'poster').getOr('') }
  });

  // Add additional size values that may or may not have been in the html
  Arr.each([ 'width', 'height' ] as (keyof MediaData)[], (prop) => {
    Obj.get(data, prop).each((value) => {
      const dimensions = wrapped.dimensions || {};
      dimensions[prop] = value;
      wrapped.dimensions = dimensions;
    });
  });

  return wrapped;
};
github tinymce / tinymce / modules / tinymce / src / plugins / emoticons / main / ts / core / EmojiDatabase.ts View on Github external
Resource.load(databaseId, databaseUrl).then((emojis) => {
      const userEmojis = getUserDefinedEmoticons(editor);
      processEmojis(Merger.merge(emojis, userEmojis));
    }, (err) => {
      // tslint:disable-next-line:no-console
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ContextToolbar.ts View on Github external
return ctx.type === 'contexttoolbar' ? (() => {
      const allButtons = Merger.merge(buttons, scopes.formNavigators);
      const initGroups = identifyButtons(editor, { buttons: allButtons, toolbar: ctx.items }, extras, Option.some([ 'form:' ]));
      return renderToolbar({
        uid: Id.generate('context-toolbar'),
        initGroups,
        onEscape: Option.none,
        cyclicKeying: true,
        backstage: extras.backstage,
        getSink: () => Result.error('')
      });
    })() : (() => {
      return ContextForm.renderContextForm(ctx, extras.backstage);
github tinymce / tinymce / modules / tinymce / src / plugins / table / main / ts / ui / TableDialog.ts View on Github external
});
      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));
};
github tinymce / tinymce / modules / tinymce / src / plugins / table / main / ts / ui / TableDialog.ts View on Github external
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));
};