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

ngx-jodit: type JoditConfig not have 'getIcon' property #32

Open
Velmoren opened this issue Jul 5, 2024 · 7 comments
Open

ngx-jodit: type JoditConfig not have 'getIcon' property #32

Velmoren opened this issue Jul 5, 2024 · 7 comments

Comments

@Velmoren
Copy link

Velmoren commented Jul 5, 2024

Type JoditConfig not have 'getIcon' property

TS2353: Object literal may only specify known properties, and getIcon does not exist in type Partial<Config & Config>

Package versions

package version
Angular v17.3.0
ngx-jodit v3.1.2
jodit v4.2.27
@julianpoemp
Copy link
Owner

@Velmoren do you have more information? Where does "getIcon" comes from?

@Velmoren
Copy link
Author

Velmoren commented Jul 5, 2024

I take this param in CHANGELOG


## 4.0.0.beta-0

#### :boom: Breaking Change

-   !!! Build files removed from repository and only available in npm package !!!
-   !!! bowers.json was removed !!!
-   server.js was removed
-   All build js files was rewritten to typescript
-   `build-system` was renamed as `tools`
-   Removed `exludeLangs` build option. Instead use `--includeLanguages=en` option.
-   Default target for build was changed to es2015
-   Build in es2018 target was removed, instead es2021 was added
-   Event `getIcon` was removed. Use option `getIcon` instead

```ts
Jodit.make('#editor', {
	getIcon: (name: string, clearName: string) => {
		if (name === 'bold') {
			return '<svg>...</svg>';
		}

		return null;
	}
});

@julianpoemp

@Velmoren
Copy link
Author

Velmoren commented Jul 5, 2024

@julianpoemp But getIcon property does'nt exist type JoditConfig

@julianpoemp
Copy link
Owner

@Velmoren I'm able to reproduce this issue. getIconis a property handled by Jodit, but seems not to be defined in the typings of jodit that I use to create JoditConfig type:

export type JoditConfig = Partial<JoditCoreConfig.Config & JoditESMConfig.Config>;

As a temporary workaround convert your options to any while I'm looking for a solution. I think getIconis either defined in another type definition I don't use for JoditConfig or the property does not exist in any typing from Jodit.

@Velmoren
Copy link
Author

Velmoren commented Jul 5, 2024

@julianpoemp Thank you! We will be waiting!

@julianpoemp
Copy link
Owner

@Velmoren opened an issue on Jodit repository: xdan/jodit#1157

I'm very sure that it's because of out-of-sync typings. Instead of converting to "any" you can use "IViewOptions" from jodit package. This interface contains the correct typings.

@Velmoren
Copy link
Author

Velmoren commented Jul 5, 2024

@julianpoemp Thank you! But, IViewOptions not exported from jodit lib.
As a temporary workaround i extended the JoditConfig type.
We look forward to the fix, thanks again for your assistance!

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