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

The Trix.handleEvent helper is not available on version 2 #1124

Closed
rderoldan1 opened this issue Jan 25, 2024 · 2 comments
Closed

The Trix.handleEvent helper is not available on version 2 #1124

rderoldan1 opened this issue Jan 25, 2024 · 2 comments

Comments

@rderoldan1
Copy link

I apologize if this is not the right place to ask this question, but I am a bit lost. Our team is migrating from version 1 to version 2 and we have encountered an issue. One of our custom code is no longer working because the helper methods we are using, which are located in the dom.js, are not being exported anymore. This issue seems similar to a conversation I found at this URL #1083.

We used to be able to access those like this

  const { handleEvent } = Trix;
  const { attachmentSelector } = Trix.AttachmentView;

I was wondering if there is any particular reason why these helper methods are not being exported under the Trix object anymore. For now, I have copied the function to my own code, but it would be great to be able to access it directly from the library. Would you be open to changing this or would you prefer to keep these functions closed?

Thank you in advance for your help.

  • Trix version: 2.0.8
@afcapel
Copy link
Contributor

afcapel commented Jan 26, 2024

No worries, it's a good question.

Trix.handleEvent was never meant to be part of the public API. It was available under the Trix constant only because, before ESM modules were widely available, storing code in global variables was the best way to namespace it.

I don't think there's a compelling reason to make handleEvent public. In most cases you'd be better off using standard browser APIs directly.

@afcapel afcapel closed this as completed Jan 26, 2024
@rderoldan1
Copy link
Author

@afcapel thanks for answering :)

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

2 participants