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

Allow child nodes to be added to format API objects #29962

Open
SeanDS opened this issue Mar 18, 2021 · 6 comments
Open

Allow child nodes to be added to format API objects #29962

SeanDS opened this issue Mar 18, 2021 · 6 comments
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Enhancement A suggestion for improvement.

Comments

@SeanDS
Copy link
Contributor

SeanDS commented Mar 18, 2021

What problem does this address?

I was asked to open this issue by @ellatrix following the discussion here. It's currently impossible to insert nested HTML in format types with object: true. This object: true switch is currently only used in vanilla Gutenberg for inline images where adding a single <img> tag is sufficient, but I'd like to register a format for embedding inline MathML which is deeply nested HTML and cannot be represented by a single entity. Embedding MathML is trivial in the old editor using shortcodes but the formatting API currently limits this type of use.

What is your proposed solution?

It seems sensible to allow format types with object: true to replace the text with arbitrary HTML. This would provide maximum flexibility for whatever developers want to do with their formats, rather than the current requirement that an object: true format simply replaces the wrapped text with a single HTML entity (in the case of inline images, a single <img> tag).

@talldan talldan added [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Enhancement A suggestion for improvement. labels Apr 12, 2021
@SeanDS
Copy link
Contributor Author

SeanDS commented May 23, 2022

@ellatrix, @talldan any possibility of getting this feature on a developer's radar? Speaking as a humble plugin author and not a core developer, I think it is probably relatively straightforward to implement for someone more familiar with Gutenberg than me and it would unlock a whole class of inline styling possibilities not currently allowed by the lack of ability to add child nodes. The particular feature I'd love to solve is the ability to add inline mathematical markup to paragraph blocks, which a lot of my users at my science institute are hoping to be able to do.

Is there a possibility to fund a core developer's time for this, if I can convince my institute to pay?

@talldan
Copy link
Contributor

talldan commented Jun 20, 2022

@SeanDS Apologies for the delay responding, I've been away on vacation.

The formatting API is a bit outside of my area of experience. It sounds like you already know more than me when it comes to object: true. I haven't seen that before, but it sounds like it's for inserting non-textual content.

Is there a possibility to fund a core developer's time for this, if I can convince my institute to pay?

I'm not sure. I guess you'd be seeking someone who is looking for sponsorship and isn't already employed full-time, and also has some relevant skill and knowledge of this part of the codebase.

It could be worth discussing this issue at a core-editor meeting if you can make the time. Here are the details of the next meeting - https://make.wordpress.org/core/2022/06/20/editor-chat-agenda-june-22-2022/. If you can't make it you could also add an item to the agenda by commenting on that post.

@ellatrix
Copy link
Member

This will be possible if we can pull off #41655. You'd be able to render anything in rich text with React.

@SeanDS
Copy link
Contributor Author

SeanDS commented Aug 22, 2022

Sorry for the delay replying. Thanks for the update @ellatrix. I'll keep a hopeful eye on #41655 then!

@rafaucau
Copy link

rafaucau commented Dec 5, 2023

Has anyone found any way around this?
I just ran into this problem when I tried a custom inline element that has children.

@SeanDS
Copy link
Contributor Author

SeanDS commented Dec 11, 2023

@rafaucau Not as far as I know. It would be great to get this implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants