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

Using "contenteditable" in Attachments #1053

Open
meesix opened this issue Apr 4, 2023 · 1 comment
Open

Using "contenteditable" in Attachments #1053

meesix opened this issue Apr 4, 2023 · 1 comment

Comments

@meesix
Copy link

meesix commented Apr 4, 2023

Hello,

I'm sorry, maybe it was discussed previously, but I couldn't find references. I want to create a specific element representing a two-column block. Here is what I'm doing;

blockTools.insertAdjacentHTML("afterbegin", " <button type="button" class="trix-button" data-trix-action="x-columns" title="Columns" tabindex="-1"><svg>...</svg</button>" )

const attachment = new Trix.Attachment({ content: "<div class='two-column' contenteditable></div>", contentType: "application/vnd.trix.columns.html" })

The div is added, but whenever I'm trying to put any content in it, the text immediately disappears.

I see in docs that Attachments can be moved or removed, but *not edited directly*, but maybe there is a simple tool for wrapping blocks of text into divs with classes?

@meesix
Copy link
Author

meesix commented Apr 4, 2023

As far as I understood, an alternative will be using custom blockAttributes, though it seems like it's still impossible to assign custom CSS classes to new blocks, isn't it?

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