workshopper icon indicating copy to clipboard operation
workshopper copied to clipboard

Ability to supply custom CSS or JS

Open jamesfalkner opened this issue 6 years ago • 6 comments

This particular RFE is because, by default Markdown links like [some text](http://somelink) will open in the same browser tab, taking the user away from the workshopper content. It would be nice to automatically declare (via CSS or some other mechanism, not sure which is best) that every link should open in a new tab.

As a workaround, I currently add {:target="_blank"} to every single link (in Markdown) and that's kinda ugly (but not super painful).

jamesfalkner avatar May 02 '18 14:05 jamesfalkner

How do you handle this in your content @jorgemoralespou @siamaksade @thoraxe ?

marekjelen avatar Jul 19 '18 19:07 marekjelen

I have not been handling it at all in ops content.

thoraxe avatar Jul 19 '18 19:07 thoraxe

@marekjelen, I don't think I've care about this, but it's a good idea.

jorgemoralespou avatar Jul 20 '18 11:07 jorgemoralespou

Low prio

siamaksade avatar Jul 20 '18 12:07 siamaksade

FWIW. Have similar requirement.

As first pass on solution, am going to add in a workshopper.css and workshopper.js in public directory and then update app/views/layouts/application.html.erb to include workshopper.css in <head> and include workshopper.js at end of <body>. The two files will be empty but could then be replaced, by either replacing the files themselves, or possibly allowing an environment variable to be set which extends list of paths checked for static files so overrides can be found in an alternate directory first.

Suggestions on how to better integrate welcome.

GrahamDumpleton avatar Feb 25 '19 02:02 GrahamDumpleton

Once have this capability for workshopper.css and workshopper.js that you can safely override, someone wanting custom application, can drop in workshopper.js file containing:

$(document).ready(function() {
    $('div#lab-content a').each(function() {
        if (!(location.hostname === this.hostname || !this.hostname.length)) {
            $(this).attr('target','_blank');
        }
    });
});

Thus, any external link will have target set to _blank and open in a new browser window/tab.

GrahamDumpleton avatar Feb 25 '19 04:02 GrahamDumpleton