Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
flokol120 opened this issue Nov 19, 2021 · 0 comments
Open

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

flokol120 opened this issue Nov 19, 2021 · 0 comments

Comments

@flokol120
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant