Skip to content

Can't add assets after update #117

Open
@mmcrt

Description

Recently I updated both Grav (v1.7.33) and shortcode-core (v5.1.1). Since then a third party plugin stopped working.

It seems that shortcode-core doesn't load assets at all. On a clean plugin sample (using the [strike] shortcode from shortcode-core main page) I successfully get the formatted string (with <del>) but trying to add assets (either js or css) doesn't seem to work.

The code is really simple:

public function init()
{
    $this->shortcode->getHandlers()->add('strike', function(ShortcodeInterface $sc) {
            
        $this->shortcode->addAssets('js', 'plugin://test-plugin/js/alert.js');
        $this->shortcode->addAssets('inlinejs', 'alert("-");');
        $this->shortcode->addAssets('inlinejs', 'console.log("-");');
        $this->shortcode->addAssets('css', 'plugin://test-plugin/css/helloworld.css');

        return '<del>'.$sc->getContent().'</del>';
    });
}

Only the <del> part gets successfully added and rendered.

Am I doing something wrong?

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions