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

media_url_resolver invalid after dimensions changed #9502

Open
axww opened this issue Mar 22, 2024 · 0 comments
Open

media_url_resolver invalid after dimensions changed #9502

axww opened this issue Mar 22, 2024 · 0 comments

Comments

@axww
Copy link

axww commented Mar 22, 2024

Sample code on https://fiddle.tiny.cloud/

<script type="text/javascript">
  tinymce.init({
    selector: "textarea",
    plugins: ["media"],
    toolbar: "media",
    media_url_resolver: (data) => {
      return new Promise((resolve) => {
        if (data.url.indexOf('a.com') !== -1) {
          resolve({ html: `<iframe src="z.com" width="400" height="400" ></iframe>` });
        } else {
          resolve({ html: '' });
        }
      });
    }
  });
</script>
<form method="post" action="dump.php"><textarea name="content"></textarea></form>

📝 Provide detailed reproduction steps (if any)

  1. Click "Media" button.
  2. Input "a.com" in "Source" box.
  3. Switch to "Embed" card, the code in "Embed" should be:
    <iframe src="z.com" width="400" height="400" ></iframe>
  4. Back to "General" card, change dimensions to different value. (Eg. width/height: 500)
  5. Switch to "Embed" card again, the code in "Embed" becoming:
    <iframe src="a.com" width="500" height="500"></iframe>

✔️ Expected result

Even dimensions changed, the code in "Embed" should be:
<iframe src="z.com" width="500" height="500"></iframe>

❌ Actual result

Iframe src did not change to z.com after dimensions changed.
Only the first time input without dimensions change did the correct url resolve.

📃 Other details

  • Browser: Microsoft Edge 122.0.2365.92
  • OS: Windows 11
  • First affected version: TinyMCE 6
  • Worked in version: TinyMCE 7.0.0

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant