react icon indicating copy to clipboard operation
react copied to clipboard

[Question]

Open Bdestasio33 opened this issue 5 years ago • 8 comments

Is there any way to edit the default wsiwyg editor on a content component. We are looking to limit the formatting available to the user for example, to only allow bold and one heading option.

Bdestasio33 avatar May 26 '20 17:05 Bdestasio33

As clarification we are trying to modify it in the form builder, not the final render result.

Bdestasio33 avatar May 26 '20 17:05 Bdestasio33

@Bdestasio33,

Yes, it is also possible to provide your own custom configurations to the WYSIWYG editor found @ https://quilljs.com/docs/configuration. These configurations can be provided instead of the “true” value of the wysiwyg attribute.

wag110894 avatar May 26 '20 17:05 wag110894

Would you be able to provide some direction on where exactly this quill configuration goes when you are setting up the <FormBuilder> element? I see how to configure the WYSIWYG editor for the user filling out the form, but it's not clear to me how you configure the WYSIWYG editor for the user building the form.

davemateer avatar May 27 '20 15:05 davemateer

@wag110894 If I edit the Content.form.js file directly, I can get this to work. Is there any way to configure this without editing the formio source code directly?

davemateer avatar Jun 08 '20 19:06 davemateer

Sounds like what you really want to do is modify the builder so that the options for wysiwyg can be customized. There is a way to do that at http://formio.github.io/formio.js/app/examples/custombuilder.html

I don't have a specific example of how to customize the wysiwyg on content components but you should be able to override anything there. In react, you can pass the "options" prop to the FormBuilder component.

randallknutson avatar Jun 08 '20 20:06 randallknutson

Thanks, @randallknutson. We've tried that and maybe we're just not lining up the keys / nesting correctly, but it doesn't seem to work on the component with key "html". Sandbox to show you what I'm trying is 5edf7b947630ae81732383c7. The other options specified in that set work just fine, and if I apply those options directly to Content.form.js, it works. But I can't seem to get it to work when passing as options.

davemateer avatar Jun 09 '20 12:06 davemateer

It does look like the html component is hard coded outside of the normal "extend" functionality for the edit form which is why it isn't working. https://github.com/formio/formio.js/blob/master/src/components/content/Content.form.js#L25-L38

I'm not sure if there is a good way of extending that using the default system.

randallknutson avatar Jun 09 '20 14:06 randallknutson

Bummer, that's kind of the conclusion we were coming to. Thanks for looking into that for us. We'll probably just have to roll our own component.

davemateer avatar Jun 09 '20 15:06 davemateer

I am closing the issue as it was created too long ago and there are no new comments here. I hope it was resolved. If not, please reopen it. Thanks!

TanyaGashtold avatar Aug 31 '23 13:08 TanyaGashtold