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

Customize Wysiwyg editor #113

Open
armellarcier opened this issue Nov 24, 2020 · 8 comments
Open

Customize Wysiwyg editor #113

armellarcier opened this issue Nov 24, 2020 · 8 comments

Comments

@armellarcier
Copy link

I need a field with only the h3 and paragraph levels

I'd like to add a configuration in my form builder to customize the Wysiwyg toolbar.

@armellarcier
Copy link
Author

Could be done with a data-attribute on the textarea tag, so with attr config but it will not allow for formatting functions.

Better register javascript Pell configuration object and use those.

I'd need a few directions before creating a PR.

@jacquesbh
Copy link
Member

The actions are defined here:

let wysiwyg = new MonsieurBizRichEditorWysiwyg({
actions: [
'bold',
'italic',
'underline',
'ulist',
'olist',
'heading1',
'heading2',
{
name: 'heading3',
icon: '<b>H<sub>3</sub></b>',
title: 'Heading 3',
result: () => exec('formatBlock', '<h3>')
},
'link'
]
});

But it is for all wysiwyg fields. It could be possible to pass the actions directly to an attribute of the field, using data-actions as example, and a json encoded value.
Then add a condition here to initialize Pell with those actions if they exist:

actions: this.config.actions,

@jacquesbh
Copy link
Member

Another way could be to register somewhere more Pell configurations identified by a specific name, and use that name in the attribute to setup pell for each wysiwyg field.
This is much better actually but it'll require a bit more code.

@armellarcier
Copy link
Author

I'm wondering whether this plugin should be so opinionated on the js text editor to use altogether.

We need at least a way to configure Pell's toolbar globally and for individual UiElements but why not allow replacing the editor library?

@jacquesbh
Copy link
Member

If you want to replace the library you are free to do so ;).
But we won't change the library here because the goal is to have something really simple.

@armellarcier
Copy link
Author

Sure, I just meant supporting / documenting text editing lib switch

@jacquesbh
Copy link
Member

Yes but why documenting a feature which doesn't exist yet? :p

@armellarcier
Copy link
Author

I'm actually making the scope of this issue wider than just "toolbar customization"

@armellarcier armellarcier changed the title Customize Wysiwyg toolbar Customize Wysiwyg editor Nov 26, 2020
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