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

[Question] How to allow special characters in class name or data attribute? #1703

Closed
narendravaghela opened this issue Jan 3, 2019 · 1 comment

Comments

@narendravaghela
Copy link

In my HTML code, I have some variable placeholders defined in element's class name or data attributes. For example, consider following code block,

	<div class="list-container" data-page-id="{{page.id}}">
		<ul class="{{list.className}}" data-list-id="{{list.id}}">
			<li data-list-id="{{list.item.id}}">List Item 1</li>
			<li data-list-id="{{list.item.id}}">List Item 2</li>
		</ul>
	</div>

When I load this in the editor, it removes them and I can't get them back while exporting the code via editor.getHTML(). So, the result of above code is as below,

<div data-page-id="{{page.id}}" class="list-container">
  <ul data-list-id="{{list.id}}" class="-list-className-">
    <li data-list-id="{{list.item.id}}">List Item 1
    </li>
    <li data-list-id="{{list.item.id}}">List Item 2
    </li>
  </ul>
</div>

If you see the result, the class of ul element is changed from {{list.className}} to -list-className-.

Is there any way to preserve them while loading and exporting the HTML?

Please help.

Thanks

@artf
Copy link
Member

artf commented Jan 4, 2019

The escape function is applied in the Selector model. I think it might be a good idea to provide some option as a custom escape strategy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants