Render modal from theme client-side plugin API

Hey Joe,

I’m interested by this feature too. I’ve been able to build most of the script using your example but I don’t know how to build a specific modal ?

As far as I understand, the showModal thing is loading a template ?

Here is what I did :

<script type="text/discourse-plugin" version="0.8.24">
    const showModal = require("discourse/lib/show-modal").default;
    
    // EvE Online Magic SDE
    api.decorateCooked(function(cooked){
        SDD.LoadMeta()
        .then(function(arg){
            return arg.source.GetTable('invTypes').Load();
        })
        .then(function(arg){
            cooked.find('a[href="#evesde"]').each(function(){
                var typeName = $(this).text();
                
                results = _.filter(arg.table.data, function(entry) {
                    return entry[arg.table.c.typeName] === typeName;
                });
                
                if (results.length > 0) {
                    $(this).attr('data-typeid', results[0][arg.table.c.typeID]);
                    $(this).on('click', function(){
                        console.debug('show modal');
                        showModal('eveSdeModal');
                    });
                }
            });
        });
    });
</script>