How to Create a Plugin with Modal-based Marks?

I’m developing a DatoCMS plugin to enhance multilingual accessibility in structured text fields using customMarksForStructuredTextField. The plugin needs to implement a custom mark that, similar to the native ā€˜Add Link’ functionality, opens a modal dialog for capturing language-specific metadata. Specifically, I’m looking to:

  • Create a custom mark that triggers a modal interface

  • Capture language attributes and accessibility metadata through the modal

  • Persist these attributes within the structured text field’s mark system

  • Implement a UI pattern similar to DatoCMS’s native link handling

Could you provide guidance on implementing this?

Hey @jessie.morin,

Welcome to the forum!

Unfortunately, I don’t think our structured text customizations allow quite this level of functionality inside our editor :frowning: It could be a feature request here on the forum.

However, maybe you can get similar enough functionality by linking to another record first instead of a URL, and then putting that other metadata inside the other record? For example, I’ve made a new model called ā€œLocalized Links with Metadataā€:

Allow it as a link in the structured text field of the first model:

Then when you add a link in the structured text field:

And you can set different data for different locales:

Then you get back as a GraphQL response:
(English)

(Spanish)

Would that work for you?

1 Like

Thank you for the suggestion. While this approach could serve as an interim solution, I’m specifically focused on optimizing the content management workflow for our editorial team by minimizing direct code intervention.

To clarify my requirements: I’m looking to implement functionality similar to the native ā€˜Add Link’ mark’s modal interface, but with a different purpose. Rather than managing hyperlinks, this implementation would facilitate language attribution for multilingual content elements (such as business names or culturally-specific terms) within our content. Ideally, the modal would present a select interface populated with our site’s supported languages, allowing editors to efficiently tag content segments with appropriate language metadata.

I recognize this specific functionality isn’t currently available. I’ll be submitting a feature request to address this use case, as it would benefit organizations managing multilingual content through DatoCMS.

I appreciate your assistance in exploring potential solutions.

1 Like

Thank you for the detailed response! I really appreciate the thoughtfulness.

I see the feature request now… and thank you for voting on it too :slight_smile: Modal Support for Custom Marks in Structured Text Fields - #2 by christine.daneau.pelletier