How to use @react-page/plugins-slate - 4 common examples

To help you get started, we’ve selected a few @react-page/plugins-slate 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 react-page / react-page / examples / src / plugins.ts View on Github external
);
        resolve({ url: defaultUrl });
      }
    }, 500);
  });
};

if (
  process.env.NODE_ENV !== 'production' &&
  process.env.REACT_APP_TRACE_UPDATES
) {
  const { whyDidYouUpdate } = require('why-did-you-update');
  whyDidYouUpdate(React);
}

export const defaultSlate = slate(def => ({
  ...def,
  plugins: {
    ...def.plugins,
    custom: {
      custom1: customSlatePlugin,
    },
  },
}));

// if you want to use a plugin twice with a differnet config, you have to give it another name
export const reducedSlate = slate(def => ({
  ...def,
  name: def.name + '/reduced', // give it some other name
  hideInMenu: true, // don't show in insert menu, we only use it as intial children
  plugins: {
    headings: {
github react-page / react-page / examples / src / plugins.ts View on Github external
const { whyDidYouUpdate } = require('why-did-you-update');
  whyDidYouUpdate(React);
}

export const defaultSlate = slate(def => ({
  ...def,
  plugins: {
    ...def.plugins,
    custom: {
      custom1: customSlatePlugin,
    },
  },
}));

// if you want to use a plugin twice with a differnet config, you have to give it another name
export const reducedSlate = slate(def => ({
  ...def,
  name: def.name + '/reduced', // give it some other name
  hideInMenu: true, // don't show in insert menu, we only use it as intial children
  plugins: {
    headings: {
      h2: def.plugins.headings.h2,
      h3: def.plugins.headings.h3,
    },
    paragraphs: def.plugins.paragraphs,
    emphasize: def.plugins.emphasize,
  },
}));
// Define which plugins we want to use.

export const plugins: Plugins = {
  content: [
github react-page / react-page / examples / src / index.tsx View on Github external
);
        resolve({ url: defaultUrl });
      }
    }, 500);
  });
};

if (
  process.env.NODE_ENV !== 'production' &&
  process.env.REACT_APP_TRACE_UPDATES
) {
  const { whyDidYouUpdate } = require('why-did-you-update');
  whyDidYouUpdate(React);
}

const slatePlugin = slate(def => ({
  ...def,
  plugins: [...def.plugins, customSlatePlugin()],
}));
// Define which plugins we want to use (all of the above)
const plugins: Plugins = {
  content: [
    slatePlugin,
    spacer,
    imagePlugin({ imageUpload: fakeImageUploadService('/images/react.png') }),
    video,
    divider,
    html5video,
    customContentPlugin(),
  ],
  layout: [
    background({
github react-page / react-page / examples / src / customSlatePlugin.tsx View on Github external
import { pluginFactories } from '@react-page/plugins-slate';
import React from 'react';

export default pluginFactories.createComponentPlugin<{
  color: string;
}>({
  addHoverButton: true,
  addToolbarButton: true,
  type: 'SetColor',
  object: 'mark',
  icon: <span>Color</span>,
  Component: props =&gt; {
    return (
      <span style="{{">{props.children}</span>
    );
  },

  schema: {
    type: 'object',
    required: ['color'],

@react-page/plugins-slate

MIT
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis

Similar packages