How to use the @ephox/boulder.FieldSchema.strictString 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 / toolbar / ContextToolbar.ts View on Github external
});

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);
};

export const createContextForm = (spec: ContextFormApi): Result> => {
  return ValueSchema.asRaw('ContextForm', contextFormSchema, spec);
};
github tinymce / tinymce / modules / bridge / src / main / ts / ephox / bridge / components / dialog / ToggleMenuItem.ts View on Github external
active?: boolean;
}

export interface DialogToggleMenuItemInstanceApi extends CommonMenuItemInstanceApi {
  isActive: () => boolean;
  setActive: (state: boolean) => void;
}

export interface DialogToggleMenuItem extends CommonMenuItem {
  type: 'togglemenuitem';
  name: string;
  active: boolean;
}

export const dialogToggleMenuItemSchema = ValueSchema.objOf([
  FieldSchema.strictString('type'),
  FieldSchema.strictString('name'),
  FieldSchema.defaultedBoolean('active', false)
].concat(commonMenuItemFields));

export const dialogToggleMenuItemDataProcessor = ValueSchema.boolean;

export const createToggleMenuItem = (spec: DialogToggleMenuItemApi): Result> => {
  return ValueSchema.asRaw('togglemenuitem', dialogToggleMenuItemSchema, spec);
};
github tinymce / tinymce / modules / bridge / src / main / ts / ephox / bridge / components / dialog / ToggleMenuItem.ts View on Github external
}

export interface DialogToggleMenuItemInstanceApi extends CommonMenuItemInstanceApi {
  isActive: () => boolean;
  setActive: (state: boolean) => void;
}

export interface DialogToggleMenuItem extends CommonMenuItem {
  type: 'togglemenuitem';
  name: string;
  active: boolean;
}

export const dialogToggleMenuItemSchema = ValueSchema.objOf([
  FieldSchema.strictString('type'),
  FieldSchema.strictString('name'),
  FieldSchema.defaultedBoolean('active', false)
].concat(commonMenuItemFields));

export const dialogToggleMenuItemDataProcessor = ValueSchema.boolean;

export const createToggleMenuItem = (spec: DialogToggleMenuItemApi): Result> => {
  return ValueSchema.asRaw('togglemenuitem', dialogToggleMenuItemSchema, spec);
};
github tinymce / tinymce / modules / bridge / src / main / ts / ephox / bridge / components / dialog / FooterButton.ts View on Github external
'name',
    'name',
    FieldPresence.defaultedThunk(() => {
      return Id.generate('button-name');
    }),
    ValueSchema.string
  ),
  FieldSchema.optionString('icon'),
  FieldSchema.defaultedStringEnum('align', 'end', ['start', 'end']),
  FieldSchema.defaultedBoolean('primary', false),
  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
];