Skip to content

Conversation

@michalnieruchalski-tiugo
Copy link
Contributor

@michalnieruchalski-tiugo michalnieruchalski-tiugo commented May 20, 2025

Here are the reasons why I think it’s safe to remove this._editor.isInitialized() check:

Manual testing

It's safe to enter readonly mode/set disabled option before the editor has emitted 'init' event.

TinyMCE readonly mode disabled option
v4 https://fiddle.tiny.cloud/GIHE7J2R91/1 N/A
v5 https://fiddle.tiny.cloud/GIHE7J2R91/2 N/A
v6 https://fiddle.tiny.cloud/GIHE7J2R91/3 N/A
v7 https://fiddle.tiny.cloud/GIHE7J2R91/4 N/A
v7.6 https://fiddle.tiny.cloud/GIHE7J2R91/5 https://fiddle.tiny.cloud/GIHE7J2R91/6

The lack of this check in different integrations

The origin of this check

It was introduced in 2018 and I believe it was just copied from other place of the file "just in case".

730975e

I believe it was copied from:

if (this.editor && this.editor.initialized && typeof value === 'string') {

where it actually makes sense to not set the content before the editor is fully initialized.

TinyMCE code analysis

Both EditorOptions and Mode classes are being constructed inside Editor constructor. Therefore I expect it’s safe to use these.

@michalnieruchalski-tiugo michalnieruchalski-tiugo requested a review from a team as a code owner May 20, 2025 09:24
@michalnieruchalski-tiugo michalnieruchalski-tiugo requested review from TheSpyder, ltrouton and spocke and removed request for a team May 20, 2025 09:24
Copy link
Contributor

@tiny-ben-tran tiny-ben-tran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just need a changelog

  • Add a changelog entry

@michalnieruchalski-tiugo michalnieruchalski-tiugo merged commit 600e511 into main May 28, 2025
5 checks passed
@michalnieruchalski-tiugo michalnieruchalski-tiugo deleted the feature/INT-3328 branch May 28, 2025 10:48
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

Successfully merging this pull request may close these issues.

4 participants