Repository navigation
Is there a way to remove or change the .wysiwyg-container div/class? #3723
|
I have a WYSIWYG and it's called "Text" and I output it like this: @Content.Html("Text") This is great because it renders the HTML and adds in that nice edit icon so the user can edit the Text directly. However, this renders a around the markup. This is a problem for me because I use Tailwind CSS Typography plugin and it expects a
wrapped around it.
Typically I include other things like Title (for headings) so I would typically wrap the whole block and other things inside of it. For example:
|
Answered by
iJungleboy
Feb 12, 2026
Replies: 1 comment 1 reply
|
The You have 3 options
@using ToSic.Razor.Blade // https://razor-blade.net/
@{
// use RazorBlade to create a custom container
// https://razor-blade.net/api/ToSic.Razor.Html5.Div.html
var container = Tag.Div().Class("prose 2xl:prose-xl 2xl:prose-p:leading-normal 2xl:prose-h2:!text-4xl");
}
@Content.Html("Text", container: container)
@Html.Raw(Content.Html(...).ToString().Replace("wysiwyg-container", "wysiwyg-container prose 2xl:prose-xl 2xl:prose-p:leading-normal 2xl:prose-h2:!text-4xl")) |
1 reply
Answer selected by
ajplopez
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
data.Html(...)does a lot more, incl. image-resizing and similar. For this to work reliably, it must have the div withclass=wysiwyg-container.You have 3 options
put another div around it
recommended give it another container - to which it will add the class-wysiwyg, something like
@Html.Raw(Content.Html(...).ToSt…