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

Export views to the Trix global #1083

Merged
merged 1 commit into from Aug 24, 2023
Merged

Conversation

hopsoft
Copy link
Contributor

@hopsoft hopsoft commented Aug 24, 2023

Apply the same export strategy to views that's used for models and controllers.

This will allow more flexibility for folks to extend the library. For example, it will allow people to take explicit control when needed. For example,

const attachment = new Trix.Attachment({ content, contentType: 'application/vnd.example' })
const piece = new Trix.AttachmentPiece(attachment)
const view = new Trix.AttachmentView(attachment, { piece })

const figure = Trix.makeElement({
 tagName: 'figure',
 className: view.getClassName(),
 data: view.getData(),
 editable: false
})

figure.innerHTML = attachment.getContent()

Note that views were exposed on the Trix global in previous versions of the lib.

@afcapel
Copy link
Contributor

afcapel commented Aug 24, 2023

Makes sense, thanks @hopsoft!

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.

None yet

2 participants