tinymce icon indicating copy to clipboard operation
tinymce copied to clipboard

Fix: MediaResolver invalid after dimensions change

Open axww opened this issue 1 month ago • 2 comments

Related Ticket: https://github.com/tinymce/tinymce/issues/9798

Description of Changes:

  • Run htmlToData again after dimensions changed to prevent custom MediaResolver rules invalid.

Pre-checks:

  • [x] Changelog entry added
  • [x] Tests have been added (if applicable)
  • [x] Branch prefixed with feature/, hotfix/ or spike/

Review:

  • [x] Milestone set
  • [x] Docs ticket created (if applicable)

GitHub issues (if applicable): https://github.com/tinymce/tinymce/issues/9798

Summary by CodeRabbit

  • Bug Fixes
    • Improved the media embed functionality to ensure proper synchronization between embed content and generated HTML, resulting in more reliable embed handling in the editor.

✏️ Tip: You can customize this high-level summary in your review settings.

axww avatar Dec 02 '25 00:12 axww

[!NOTE]

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'auto_resolve_threads'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

The media plugin's Dialog component now conditionally enriches data with a source extracted from embed HTML during dialog updates. When an embed value exists, the source is derived via HtmlToData conversion before passing to dataToHtml; otherwise, the original data is used.

Changes

Cohort / File(s) Summary
Media Dialog Embed Enrichment
modules/tinymce/src/plugins/media/main/ts/ui/Dialog.ts
Added conditional logic to enrich data with source extracted from embed HTML (via HtmlToData.htmlToData) when computing embed HTML during dialog updates.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Understanding the purpose of source enrichment from embed HTML and verifying it doesn't introduce unintended side effects on the embed generation flow
  • Confirming the conditional logic correctly handles both truthy and falsy embed values

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix: MediaResolver invalid after dimensions change' directly matches the PR's stated objective of fixing MediaResolver becoming invalid after dimension changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 02 '25 00:12 coderabbitai[bot]

Submit this PR again due to long time hold. Please check my issue which reproduced this bug: https://github.com/tinymce/tinymce/issues/9798 Need your help with changelog, I'm not familiar with it. Please review, many thanks!!

axww avatar Dec 02 '25 00:12 axww