Finish making Draftail toolbar translatable

This commit is contained in:
Thibaud Colas 2018-01-18 18:31:15 +02:00
parent dc4e65b3b9
commit 239365705c
3 changed files with 16 additions and 3 deletions

View file

@ -58,6 +58,10 @@ export const initEditor = (fieldName, options = {}) => {
);
}
const enableHorizontalRule = options && options.enableHorizontalRule ? {
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 =
@ -69,9 +73,9 @@ export const initEditor = (fieldName, options = {}) => {
onSave={serialiseInputValue}
placeholder={STRINGS.WRITE_HERE}
spellCheck={true}
enableLineBreak={true}
showUndoControl={true}
showRedoControl={true}
enableLineBreak={{ description: STRINGS.LINE_BREAK }}
showUndoControl={{ description: STRINGS.UNDO }}
showRedoControl={{ description: STRINGS.REDO }}
// If increasing above 4, we will need to add styles for the extra nesting levels.
maxListNesting={4}
// Draft.js + IE 11 presents some issues with pasting rich text. Disable rich paste there.
@ -80,6 +84,7 @@ export const initEditor = (fieldName, options = {}) => {
blockTypes={blockTypes}
inlineStyles={inlineStyles}
entityTypes={entityTypes}
enableHorizontalRule={enableHorizontalRule}
/>
);

View file

@ -31,6 +31,10 @@ global.wagtailConfig = {
CLOSE_EXPLORER: 'Close explorer',
ALT_TEXT: 'Alt text',
WRITE_HERE: 'Write here…',
HORIZONTAL_LINE: 'Horizontal line',
LINE_BREAK: 'Line break',
UNDO: 'Undo',
REDO: 'Redo',
},
};

View file

@ -40,6 +40,10 @@
CLOSE_EXPLORER: "{% trans 'Close explorer' %}",
ALT_TEXT: "{% trans 'Alt text' %}",
WRITE_HERE: "{% trans 'Write here…' %}",
HORIZONTAL_LINE: "{% trans 'Horizontal line' %}",
LINE_BREAK: "{% trans 'Line break' %}",
UNDO: "{% trans 'Undo' %}",
REDO: "{% trans 'Redo' %}",
};
wagtailConfig.ADMIN_URLS = {