How to use the @ephox/boulder.Objects.readOptFrom function in @ephox/boulder

To help you get started, we’ve selected a few @ephox/boulder 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 / themes / silver / main / ts / ContextToolbar.ts View on Github external
editor.on(showContextToolbarEvent, (e) => {
    const scopes = getScopes();
    // TODO: Have this stored in a better structure
    Objects.readOptFrom(scopes.lookupTable, e.toolbarKey).each((ctx) => {
      launchContext(ctx, e.target === editor ? Option.none() : Option.some(e as DomElement));
      // Forms launched via this way get immediate focus
      InlineView.getContent(contextbar).each(Keying.focusIn);
    });
  });
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / core / complex / SelectDatasets.ts View on Github external
const buildBasicSettingsDataset = (editor: Editor, settingName, defaults, delimiter: Delimiter): BasicSelectDataset => {
  const rawFormats = Objects.readOptFrom(editor.settings, settingName).getOr(defaults);
  const data = process(split(rawFormats, delimiter));
  return {
    type: 'basic',
    data
  };
};
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / general / UiFactory.ts View on Github external
const interpretParts: FormPartRenderer = (parts, spec, backstage) => {
  return Objects.readOptFrom(factories, spec.type).fold(
    () => {
      console.error(`Unknown factory type "${spec.type}", defaulting to container: `, spec);
      return spec as AlloySpec;
    },
    (factory: FormPartRenderer) => {
      return factory(parts, spec, backstage);
    }
  );
};
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / general / UiFactory.ts View on Github external
return (parts, spec, backstage) => {
    return Objects.readOptFrom(spec, 'name').fold(
      () => render(spec, backstage),
      (fieldName) => parts.field(fieldName, render(spec, backstage) as SimpleOrSketchSpec)
    );
  };
};