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: insert markdown content at the current selection point. #256

Closed
wants to merge 0 commits into from

Conversation

forhappy
Copy link
Contributor

With this feature we can now support inserting markdown content at the current selection point after the editor initialized, this feature will be useful in use case where the user needs to programmatically append/insert markdown content.

@petyosi
Copy link
Contributor

petyosi commented Dec 22, 2023

Thank you! I will review this in the upcoming days.

@forhappy
Copy link
Contributor Author

forhappy commented Jan 5, 2024

Great to see we have V2.0 released. I will push a new revision to adapt the MDXEditor-2.0 soon

@petyosi
Copy link
Contributor

petyosi commented Jan 5, 2024

@forhappy I'm actually thinking that this could be a core feature, rather than a plugin. Let me play with an idea I have around a possible implementation, I want to run this by you and see if it makes sense.

@forhappy
Copy link
Contributor Author

forhappy commented Jan 5, 2024

Thank you for the help, really appreciated ;)

@forhappy
Copy link
Contributor Author

forhappy commented Jan 8, 2024

While I am experimenting with the MDXeditor V2 features I found out there are a few cells not being publicly exported:

// import configuration
/** @internal */
export const importVisitors$ = Cell<MdastImportVisitor<Mdast.Nodes>[]>([])
/** @internal */
export const syntaxExtensions$ = Cell<MarkdownParseOptions['syntaxExtensions']>([])
/** @internal */
export const mdastExtensions$ = Cell<NonNullable<MarkdownParseOptions['mdastExtensions']>>([])
/** @internal */
export const usedLexicalNodes$ = Cell<Klass<LexicalNode>[]>([])

Those cells are useful to write custom import plugins, those concepts are available in V1, can we export those cells in V2 as well?

@petyosi
Copy link
Contributor

petyosi commented Jan 8, 2024

@forhappy all of those have their respective Appender signal that lets you add items to them. Perhaps this is not enough for something? Let me know.

@forhappy
Copy link
Contributor Author

forhappy commented Jan 8, 2024

Hey @petyosi, I need to access those cell values in my own markdown manipulation plugin, however those cells are not exported.

@forhappy
Copy link
Contributor Author

forhappy commented Jan 8, 2024

Is there any way I can just use useCellValue to retrieve the import visitors?

@petyosi
Copy link
Contributor

petyosi commented Jan 8, 2024

That makes sense. I understand that need them, exporting them is not a big deal, you can PR that, I will merge quickly.

Like I mentioned, I want to make what you're describing a core feature, while avoiding the node you've introduced. But I seem to be taking my time on it, sorry for that.

@petyosi
Copy link
Contributor

petyosi commented Jan 8, 2024

Is there any way I can just use useCellValue to retrieve the import visitors?

Yes, you can :). the @internal tag is just a documentation flag.

@forhappy
Copy link
Contributor Author

forhappy commented Jan 8, 2024

Looks like those were not exported in core/index.d.js, I can see those cells exported in core/index.js though.

@noteverseio
Copy link

I closed this PR and may think about to raise a new PR based on MDXEditor V2 API ;)

@sanuradhag
Copy link
Contributor

Hello @petyosi,

Will you be able to export the above cells? I can create a PR if needed.

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

Successfully merging this pull request may close these issues.

4 participants