tinymce / tinymce-angular

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

Export interfaces for ButtonSpec and BaseEditorOptions #291

Closed weberhofer closed 2 years ago

weberhofer commented 2 years ago

To be able to write tinymce configurations and and plugins with typescript, it would be great to have those interfaces exported.

The former RawEditorSettings have been exported in the 5.x version of the typings, but the Button specifications were never exported,

exalate-issue-sync[bot] commented 2 years ago

Ref: INT-2859

tiny-james commented 2 years ago

In TinyMCE 6 settings was renamed to options. This meant that the previous type RawEditorSettings became RawEditorOptions which is probably what you want. If you need to support both TinyMCE 5 and 6 (which we do in the integrations) you can use a typescript trick to get whatever of the two is needed:

type EditorOptions = Parameters<TinyMCE['init']>[0];

The button specifications are available from Ui. The button specification can be accessed with:

import { Ui } from 'tinymce';

const buttonSpec: Ui.Toolbar.ToolbarButtonSpec = {
// your spec here
};