Issue #2592Opened February 21, 2020by kaoz704 reactions

Modal width

Question

Hello, is there a way to set a modal's width, its currently set to 850px by CSS, but I would like to create a dialog with a small amount of text and its too big for this:

image

But it would be great to get this:

image

Without overriding the CSS, because I would still like to use large modals.

I checked the source code and the docs, it seems the only properties you can set are title and content.

Answers (3)

ronaldaugJuly 21, 20212 reactions

For those who don't know how to use modal attributes. You can add option opts.attributes to modal's open method as below.

const modal = editor.Modal;
const opts = {
       attributes: { class:'my-custom-class', id:'my-custom-id' }
}
modal.open(opts);

Because I didn't find how to use it in the documentation here.

kaoz70February 27, 20201 reactions

OK, what I'm thinking is to create a function to be able to set the width like: setWidth('400px'), and also a method to set custom attributes: setAttributes({'data-custom-attribute': 123}).

I think 2 functions are needed because the width is controlled by CSS, and so is the modal's design, so just letting the user set the width is good enough in this case. The attribute function would be for any other case that's needed

What do you think?

kaoz70May 8, 20201 reactions

Hello, sorry I'm piled with work now, if @sunnykgupta can give this a shot it would be great.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.