easy-email-editor icon indicating copy to clipboard operation
easy-email-editor copied to clipboard

More documentation

Open thijs-qv opened this issue 2 years ago • 7 comments

Can there please be more documentation added to the project? There are all sorts of cool options and things available but it's difficult to find information on them.

e.g. I'd like to hide the "subject" and "subtitle" input boxes in the AttributesPanel. I can see that the Page block of the AttributesPanel has the following props}

interface PageProps { hideSubTitle?: boolean; hideSubject?: boolean}

How would I pass these options via the EmailEditor / EmailEditorProvider props?

thijs-qv avatar Feb 22 '23 09:02 thijs-qv

https://github.com/zalify/easy-email/pull/237 Check here. The latest version includes the feature you want.

m-Ryan avatar Feb 22 '23 10:02 m-Ryan

Great, thanks! I don't want to sound ungrateful, but is this documented somewhere? I had to look through the pull request comments in order to figure it out. I'm also getting a type error so maybe I'm still doing something wrong? (the inputs are hidden now though so that's great)

I'm setting the config as follows:

const DefaultPageConfigPanel = BlockAttributeConfigurationManager.get(
  BasicType.PAGE
);
BlockAttributeConfigurationManager.add({
  // @ts-ignore
  [BasicType.PAGE]: () => <DefaultPageConfigPanel hideSubject hideSubTitle />,
});

the type error I get is

Type '() => JSX.Element' is not assignable to type 'ReactNode'

thijs-qv avatar Feb 22 '23 13:02 thijs-qv

Hey @thijs-qv, I'll double-check the typing issue this PM with my project I did not have it running the demo.

Feel free to open a PR for additional documentation; contributions are always welcomed!

wilau2 avatar Feb 22 '23 16:02 wilau2

Thank you! I’ll see if I can add some documentation when I’m a bit more familiar with the project and the codebase.

thijs-qv avatar Feb 22 '23 17:02 thijs-qv

I fixed the type error. You only need to update to the latest version.

image

m-Ryan avatar Feb 24 '23 13:02 m-Ryan

When I use this config I see message:

TS2322: Type '{ hideSubject: true; hideSubTitle: true; }' is not assignable to type 'IntrinsicAttributes'.   Property 'hideSubject' does not exist on type 'IntrinsicAttributes'.

applibs avatar Apr 04 '23 07:04 applibs

Hi,

I managed to fix the issue by setting the returned type of BlockAttributeConfigurationManager.get(...) to typeof DefaultPageConfigPanel that comes from easy-email-extensions, here's an example :

const MyDefaultPageConfigPanel: typeof DefaultPageConfigPanel =
	BlockAttributeConfigurationManager.get(BasicType.PAGE);
BlockAttributeConfigurationManager.add({
	[BasicType.PAGE]: () => <DefaultPageConfigPanel hideSubject hideSubTitle />,
});

Hope this helps

makavelithadon avatar Sep 18 '23 13:09 makavelithadon