Help with Discourse.Dialect needed

javascript

(Alexander S.) #1

Hi, have the next code:

Discourse.Dialect.replaceBlock({
  start: /(\[ooyala\-video\])([\s\S]*)/igm,
  stop: /(\[\/ooyala\-video\])/igm,
  emitter: function(contents) {
    return ['p', {'class': 'ooyala-video-container'}, contents.join()];
  }
});

It does work well, except the one thing: class “ooyala-video-container” is missing from the inserted “P” element. What do I do wrong?

Thank you,
Alex


(Régis Hanol) #2

You need to whitelist that class otherwise it’ll get stripped out by the HTML sanitizer.

Discourse.Markdown.whiteListTag("p", "class", "ooyala-video-container");

(Alexander S.) #3

Thank you! Do you know where I can find the most complete plugin api docs/guide?


(Régis Hanol) #4

There’s no such thing yet. You could look at official plugins Discourse · GitHub


(Régis Hanol) #5