parndt / refinerycms-wymeditor

WYMeditor extension for Refinery CMS

Home Page:http://refinerycms.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Whitelisting custom elements?

evenreven opened this issue · comments

I've whitelisted iframe attributes before and it worked, but I can't get the whitelist to stick when attempting to whitelist <turbo-frame>. Usually adding turbo-frames should be done in the template, but I have an outlier where it would be really handy to put a block inside of a turbo-frame I edit in Refinery.

Is it possible? Here's what I've tried:

# config/initializers/refinery/wymeditor.rb
Refinery::Wymeditor.configure do |config|
  # Add extra tags to the wymeditor whitelist e.g. = {'a' => {'attributes': '1': 'href'}} or just {'a' => {}}
  config.whitelist_tags = { "turbo-frame" => { "attributes" => { "1": "id",
                                                                 "2": "loading" } } }
  # Toggle the paste dialog when using browser paste.
  # You will have to clear your asset cache after changing this setting.
  # In development mode: this is as simple as: `rm -rf tmp/cache/assets`.
  # In production mode: hopefully you recompile assets every time you deploy.
  # config.intercept_paste = true
end

I've also tried without the attributes block, just turbo-frame. Same thing. Nothing happens - any content inside the tag is retained, while the outer tags themselves are removed on save.

Every time I edit the initializer, I delete the tmp dir just to be sure and restart the dev server.

I'm on Refinery 4.0.3 with refinerycms-wymeditor 2.1.0.

Still interested in this. Is it even possible, or does it go against the validation logic of wymeditor?

Further investigation told me that it's not possible without changing the gem itself, so following up with a PR (#69) instead.

Closing.