@kids-reporter/cms-core 1.0.6 → 1.0.8
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.
|
@@ -51,19 +51,19 @@ const controller = config => {
|
|
|
51
51
|
path: config.path,
|
|
52
52
|
label: config.label,
|
|
53
53
|
graphqlSelection: config.path,
|
|
54
|
-
defaultValue: _draftJs.EditorState.createEmpty(
|
|
54
|
+
defaultValue: _draftJs.EditorState.createEmpty(),
|
|
55
55
|
deserialize: data => {
|
|
56
56
|
const rawContentState = data[config.path];
|
|
57
57
|
if (rawContentState === null) {
|
|
58
|
-
return _draftJs.EditorState.createEmpty(
|
|
58
|
+
return _draftJs.EditorState.createEmpty();
|
|
59
59
|
}
|
|
60
60
|
try {
|
|
61
61
|
const contentState = (0, _draftJs.convertFromRaw)(rawContentState);
|
|
62
|
-
const editorState = _draftJs.EditorState.createWithContent(contentState
|
|
62
|
+
const editorState = _draftJs.EditorState.createWithContent(contentState);
|
|
63
63
|
return editorState;
|
|
64
64
|
} catch (err) {
|
|
65
65
|
console.error(err);
|
|
66
|
-
return _draftJs.EditorState.createEmpty(
|
|
66
|
+
return _draftJs.EditorState.createEmpty();
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
serialize: editorState => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kids-reporter/cms-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@keystone-ui/fields": "^7.2.0",
|
|
34
34
|
"@keystone-ui/modals": "^6.0.3",
|
|
35
35
|
"@twreporter/errors": "^1.1.1",
|
|
36
|
-
"@kids-reporter/draft-editor": "1.0.
|
|
36
|
+
"@kids-reporter/draft-editor": "1.0.8",
|
|
37
37
|
"axios": "^0.26.0",
|
|
38
38
|
"draft-convert": "^2.1.12",
|
|
39
39
|
"draft-js": "^0.11.7",
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@keystone-6/core/types'
|
|
12
12
|
import { CellContainer, CellLink } from '@keystone-6/core/admin-ui/components'
|
|
13
13
|
import { EditorState, convertFromRaw, convertToRaw } from 'draft-js'
|
|
14
|
-
import { RichTextEditor
|
|
14
|
+
import { RichTextEditor } from '@kids-reporter/draft-editor'
|
|
15
15
|
|
|
16
16
|
export const Field = ({
|
|
17
17
|
field,
|
|
@@ -63,22 +63,19 @@ export const controller = (
|
|
|
63
63
|
path: config.path,
|
|
64
64
|
label: config.label,
|
|
65
65
|
graphqlSelection: config.path,
|
|
66
|
-
defaultValue: EditorState.createEmpty(
|
|
66
|
+
defaultValue: EditorState.createEmpty(),
|
|
67
67
|
deserialize: (data) => {
|
|
68
68
|
const rawContentState = data[config.path]
|
|
69
69
|
if (rawContentState === null) {
|
|
70
|
-
return EditorState.createEmpty(
|
|
70
|
+
return EditorState.createEmpty()
|
|
71
71
|
}
|
|
72
72
|
try {
|
|
73
73
|
const contentState = convertFromRaw(rawContentState)
|
|
74
|
-
const editorState = EditorState.createWithContent(
|
|
75
|
-
contentState,
|
|
76
|
-
decorator
|
|
77
|
-
)
|
|
74
|
+
const editorState = EditorState.createWithContent(contentState)
|
|
78
75
|
return editorState
|
|
79
76
|
} catch (err) {
|
|
80
77
|
console.error(err)
|
|
81
|
-
return EditorState.createEmpty(
|
|
78
|
+
return EditorState.createEmpty()
|
|
82
79
|
}
|
|
83
80
|
},
|
|
84
81
|
serialize: (editorState: EditorState) => {
|