Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed extension adds iframe two times #1043

Open
cavid90 opened this issue Aug 24, 2024 · 3 comments
Open

Embed extension adds iframe two times #1043

cavid90 opened this issue Aug 24, 2024 · 3 comments
Labels
not enough info We need more information to properly assist with this

Comments

@cavid90
Copy link

cavid90 commented Aug 24, 2024

Version(s) affected

2.5

Description

I use Embed extension in my app. The only problem - it adds iframe two times.

How to reproduce

Just add any youtube or x.com link. You will see that it added 2 iframes for the given link

Possible solution

No response

Additional context

No response

Did this project help you today? Did it make you happy in any way?

No response

@colinodell
Copy link
Member

Thanks for opening this bug report!

Could you please share your configuration, the code you're using to instantiate the parser, and some sample Markdown showing the issue? I ask because our test suite isn't showing this issue, so it would be helpful to know how/why your instance is behaving differently.

@colinodell colinodell added the not enough info We need more information to properly assist with this label Aug 25, 2024
@cavid90
Copy link
Author

cavid90 commented Aug 25, 2024

Hello. Yes, this is the configuration

        $embedLibrary = new Embed();
        $embedLibrary->setSettings([
            'oembed:query_parameters' => [
                'maxwidth' => 800,
                'maxheight' => 600,
            ],
            'twitch:parent' => 'example.com',
            'facebook:token' => '1234|5678',
            'instagram:token' => '1234|5678',
        ]);

        $config = [
            'table' => [
                'wrap' => [
                    'enabled' => true,
                    'tag' => 'div',
                    'attributes' => ['class' => 'table-responsive'],
                ],
                'alignment_attributes' => [
                    'left'   => ['align' => 'left'],
                    'center' => ['align' => 'center'],
                    'right'  => ['align' => 'right'],
                ],
            ],
            'default_attributes' => [
                Table::class => [
                    'class' => 'table table-bordered table-striped table-hover',
                ],
                Link::class => [
                    'class' => '',
                    'target' => '_blank',
                ],
            ],
            'embed' => [
                'adapter' => new OscaroteroEmbedAdapter($embedLibrary), // See the "Adapter" documentation below
                'allowed_domains' => ['youtube.com', 'x.com', 'vakansiya.biz'],
                'fallback' => 'link',
            ],
        ];

        $environment = new Environment($config);
        $environment->addExtension(new CommonMarkCoreExtension());
        $environment->addExtension(new GithubFlavoredMarkdownExtension());
        $environment->addExtension(new TableExtension());
        $environment->addExtension(new TaskListExtension());
        $environment->addExtension(new DefaultAttributesExtension());
        $environment->addExtension(new EmbedExtension());

@colinodell
Copy link
Member

Thanks for sharing this!

Unfortunately, I'm still unable to replicate your issue, even with that configuration 😕 I get a single line of output containing a single embed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not enough info We need more information to properly assist with this
Projects
None yet
Development

No branches or pull requests

2 participants