How to use the @ephox/katamari.Obj.get 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 / 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 / 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 / table / main / ts / ui / Helpers.ts View on Github external
const getBorder = () => {
    const borderWidth = style['border-width'];
    if (shouldStyleWithCss(editor) && borderWidth) {
      return { border: borderWidth };
    }
    return Obj.get(attrs, 'border').fold( () => ({}), (border) => ({ border }));
  };
github tinymce / tinymce / modules / tinymce / src / plugins / table / main / ts / ui / Helpers.ts View on Github external
const extractAdvancedStyleData = (dom) => {
    const rgbToHex = (value: string) => Strings.startsWith(value, 'rgb') ? dom.toHex(value) : value;

    const borderStyle = Obj.get(style, 'border-style').getOr('');
    const borderColor = Obj.get(style, 'border-color').getOr('');
    const bgColor = Obj.get(style, 'background-color').getOr('');

    return {
      borderstyle: borderStyle,
      bordercolor: rgbToHex(borderColor),
      backgroundcolor: rgbToHex(bgColor)
    };
  };
github tinymce / tinymce / modules / tinymce / src / plugins / table / main / ts / ui / Helpers.ts View on Github external
const getCellPaddingCellSpacing  = () => {
    const spacing = Obj.get(style, 'border-spacing').or(Obj.get(attrs, 'cellspacing')).fold( () => ({}), (cellspacing) => ({ cellspacing }));
    const padding = Obj.get(style, 'border-padding').or(Obj.get(attrs, 'cellpadding')).fold( () => ({}), (cellpadding) => ({ cellpadding }));
    return {
      ...spacing,
      ...padding
    };
  };
github tinymce / tinymce / modules / tinymce / src / plugins / media / main / ts / ui / Dialog.ts View on Github external
Arr.each([ 'width', 'height' ] as (keyof MediaData)[], (prop) => {
    Obj.get(data, prop).each((value) => {
      const dimensions = wrapped.dimensions || {};
      dimensions[prop] = value;
      wrapped.dimensions = dimensions;
    });
  });
github tinymce / tinymce / modules / tinymce / src / plugins / help / main / ts / ui / Dialog.ts View on Github external
const foundTabs: Option[] = Arr.map(names, (name) => {
      return Obj.get(tabs, name);
    });
    const dialogTabs: Types.Dialog.TabApi[] = Options.cat(foundTabs);