FIX: allows to specify camelCased attributes in wrap component (#7919)

FIX: allows to specify camelCased attributes in wrap component (#7919)

diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown/d-wrap.js.es6 b/app/assets/javascripts/pretty-text/engines/discourse-markdown/d-wrap.js.es6
index 4b4b4ce..73dd3ca 100644
--- a/app/assets/javascripts/pretty-text/engines/discourse-markdown/d-wrap.js.es6
+++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown/d-wrap.js.es6
@@ -11,10 +11,16 @@ function parseAttributes(tagInfo) {
   );
 }
 
+function camelCaseToDash(str) {
+  return str.replace(/([a-zA-Z])(?=[A-Z])/g, "$1-").toLowerCase();
+}
+
 function applyDataAttributes(token, state, attributes) {
   Object.keys(attributes).forEach(tag => {
     const value = state.md.utils.escapeHtml(attributes[tag]);
-    tag = state.md.utils.escapeHtml(tag.replace(/[^a-z0-9\-]/g, ""));
+    tag = camelCaseToDash(
+      state.md.utils.escapeHtml(tag.replace(/[^A-Za-z\-0-9]/g, ""))
+    );
 
     if (value && tag && tag.length > 1) {
       token.attrs.push([`data-${tag}`, value]);

GitHub sha: 67650328