widgetfactory / jce

JCE - A Content Editor for Joomla
https://www.joomlacontenteditor.net
GNU General Public License v2.0
35 stars 12 forks source link

[2.8.11] Extended valid elements config regression involving elements with colon #76

Closed paradissimon closed 4 years ago

paradissimon commented 4 years ago

We have a <gcse:search linktarget="_self">&nbsp;</gcse:search> HTML snippet for Google search along with a gcse:search,gcse:searchbox-only config set for valid extended elements. This was working fine in JCE Core 2.7.17 but now fails with 2.8.11.

This is what was recommend in this JCE Forum post

Steps to reproduce the behavior:

  1. Configure JCE 2.8.11 with gcse:searchbox-only,gcse:search extended valid element
  2. Edit an article, press "Save" or switch editor pane (code, preview)
  3. Buttons don't work due to JS error:
    Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Element': 'optgroup,select,datalist,option,isindex,menu,noscript,dd,dt,dl,caption,ul,ol,li,td,tr,th,tfoot,thead,tbody,table,hr,optgroup,select,datalist,option,isindex,menu,noscript,dd,dt,dl,caption,ul,ol,li,td,tr,th,tfoot,thead,tbody,table,hr,figure,nav,aside,hgroup,section,article,footer,header,fieldset,dir,center,blockquote,form,pre,address,div,p,h6,h5,h4,h3,h2,h1,figure,nav,aside,hgroup,section,article,footer,header,fieldset,dir,center,blockquote,form,pre,address,div,p,h6,h5,h4,h3,h2,h1,gcse:searchboxonly,gcse:searchboxonly,gcse:search,gcse:search,mce-comment,mce-comment' is not a valid selector.

querySelectorAll() should get called with gcse\\:searchbox-only,gce\\:search (notice how it also stripped the dash). It needs a \\ before the colon.

Tried using gcse\\:searchbox-only,gcse\\:search config instead but still doesn't work, something is filtering these escapes. I checked and the JSON config in the database is fine, filtering seems to happen client-side.

Environment

paradissimon commented 4 years ago

For now, as a work around, we just removed these from the extended elements config as we use this tag in a single content element that should never get edited. We'll use another editor if we need to fix it.

ryandemmer commented 4 years ago

Fixed in commit - https://github.com/widgetfactory/jce/commit/7276aff80e6c9f07fb526413a1045e33fef0b24d