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

feat: Overwrite the simpleExtensions especially the markdown config #369

Open
saculNiot opened this issue Apr 1, 2024 · 3 comments
Open

Comments

@saculNiot
Copy link

Describe the feature you'd like to request

I am trying to modify the config in the markdown under the simpleExtensions. I am planning to make transformCopiedText as false. Is there any way I can do it? Thankss in advance

Describe the solution you'd like to see

It is better if we can overwrite the extensions in simpleExtensions just like the rest of extensions.

Additional information

No response

@EnriqueSantos-dev
Copy link
Contributor

I think you can do it like this, a agree actualitythis is not the best way to do this, but it working expected for me :)

// sure you have tiptap-markdown installed in you project
import { Markdown } from "tiptap-markdown";

import { simpleExtensions as novelSimpleExtensions } from "novel/extensions";

const markdown = Markdown.configure({
  // your config
});

// remove markdown extension from simpleExtensions array
export const simpleExtensions = novelSimpleExtensions.filter(
  (ext) => ext.name !== "markdown"
);

// export your custom config of markdown extension and another extensions
export const defaultExtensions = [
   // rest of extension
   markdown,
   ...simpleExtensions 
]

@saculNiot
Copy link
Author

Thanks for the solution. Yeah, this could be the workaround. Let me try it out. Thanks.

@maks-ivanov
Copy link

maks-ivanov commented Apr 7, 2024

did it work for you @saculNiot ? No luck here
EDIT: hacky variant below worked for me

const markdown = simpleExtensions.find((ext) => ext.name === "markdown")
markdown!.options.transformCopiedText = false;

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

3 participants