How to use the @ephox/katamari.Option.none 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 / themes / silver / main / ts / ui / general / Button.ts View on Github external
export const renderFooterButton = (spec: FooterButtonSpec, buttonType: string, backstage: UiFactoryBackstage): SketchSpec => {
  if (isMenuFooterButtonSpec(spec, buttonType)) {
    return renderMenuButton(spec, ToolbarButtonClasses.Button, backstage, Option.none());
  } else if (isNormalFooterButtonSpec(spec, buttonType)) {
    const action = getAction(spec.name, buttonType);
    const buttonSpec = {
      ...spec,
      borderless: false
    };
    return renderButton(buttonSpec, action, backstage.shared.providers, [ ]);
  } else {
    // tslint:disable-next-line:no-console
    console.error('Unknown footer button type: ', buttonType);
  }
};
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / api / Settings.ts View on Github external
const fixedContainerElement = (editor): Option<element> =&gt; {
  const selector = fixedContainerSelector(editor);
  // If we have a valid selector and are in inline mode, try to get the fixed_toolbar_container
  return selector.length &gt; 0 &amp;&amp; editor.inline ? SelectorFind.descendant(Body.body(), selector) : Option.none();
};
</element>
github tinymce / tinymce / modules / tinymce / src / themes / silver / demo / ts / components / DialogComponentsDemo.ts View on Github external
}, () => {
            console.log('clicked on the button in the grid wrapped by a label');
          }, sharedBackstage.providers) as any,
          renderCheckbox({
            label: 'check box item 1',
            name: 'one',
            disabled: false
          }, sharedBackstage.providers) as any,
          renderCheckbox({
            label: 'check box item 2',
            name: 'two',
            disabled: false
          }, sharedBackstage.providers) as any,
          renderInput({
            label: Option.some('Sample input'),
            inputMode: Option.none(),
            placeholder: Option.none(),
            name: 'exampleinputfieldname',
            maximized: false,
            disabled: false
          }, sharedBackstage.providers) as any
        ]
      }, sharedBackstage) as any
    ]
  }, sharedBackstage);

  const listboxSpec = renderListbox({
    name: 'listbox1',
    label: 'Listbox',
    values: [
      { value: 'alpha', text: 'Alpha' },
      { value: 'beta', text: 'Beta' },
github tinymce / tinymce / modules / tinymce / src / plugins / link / main / ts / ui / Dialog.ts View on Github external
{
      name: 'text',
      type: 'input',
      label: 'Text to display'
    }
  )).toArray();

  const titleText: Types.Dialog.BodyComponentApi[] = settings.flags.titleEnabled ? [
    {
      name: 'title',
      type: 'input',
      label: 'Title'
    }
  ] : [];

  const defaultTarget: Option = Settings.hasDefaultLinkTarget(editorSettings) ? Option.some(Settings.getDefaultLinkTarget(editorSettings)) : Option.none();

  const initialData = getInitialData(settings, defaultTarget);
  const dialogDelta = DialogChanges.init(initialData, settings);
  const catalogs = settings.catalogs;

  const body: Types.Dialog.PanelApi = {
    type: 'panel',
    items: Arr.flatten([
      urlInput,
      displayText,
      titleText,
      Options.cat([
        catalogs.anchor.map(ListOptions.createUi('anchor', 'Anchors')),
        catalogs.rels.map(ListOptions.createUi('rel', 'Rel')),
        catalogs.targets.map(ListOptions.createUi('target', 'Open link in...')),
        catalogs.link.map(ListOptions.createUi('link', 'Link list')),
github tinymce / tinymce / modules / tinymce / src / plugins / link / main / ts / ui / Controls.ts View on Github external
onAction: (formApi) =&gt; {
          const anchor = Utils.getAnchorElement(editor);
          const value = formApi.getValue();
          if (!anchor) {
            const attachState = { href: value, attach: () =&gt; { } };
            const onlyText = Utils.isOnlyTextSelected(editor.selection.getContent());
            const text: Option = onlyText ? Option.some(Utils.getAnchorText(editor.selection, anchor)).filter((t) =&gt; t.length &gt; 0).or(Option.from(value)) : Option.none();
            Utils.link(editor, attachState, {
              href: value,
              text,
              title: Option.none(),
              rel: Option.none(),
              target: Option.none(),
              class: Option.none()
            });
            formApi.hide();
          } else {
            editor.dom.setAttrib(anchor, 'href', value);
            collapseSelectionToEnd(editor);
            formApi.hide();
          }
        }
      },
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / backstage / UrlInputBackstage.ts View on Github external
const getOpt =  (obj: T, key: K): Option =&gt;
  hasOwnProperty.call(obj, key) ? Option.some(obj[key]) : Option.none();
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / context / ContextToolbarLookup.ts View on Github external
return Options.findMap(toolbars, (toolbarApi) =>
    toolbarApi.predicate(elem.dom()) ? Option.some({ toolbarApi, elem }) : Option.none());
};
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / header / StickyHeader.ts View on Github external
focusedElm.get().each((elem) => {
            restoreFocus(comp.element(), elem);
            focusedElm.set(Option.none());
          });
        },
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / api / TouchEvents.ts View on Github external
startData.get().each((data) => {
        if (isFarEnough(touch, data)) {
          startData.set(Option.none());
          longpressFired.set(false);
          editor.fire('longpresscancel');
        }
      });
    });