mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-20 13:01:56 +00:00
Remove unneeded Draftail init & save value conversions
This commit is contained in:
parent
95bb2aecf9
commit
0edc5be68c
1 changed files with 2 additions and 6 deletions
|
|
@ -31,8 +31,7 @@ export const initEditor = (fieldName, options = {}) => {
|
|||
field.parentNode.appendChild(editorWrapper);
|
||||
|
||||
const serialiseInputValue = rawContentState => {
|
||||
// TODO Remove default {} when finishing https://github.com/springload/wagtaildraftail/issues/32.
|
||||
field.value = JSON.stringify(rawContentState || {});
|
||||
field.value = JSON.stringify(rawContentState);
|
||||
};
|
||||
|
||||
let blockTypes;
|
||||
|
|
@ -62,10 +61,7 @@ export const initEditor = (fieldName, options = {}) => {
|
|||
description: STRINGS.HORIZONTAL_LINE,
|
||||
} : false;
|
||||
|
||||
const fieldValue = JSON.parse(field.value);
|
||||
// TODO Remove default null when finishing https://github.com/springload/wagtaildraftail/issues/32.
|
||||
const rawContentState =
|
||||
fieldValue && Object.keys(fieldValue).length === 0 ? null : fieldValue;
|
||||
const rawContentState = JSON.parse(field.value);
|
||||
|
||||
const editor = (
|
||||
<DraftailEditor
|
||||
|
|
|
|||
Loading…
Reference in a new issue