JSPM

react-tinacms-editor

0.53.26
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 310
    • Score
      100M100P100Q107670F
    • License Apache-2.0

    Package Exports

    • react-tinacms-editor

    Readme

    react-tinacms-editor

    This package provides a WYSIWYM Editor for HTML and Markdown.

    Install

    yarn add react-tinacms-editor

    Field Plugins

    This package provides two field plugins for TinaCMS: MarkdownFieldPlugin and HtmlFieldPlugin.

    Registering the new Field Plugins

    in your _app.{js,tsx}

    <TinaCMS
        apiURL={...}
        
        cmsCallback={(cms) => {
          import("react-tinacms-editor").then(({ MarkdownFieldPlugin }) => {
            cms.plugins.add(MarkdownFieldPlugin);
          });
          // or
          import("react-tinacms-editor").then(({ HtmlFieldPlugin }) => {
            cms.plugins.add(HtmlFieldPlugin);
          });
          //...
        }}
       //... 

    Using in a form

    And then in your schema.ts file you can use these in the ui.component portion of a field

    {
      type: 'string',
      label: 'mainContent',
      name: 'body',
      // isBody is used to tell the backend to write this to the body of the markdown or MDX file.
      isBody: true
      ui: {
        component: "markdown",
      }
    },

    Or for the html plugin

    {
      type: 'string',
      label: 'mainContent',
      name: 'body',
      // isBody is used to tell the backend to write this to the body of the markdown or MDX file.
      isBody: true
      ui: {
        component: "html",
      }
    },