How to use the @ephox/boulder.FieldSchema.optionString 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 / bridge / src / main / ts / ephox / bridge / components / dialog / FooterButton.ts View on Github external
];

export const dialogButtonFields = [
  ...baseButtonFields,
  FieldSchema.strictString('text')
];

const normalButtonFields = [
  FieldSchema.strictStringEnum('type', ['submit', 'cancel', 'custom']),
  ...dialogButtonFields
];

const menuButtonFields = [
  FieldSchema.strictStringEnum('type', ['menu']),
  FieldSchema.optionString('text'),
  FieldSchema.optionString('tooltip'),
  FieldSchema.optionString('icon'),
  FieldSchema.strictArrayOf('items', dialogToggleMenuItemSchema),
  FieldSchema.defaultedFunction('onSetup', () => Fun.noop),
  ...baseButtonFields
];

export const dialogButtonSchema = ValueSchema.choose(
  'type',
  {
    submit: normalButtonFields,
    cancel: normalButtonFields,
    custom: normalButtonFields,
    menu: menuButtonFields
  }
);
github tinymce / tinymce / modules / bridge / src / main / ts / ephox / bridge / components / toolbar / ContextToolbar.ts View on Github external
FieldSchema.defaulted('type', 'contextformbutton')
]));

const launchToggleButtonSchema = ValueSchema.objOf(baseToolbarToggleButtonFields.concat([
  FieldSchema.defaulted('type', 'contextformtogglebutton')
]));

const toggleOrNormal = ValueSchema.choose('type', {
  contextformbutton: contextButtonSchema,
  contextformtogglebutton: contextToggleButtonSchema
});

const contextFormSchema = ValueSchema.objOf([
  FieldSchema.defaulted('type', 'contextform'),
  FieldSchema.defaultedFunction('initValue', () => ''),
  FieldSchema.optionString('label'),
  FieldSchema.strictArrayOf('commands', toggleOrNormal),
  FieldSchema.optionOf('launch', ValueSchema.choose('type', {
    contextformbutton: launchButtonSchema,
    contextformtogglebutton: launchToggleButtonSchema
  }))
].concat(contextBarFields));

const contextToolbarSchema = ValueSchema.objOf([
  FieldSchema.defaulted('type', 'contexttoolbar'),
  FieldSchema.strictString('items')
].concat(contextBarFields));

export const createContextToolbar = (spec: ContextToolbarApi): Result> => {
  return ValueSchema.asRaw('ContextToolbar', contextToolbarSchema, spec);
};
github tinymce / tinymce / modules / bridge / src / main / ts / ephox / bridge / components / dialog / FooterButton.ts View on Github external
FieldSchema.defaultedBoolean('disabled', false)
];

export const dialogButtonFields = [
  ...baseButtonFields,
  FieldSchema.strictString('text')
];

const normalButtonFields = [
  FieldSchema.strictStringEnum('type', ['submit', 'cancel', 'custom']),
  ...dialogButtonFields
];

const menuButtonFields = [
  FieldSchema.strictStringEnum('type', ['menu']),
  FieldSchema.optionString('text'),
  FieldSchema.optionString('tooltip'),
  FieldSchema.optionString('icon'),
  FieldSchema.strictArrayOf('items', dialogToggleMenuItemSchema),
  FieldSchema.defaultedFunction('onSetup', () => Fun.noop),
  ...baseButtonFields
];

export const dialogButtonSchema = ValueSchema.choose(
  'type',
  {
    submit: normalButtonFields,
    cancel: normalButtonFields,
    custom: normalButtonFields,
    menu: menuButtonFields
  }
);
github tinymce / tinymce / modules / bridge / src / main / ts / ephox / bridge / components / dialog / FooterButton.ts View on Github external
export const dialogButtonFields = [
  ...baseButtonFields,
  FieldSchema.strictString('text')
];

const normalButtonFields = [
  FieldSchema.strictStringEnum('type', ['submit', 'cancel', 'custom']),
  ...dialogButtonFields
];

const menuButtonFields = [
  FieldSchema.strictStringEnum('type', ['menu']),
  FieldSchema.optionString('text'),
  FieldSchema.optionString('tooltip'),
  FieldSchema.optionString('icon'),
  FieldSchema.strictArrayOf('items', dialogToggleMenuItemSchema),
  FieldSchema.defaultedFunction('onSetup', () => Fun.noop),
  ...baseButtonFields
];

export const dialogButtonSchema = ValueSchema.choose(
  'type',
  {
    submit: normalButtonFields,
    cancel: normalButtonFields,
    custom: normalButtonFields,
    menu: menuButtonFields
  }
);
github tinymce / tinymce / modules / bridge / src / main / ts / ephox / bridge / components / dialog / MenuButton.ts View on Github external
items: DialogMenuButtonItemTypes[];
  onSetup: (api: BaseDialogMenuButtonInstanceApi) => (api: BaseDialogMenuButtonInstanceApi) => void;
  storage: Cell;
}

export interface BaseDialogMenuButtonInstanceApi {
  isDisabled: () => boolean;
  setDisabled: (state: boolean) => void;
  isActive: () => boolean;
  setActive: (state: boolean) => void;
}

export const baseDialogMenuButtonFields = [
  FieldSchema.optionString('text'),
  FieldSchema.optionString('tooltip'),
  FieldSchema.optionString('icon'),
  FieldSchema.strictArrayOf('items', dialogToggleMenuItemSchema),
  FieldSchema.defaultedFunction('onSetup', () => Fun.noop),
  FieldSchema.defaulted('storage', Cell(false))
];
github tinymce / tinymce / modules / bridge / src / main / ts / ephox / bridge / components / dialog / Input.ts View on Github external
inputMode?: string;
  placeholder?: string;
  maximized?: boolean;
  disabled?: boolean;
}

export interface Input extends FormComponentWithLabel {
  type: 'input';
  inputMode: Option;
  placeholder: Option;
  maximized: boolean;
  disabled: boolean;
}

const inputFields = formComponentWithLabelFields.concat([
  FieldSchema.optionString('inputMode'),
  FieldSchema.optionString('placeholder'),
  FieldSchema.defaultedBoolean('maximized', false),
  FieldSchema.defaultedBoolean('disabled', false)
]);

export const inputSchema = ValueSchema.objOf(inputFields);

export const inputDataProcessor = ValueSchema.string;

export const createInput = (spec: InputApi): Result> => {
  return ValueSchema.asRaw<input>('input', inputSchema, spec);
};
github tinymce / tinymce / modules / bridge / src / main / ts / ephox / bridge / components / dialog / Input.ts View on Github external
placeholder?: string;
  maximized?: boolean;
  disabled?: boolean;
}

export interface Input extends FormComponentWithLabel {
  type: 'input';
  inputMode: Option;
  placeholder: Option;
  maximized: boolean;
  disabled: boolean;
}

const inputFields = formComponentWithLabelFields.concat([
  FieldSchema.optionString('inputMode'),
  FieldSchema.optionString('placeholder'),
  FieldSchema.defaultedBoolean('maximized', false),
  FieldSchema.defaultedBoolean('disabled', false)
]);

export const inputSchema = ValueSchema.objOf(inputFields);

export const inputDataProcessor = ValueSchema.string;

export const createInput = (spec: InputApi): Result&gt; =&gt; {
  return ValueSchema.asRaw<input>('input', inputSchema, spec);
};
github tinymce / tinymce / modules / bridge / src / main / ts / ephox / bridge / components / dialog / MenuButton.ts View on Github external
icon: Option;
  items: DialogMenuButtonItemTypes[];
  onSetup: (api: BaseDialogMenuButtonInstanceApi) =&gt; (api: BaseDialogMenuButtonInstanceApi) =&gt; void;
  storage: Cell;
}

export interface BaseDialogMenuButtonInstanceApi {
  isDisabled: () =&gt; boolean;
  setDisabled: (state: boolean) =&gt; void;
  isActive: () =&gt; boolean;
  setActive: (state: boolean) =&gt; void;
}

export const baseDialogMenuButtonFields = [
  FieldSchema.optionString('text'),
  FieldSchema.optionString('tooltip'),
  FieldSchema.optionString('icon'),
  FieldSchema.strictArrayOf('items', dialogToggleMenuItemSchema),
  FieldSchema.defaultedFunction('onSetup', () =&gt; Fun.noop),
  FieldSchema.defaulted('storage', Cell(false))
];
github tinymce / tinymce / modules / bridge / src / main / ts / ephox / bridge / components / dialog / MenuButton.ts View on Github external
tooltip: Option;
  icon: Option;
  items: DialogMenuButtonItemTypes[];
  onSetup: (api: BaseDialogMenuButtonInstanceApi) =&gt; (api: BaseDialogMenuButtonInstanceApi) =&gt; void;
  storage: Cell;
}

export interface BaseDialogMenuButtonInstanceApi {
  isDisabled: () =&gt; boolean;
  setDisabled: (state: boolean) =&gt; void;
  isActive: () =&gt; boolean;
  setActive: (state: boolean) =&gt; void;
}

export const baseDialogMenuButtonFields = [
  FieldSchema.optionString('text'),
  FieldSchema.optionString('tooltip'),
  FieldSchema.optionString('icon'),
  FieldSchema.strictArrayOf('items', dialogToggleMenuItemSchema),
  FieldSchema.defaultedFunction('onSetup', () =&gt; Fun.noop),
  FieldSchema.defaulted('storage', Cell(false))
];