Skip to content

Own Schema does not fill storedMarks / toggle Mark not working #40

Description

@flokol120

I was trying to create a new Schema. I just copied the default schema from react-prosemirror/packages/config-default/schema.ts to get started with something. When using this exact same schema in my own component, marks of the initialValue won't be generated. This means you cannot toggle those marks as they are not generated.

Excerpt:

import {
  plugins,
  toolbar,
  schema as defaultSchema
} from "@aeaton/react-prosemirror-config-default";
(...)
// copied from react-prosemirror/packages/config-default/schema.ts
export const schema = new Schema({
  marks: {
    bold,
    code,
    italic,
    link,
    strikethrough,
    subscript,
    superscript,
    underline
  },
  nodes: {
    text, // plain text node
    doc, // top-level node
    paragraph, // paragraph must be the first node type of the "block" group
    lineBreak,
    heading,
    blockquote,
    codeBlock,
    horizontalRule,
    list,
    listItem,
    table,
    tableRow,
    tableDataCell, // tableDataCell must be the first node type of the "tableCell" group
    tableHeaderCell
  }
});
(...)
return (
  <HtmlEditor
    schema={schema} // schema genereated with new Schema. Excact copy of react-prosemirror/packages/config-default/schema.ts (this IS NOT working)
    // schema={defaultSchema}     // default schema from prosemirror wrapper (this is working)
    plugins={plugins}
    value={initialValue}
    handleChange={setValue}
    debounce={250}
  >
    <Toolbar toolbar={toolbar} />
    <Editor autoFocus />
  </HtmlEditor>
);

Maybe this is a bug, maybe I am just missing something.

I've replicated the issue as stated above using CodeSandbox:
https://codesandbox.io/s/recursing-wozniak-o8589?file=/src/App.tsx:1256-1261

If you need any more information, I am happy to provide them to you.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions