import Editor from 'tinymce/core/api/Editor'; import { EditorOptions } from 'tinymce/core/api/OptionTypes'; import { DataToHtmlCallback } from '../core/DataToHtml'; import { MediaResolver } from '../core/Service'; const option: { (name: K): (editor: Editor) => EditorOptions[K]; (name: string): (editor: Editor) => T; } = (name: string) => (editor: Editor) => editor.options.get(name); const register = (editor: Editor): void => { const registerOption = editor.options.register; registerOption('audio_template_callback', { processor: 'function' }); registerOption('video_template_callback', { processor: 'function' }); registerOption('iframe_template_callback', { processor: 'function' }); registerOption('media_live_embeds', { processor: 'boolean', default: true }); registerOption('media_filter_html', { processor: 'boolean', default: true }); registerOption('media_url_resolver', { processor: 'function' }); registerOption('media_alt_source', { processor: 'boolean', default: true }); registerOption('media_poster', { processor: 'boolean', default: true }); registerOption('media_dimensions', { processor: 'boolean', default: true }); }; const getAudioTemplateCallback = option('audio_template_callback'); const getVideoTemplateCallback = option('video_template_callback'); const getIframeTemplateCallback = option('iframe_template_callback'); const hasLiveEmbeds = option('media_live_embeds'); const shouldFilterHtml = option('media_filter_html'); const getUrlResolver = option('media_url_resolver'); const hasAltSource = option('media_alt_source'); const hasPoster = option('media_poster'); const hasDimensions = option('media_dimensions'); export { register, getAudioTemplateCallback, getVideoTemplateCallback, getIframeTemplateCallback, hasLiveEmbeds, shouldFilterHtml, getUrlResolver, hasAltSource, hasPoster, hasDimensions };