julianpoemp / ngx-jodit

Angular wrapper for jodit and jodit-pro WYSIWYG editor supporting Angular >=12 and ESM.
https://github.julianpoemp.com/ngx-jodit/3.x/
MIT License
17 stars 4 forks source link

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

Open Velmoren opened 2 months ago

Velmoren commented 2 months ago

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 commented 2 months ago

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

Velmoren commented 2 months ago

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 commented 2 months ago

@julianpoemp But getIcon property does'nt exist type JoditConfig

julianpoemp commented 2 months ago

@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 commented 2 months ago

@julianpoemp Thank you! We will be waiting!

julianpoemp commented 2 months ago

@Velmoren opened an issue on Jodit repository: https://github.com/xdan/jodit/issues/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 commented 2 months ago

@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!