@dotcms/react 0.0.1-beta.32 → 0.0.1-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/next.esm.js
CHANGED
|
@@ -689,7 +689,7 @@ function DotCMSEditableText({
|
|
|
689
689
|
mode = 'plain',
|
|
690
690
|
format = 'text',
|
|
691
691
|
contentlet,
|
|
692
|
-
fieldName
|
|
692
|
+
fieldName
|
|
693
693
|
}) {
|
|
694
694
|
const editorRef = useRef(null);
|
|
695
695
|
const [scriptSrc, setScriptSrc] = useState('');
|
|
@@ -716,6 +716,7 @@ function DotCMSEditableText({
|
|
|
716
716
|
}
|
|
717
717
|
const createURL = new URL(__TINYMCE_PATH_ON_DOTCMS__, state.dotCMSHost);
|
|
718
718
|
setScriptSrc(createURL.toString());
|
|
719
|
+
const content = (contentlet == null ? void 0 : contentlet[fieldName]) || '';
|
|
719
720
|
(_editorRef$current = editorRef.current) == null || _editorRef$current.setContent(content, {
|
|
720
721
|
format
|
|
721
722
|
});
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcms/react",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.33",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": ">=18",
|
|
6
6
|
"react-dom": ">=18",
|
|
7
|
-
"@dotcms/client": "0.0.1-beta.
|
|
8
|
-
"@dotcms/uve": "0.0.1-beta.
|
|
7
|
+
"@dotcms/client": "0.0.1-beta.33",
|
|
8
|
+
"@dotcms/uve": "0.0.1-beta.33",
|
|
9
9
|
"@tinymce/tinymce-react": "^6.0.0"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { DotCMSBasicContentlet } from '@dotcms/types';
|
|
2
3
|
import { DotCMSEditableTextProps } from './utils';
|
|
3
4
|
/**
|
|
4
5
|
* Allows inline edit content pulled from dotCMS API using TinyMCE editor
|
|
@@ -27,5 +28,5 @@ import { DotCMSEditableTextProps } from './utils';
|
|
|
27
28
|
* ```
|
|
28
29
|
* @returns {JSX.Element} A component to edit content inline
|
|
29
30
|
*/
|
|
30
|
-
export declare function DotCMSEditableText({ mode, format, contentlet, fieldName }: Readonly<DotCMSEditableTextProps
|
|
31
|
+
export declare function DotCMSEditableText<T extends DotCMSBasicContentlet>({ mode, format, contentlet, fieldName }: Readonly<DotCMSEditableTextProps<T>>): JSX.Element;
|
|
31
32
|
export default DotCMSEditableText;
|
|
@@ -2,13 +2,13 @@ import { IAllProps } from '@tinymce/tinymce-react';
|
|
|
2
2
|
import { DotCMSBasicContentlet } from '@dotcms/types';
|
|
3
3
|
export type DOT_EDITABLE_TEXT_FORMAT = 'html' | 'text';
|
|
4
4
|
export type DOT_EDITABLE_TEXT_MODE = 'minimal' | 'full' | 'plain';
|
|
5
|
-
export interface DotCMSEditableTextProps {
|
|
5
|
+
export interface DotCMSEditableTextProps<T extends DotCMSBasicContentlet> {
|
|
6
6
|
/**
|
|
7
7
|
* Represents the field name of the `contentlet` that can be edited
|
|
8
8
|
*
|
|
9
9
|
* @memberof DotCMSEditableTextProps
|
|
10
10
|
*/
|
|
11
|
-
fieldName:
|
|
11
|
+
fieldName: keyof T;
|
|
12
12
|
/**
|
|
13
13
|
* Represents the format of the editor which can be `text` or `html`
|
|
14
14
|
*
|
|
@@ -29,7 +29,7 @@ export interface DotCMSEditableTextProps {
|
|
|
29
29
|
* @type {DotCMSBasicContentlet}
|
|
30
30
|
* @memberof DotCMSEditableTextProps
|
|
31
31
|
*/
|
|
32
|
-
contentlet:
|
|
32
|
+
contentlet: T;
|
|
33
33
|
}
|
|
34
34
|
export declare const TINYMCE_CONFIG: {
|
|
35
35
|
[key in DOT_EDITABLE_TEXT_MODE]: IAllProps['init'];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DotCMSComposedPageResponse } from '@dotcms/types';
|
|
2
2
|
/**
|
|
3
3
|
* Custom hook to manage the editable state of a DotCMS page.
|
|
4
4
|
*
|
|
@@ -87,4 +87,4 @@ import { DotCMSPageResponse } from '@dotcms/types';
|
|
|
87
87
|
* @returns {DotCMSPageResponse} The updated editable page state that reflects any changes made in the UVE.
|
|
88
88
|
* The structure includes page data and any GraphQL content that was requested.
|
|
89
89
|
*/
|
|
90
|
-
export declare const useEditableDotCMSPage: (pageResponse:
|
|
90
|
+
export declare const useEditableDotCMSPage: <T extends Partial<Pick<import("@dotcms/types").DotCMSPageResponse, "pageAsset" | "content">>>(pageResponse: DotCMSComposedPageResponse<T>) => DotCMSComposedPageResponse<T>;
|