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

tinymce.get() function doesn't appear to work in version 6.0.2 for the Web Component API #32

Open
bob2517-whiteline opened this issue Jul 15, 2022 · 2 comments
Labels

Comments

@bob2517-whiteline
Copy link

bob2517-whiteline commented Jul 15, 2022

What is the current behavior? Describe the bug
The tinymce.get() function doesn't appear to work for the Web Component API.

Please provide the steps to reproduce and if possible a minimal demo of the problem via fiddle.tiny.cloud or similar.

// Several editors are on the page at this point.
// The specific one mentioned below is displayed correctly on the page when the code below runs.
// The editor that is being retrieved is not the active instance.

// This ID is set on the tinymce-editor tag. On the <tinymce-editor> tag itself.
let thisTinyMCEEditor = 'oneOfSeveralEditors_1';

let el = document.getElementById(thisTinyMCEEditor);
// Correctly displays a tinymce-editor element:
console.log('el:', el);

let activeEditor = tinymce.get(thisTinyMCEEditor);
// Incorrectly displays "null":
console.log('activeEditor:', activeEditor);

What is the expected behavior?
The editor specified by the ID should be retrieved by the get() function.

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE?
At least version 6.0.2. I didn't see any mentioned fix for this in later versions.
Affects Chromium/Firefox.

Suggestion: is it trying to look in the shadow DOM for the tag?

@lnewson
Copy link
Contributor

lnewson commented Jul 15, 2022

This doesn't appear to be related to TinyMCE and is instead related to the TinyMCE web component integration. The problem is that the integration isn't passing through the id specified and as such TinyMCE is generating one randomly for the target provided by the integration here: https://github.com/tinymce/tinymce-webcomponent/blob/main/src/main/ts/component/Editor.ts#L212-L218

As such I'm going to transfer this to the integration repo so it can be looked at by our integrations team.

@lnewson lnewson transferred this issue from tinymce/tinymce Jul 15, 2022
@exalate-issue-sync
Copy link

Ref: INT-2957

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

No branches or pull requests

2 participants