tinymce-angular icon indicating copy to clipboard operation
tinymce-angular copied to clipboard

Export editor option type

Open Tazaf opened this issue 3 years ago • 2 comments

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'
};

Tazaf avatar Aug 22 '22 13:08 Tazaf

Ref: INT-2997

exalate-issue-sync[bot] avatar Aug 22 '22 13:08 exalate-issue-sync[bot]

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

sbschorer avatar Sep 16 '22 18:09 sbschorer

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

jscasca avatar Oct 21 '22 06:10 jscasca

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.

Tazaf avatar Oct 25 '22 18:10 Tazaf

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

jscasca avatar Oct 27 '22 04:10 jscasca

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

Thanks 👍

Tazaf avatar Oct 27 '22 07:10 Tazaf