tinymce / tinymce-angular

Official TinyMCE Angular Component
MIT License
320 stars 92 forks source link

Export editor option type #314

Closed Tazaf closed 1 year ago

Tazaf commented 1 year ago

Is your feature request related to a problem? Please describe. The type of the editor component's init property is currently not exported by this package, which prevent declaring a global constant configuration that could then be imported and used in other custom components.

Describe the solution you'd like I'd like to be able to create constant typed as editor options:

import { EditorOptions } from '@tinymce/tinymce-angular';

export const DEFAULT_EDITOR_CONFIG: EditorOptions = {
  height: 300,
  menubar: false,
  file_picker_types: 'image',
  file_picker_callback: filePickerCallback,
  plugins: ['advlist', 'help', 'wordcount'],
  toolbar: 'undo redo'
};
exalate-issue-sync[bot] commented 1 year ago

Ref: INT-2997

sbschorer commented 1 year ago

As a workaround you could write const DEFAULT_EDITOR_CONFIG: EditorComponent['init']

jscasca commented 1 year ago

You can import all the Editor types from tinymce. E.g: import { RawEditorSettings } from 'tinymce';

Tazaf commented 1 year ago

You can import all the Editor types from tinymce. E.g: import { RawEditorSettings } from 'tinymce';

Hum... tried that, but tinymce doesn't seem to be something I can import from. At least that's what my IDE tells me.

jscasca commented 1 year ago

What versions are you using? The @tinymce/tinymce-angular should include tinymce so all types are available. Older versions did not include that and you would have to manually include the types.

Here's an example: https://codesandbox.io/s/brave-pascal-74g1l5?file=/src/app/app.component.ts

Tazaf commented 1 year ago

Well I apparently did something wrong in my initial test, because the import from tinymce is now working as expected 🤷

Thanks 👍