diff --git a/core-web/libs/sdk/react/src/lib/components/DotEditableText/utils.ts b/core-web/libs/sdk/react/src/lib/components/DotEditableText/utils.ts index 08ed41e92413..dc097d6276f8 100644 --- a/core-web/libs/sdk/react/src/lib/components/DotEditableText/utils.ts +++ b/core-web/libs/sdk/react/src/lib/components/DotEditableText/utils.ts @@ -2,18 +2,17 @@ import { IAllProps } from '@tinymce/tinymce-react'; import { DotCMSContentlet } from '../../models'; -export type DOT_EDITABLE_TEXT_MODE = 'minimal' | 'full' | 'plain'; - export type DOT_EDITABLE_TEXT_FORMAT = 'html' | 'text'; +export type DOT_EDITABLE_TEXT_MODE = 'minimal' | 'full' | 'plain'; + export interface DotEditableTextProps { /** - * Represents the mode of the editor which can be `plain`, `minimal`, or `full` + * Represents the field name of the `contentlet` that can be edited * - * @type {DOT_EDITABLE_TEXT_MODE} * @memberof DotEditableTextProps */ - mode?: DOT_EDITABLE_TEXT_MODE; + fieldName: string; /** * Represents the format of the editor which can be `text` or `html` * @@ -22,43 +21,41 @@ export interface DotEditableTextProps { */ format?: DOT_EDITABLE_TEXT_FORMAT; /** - * Represents the `contentlet` that can be inline edited + * Represents the mode of the editor which can be `plain`, `minimal`, or `full` * - * @type {DotCMSContentlet} + * @type {DOT_EDITABLE_TEXT_MODE} * @memberof DotEditableTextProps */ - contentlet: DotCMSContentlet; + mode?: DOT_EDITABLE_TEXT_MODE; /** - * Represents the field name of the `contentlet` that can be edited + * Represents the `contentlet` that can be inline edited * + * @type {DotCMSContentlet} * @memberof DotEditableTextProps */ - fieldName: string; + contentlet: DotCMSContentlet; } const DEFAULT_TINYMCE_CONFIG: IAllProps['init'] = { - menubar: false, inline: true, + menubar: false, + powerpaste_html_import: 'clean', + powerpaste_word_import: 'clean', + suffix: '.min', valid_styles: { '*': 'font-size,font-family,color,text-decoration,text-align' - }, - powerpaste_word_import: 'clean', - powerpaste_html_import: 'clean', - suffix: '.min' + } }; export const TINYMCE_CONFIG: { [key in DOT_EDITABLE_TEXT_MODE]: IAllProps['init']; } = { - minimal: { - ...DEFAULT_TINYMCE_CONFIG, - plugins: 'link autolink', - toolbar: 'bold italic underline | link', - valid_elements: 'strong,em,span[style],a[href]' - }, full: { ...DEFAULT_TINYMCE_CONFIG, plugins: 'link lists autolink charmap', + toolbar: [ + 'styleselect undo redo | bold italic underline | forecolor backcolor | alignleft aligncenter alignright alignfull | numlist bullist outdent indent | hr charmap removeformat | link' + ], style_formats: [ { title: 'Paragraph', format: 'p' }, { title: 'Header 1', format: 'h1' }, @@ -69,14 +66,17 @@ export const TINYMCE_CONFIG: { { title: 'Header 6', format: 'h6' }, { title: 'Pre', format: 'pre' }, { title: 'Code', format: 'code' } - ], - toolbar: [ - 'styleselect undo redo | bold italic underline | forecolor backcolor | alignleft aligncenter alignright alignfull | numlist bullist outdent indent | hr charmap removeformat | link' ] }, plain: { ...DEFAULT_TINYMCE_CONFIG, plugins: '', toolbar: '' + }, + minimal: { + ...DEFAULT_TINYMCE_CONFIG, + plugins: 'link autolink', + toolbar: 'bold italic underline | link', + valid_elements: 'strong,em,span[style],a[href]' } }; diff --git a/core-web/libs/sdk/react/src/lib/models/index.ts b/core-web/libs/sdk/react/src/lib/models/index.ts index a66af7726135..4378ffa8156a 100644 --- a/core-web/libs/sdk/react/src/lib/models/index.ts +++ b/core-web/libs/sdk/react/src/lib/models/index.ts @@ -90,39 +90,39 @@ export interface DotCMSPageContext { export interface DotCMSContentlet { archived: boolean; - baseType: string; + binaryContentAsset?: string; deleted?: boolean; + baseType: string; binary?: string; - binaryContentAsset?: string; binaryVersion?: string; - contentType: string; file?: string; - folder: string; + contentType: string; hasLiveVersion?: boolean; + folder: string; hasTitleImage: boolean; - host: string; hostName: string; - identifier: string; + host: string; inode: string; - image?: string; + identifier: string; languageId: number; - language?: string; - live: boolean; + image?: string; locked: boolean; + language?: string; mimeType?: string; - modDate: string; modUser: string; - modUserName: string; - owner: string; + modDate: string; + live: boolean; sortOrder: number; - stInode: string; + owner: string; title: string; + stInode: string; titleImage: string; + modUserName: string; text?: string; - url: string; working: boolean; - body?: string; + url: string; contentTypeIcon?: string; + body?: string; variant?: string; __icon__?: string; // eslint-disable-next-line @typescript-eslint/no-explicit-any