Prompt without class stripping? #1168
|
Is there a way to not have lexxy prompts strip classes from the editor? I would've thought <%= f.rich_text_area :body do %>
<lexxy-prompt trigger="@" insert-editable-text>
<lexxy-prompt-item search="link" src >
<template type="menu">Konkursikeskkonna link</template>
<template type="editor">
<p class="btn">
<%= link_to "Konkursikeskkond", root_url %>
</p>
</template>
</lexxy-prompt-item>
</lexxy-prompt>
<% end %> |
Replies: 2 comments
|
@jorgemanrubia any ideas on what I might do here? |
|
The class stripping isn't a sanitization issue — it's how For a self-contained styled snippet like yours, use the default attachment insertion instead — just drop <%= f.rich_text_area :body do %>
<lexxy-prompt trigger="@" name="link">
<lexxy-prompt-item search="link">
<template type="menu">Konkursikeskkonna link</template>
<template type="editor">
<p class="btn">
<%= link_to "Konkursikeskkond", root_url %>
</p>
</template>
</lexxy-prompt-item>
</lexxy-prompt>
<% end %>This inserts the template as an Action Text content attachment, which stores your HTML verbatim — |
The class stripping isn't a sanitization issue — it's how
insert-editable-textworks. That option converts the template's HTML into Lexical's editable document model, and Lexical nodes only carry the attributes they model (a<p>becomes a paragraph node that knows about format and indentation, a link keeps itshref, etc.). Arbitrary attributes likeclasshave nowhere to live, and the HTML you get back is regenerated from that model. Soinsert-editable-textis meant for inserting plain editable content, not for preserving custom markup.For a self-contained styled snippet like yours, use the default attachment insertion instead — just drop
insert-editable-textand give the prompt aname:<%=…