import type { VNode } from 'vue'; import type { DropdownButtonItemArgs } from '../dropdown-button/dropdown-button-item'; import type { FormItemWrapperArgs, MarginType } from '../form/form-item-wrapper'; import type { WysiwygButtonDef, WysiwygCommandContext, WysiwygDropdownItem, WysiwygModalDescriptor, WysiwygModalValues, WysiwygOptions, WysiwygTranslations, WysiwygUploadArgs, } from './plugins/wysiwyg/types'; import { createApp, h } from 'vue'; import { Prop, toNative, Watch } from 'vue-facing-decorator'; import PowerduckState from '../../app/powerduck-state'; import TsxComponent, { Component } from '../../app/vuetsx'; import EsModuleImportHelper from '../../common/utils/esmodule-import-helper'; import FormItemWrapper from '../form/form-item-wrapper'; import { FileManagerDialog, FileManagerModalFileType } from '../modal/ts/file-manager-dialog'; import svgIcons from './img/wysiwyg-icons.svg'; import { WYSIWYG_DEFAULT_COLORS, WYSIWYG_DEFAULT_FONT_SIZES, WYSIWYG_DEFAULT_LINE_HEIGHTS, } from './plugins/wysiwyg/colors'; import { getTranslations } from './plugins/wysiwyg/i18n'; import WysiwygPromptModal from './plugins/wysiwyg/wysiwyg-prompt-modal'; import './css/wysiwig.css'; export interface WysiwygEditorArgs extends FormItemWrapperArgs { value: string; placeholder?: string; useFileManager?: boolean; itemId?: number; useCommonUpload?: boolean; uploadPluginArgs?: () => WysiwygUploadArgs | null; resizable?: boolean; initialHeight?: number; onResized?: (height: number) => void; changed: (newValue: string) => void; htmlViewControlled?: boolean; onHtmlViewChange?: (htmlView: boolean) => void; } export class WysiwygConfig { static uploadArgsFactory: () => WysiwygUploadArgs | null = null; /** * Hosts the "Insert embed" button may frame. Unset (the default), any embed noembed returns is * inserted. Set, an embed is inserted only when it is `