Modal Window

AI-generated summary

The discussion centers on the modal-window plugin, a Discourse extension by Alex_Rabolin designed to open modal windows from forum posts using custom HTML and CSS. The plugin allows embedding external content via <iframe> tags and styling with <label> or <span> tags.

Following a Discourse update, the plugin broke because the label tag whitelist functionality ceased to work. Alex_Rabolin sought assistance, prompting cpradio to suggest creating a specific modal-window.js.es6 file to properly register the option and whitelist the necessary tags using the new helper API. This solution restored functionality, as confirmed by Alex_Rabolin.

Later, Alex_Rabolin reported that while iframe tags worked, the label tag and custom span classes for glyphs remained broken despite attempts to update the code. Subsequently, babyfooter analyzed the issue, noting that adding helper.whiteList(['span[class]']) to support glyphs caused the iframe whitelisting to fail again. They observed that while label whitelisting previously worked independently, it no longer functions with the latest Discourse update. The thread highlights an apparent incompatibility between whitelisting span classes and iframe execution, leaving the group investigating support for these custom enhancements.

modal-window

Repo: GitHub - AlexRabolin/modal-window: A modal window style plugin for Discourse. · GitHub

A modal window style plugin for Discourse.

Hello, this plugin will open a modal window from a forum post.

But, You don’t need this plugin to open a modal window outside the forum, in this case, just copy the HTML and CSS code in your forum.

Demo

Modal window with contents :

Installation

Everything is explained in the read-me here: GitHub - AlexRabolin/modal-window: A modal window style plugin for Discourse. · GitHub

Edit your web template (<a href"Install plugins on a self-hosted site">install-a-plugin) and add this repositories url : GitHub - AlexRabolin/modal-window: A modal window style plugin for Discourse. · GitHub

Then rebuild your web container so that the plugin installs.

7 Likes

The plugin is broken since the last update of discourse.
can anyone help me fix it ?

This code no longer works now for authorizing (whitelisting) the class “label” ? :

(function() {
Discourse.Markdown.whiteListTag('label', 'for', '*');
})();

Thank you in advance.
Alex.

You need to create a file named named modal-window.js.es6 at assets/javascripts/lib/discourse-markdown/

Then inside it, you need:

import { registerOption } from 'pretty-text/pretty-text';

registerOption((siteSettings, opts) => {
  opts.features["modal-window"] = true;
});

export function setup(helper) {
  helper.whiteList(['label[for]']);
}
6 Likes

A big thank you @cpradio , the plugin works again thanks to you :slight_smile:

4 Likes

Hello, the plugin is broken recently, have you got a idea please ?

The tag iframe src= is not broken, is ready :slight_smile: .
But the tag label for= is broken ( and i want to use span class * for glyphicon on the forum post but it’s not ready to :frowning: )

###This is the code of the plugin :

.js

(function() {
      Discourse.Markdown.whiteListTag('label', 'for', '*');
      Discourse.Markdown.whiteListTag('iframe', 'src', 'https://www.meteoblue.com/fr/meteo/widget/daily/*');
      Discourse.Markdown.whiteListTag('iframe', 'src', 'http://www.windguru.cz/fr/*');
      Discourse.Markdown.whiteListTag('iframe', 'src', 'https://beta.windguru.cz/*'); 
      Discourse.Markdown.whiteListTag('iframe', 'src', 'https://embed.windytv.com/*'); 
    })();

and

.js.es6

import { registerOption } from 'pretty-text/pretty-text';

    registerOption((siteSettings, opts) => {
      opts.features["plugin-kitedor"] = true;
    });

    export function setup(helper) {
      helper.whiteList(['label[for]']);
      helper.whiteList(['iframe[src]']);
    }

Hi all, I just complete a bit our plugin pb.

What was working in first version is use of :
helper.whiteList([‘label[for]’]);
helper.whiteList([‘iframe[src]’]);

We added following instruction in order to use glyficons
helper.whiteList([‘span[class]’]);

Adding it has broke iframes whitelisting, but work with glyficons, removing it just make it work again (iframes) I think so there is an incompatibility between span whitelist and iframe execution?

About label whitelist, was working, but not dependent of other tags whitelist, it doesn’t work anymore with last discourse update.

Thank you for you help, we are trying to add some capabilities on forum, and not sure about support on custom enhancements.