Modal window - a modal window style plugin for Discourse


(Alex Rabolin) #1

#modal-window

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

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

Check out a live instance of Discourse with Modal-window installed on it here : http://kitedor.info
(You’ll don’t have to make an account to see the modal window, just click on the links “videos” and “news” from the top menu in the header)

###Modal window with contents :

Installation

_Everything is explained in the read-me here : https://github.com/AlexRabolin/modal-window_

Edit your web template (<a href"https://meta.discourse.org/t/install-a-plugin/19157">install-a-plugin) and add this repositories url : GitHub - AlexRabolin/modal-window: A modal window style plugin for Discourse.

Then rebuild your web container so that the plugin installs.


(Alex Rabolin) #2

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.


(cpradio) #3

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]']);
}

(Alex Rabolin) #4

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


(Alex Rabolin) #5

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]']);
    }

#6

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.