kopia lustrzana https://github.com/wagtail/wagtail
Finish hooking up Draftail CSS & JS to Django widget
rodzic
9dc0ee47dd
commit
1378b766ee
|
|
@ -16,7 +16,7 @@ export const initEditor = (fieldName, options = {}) => {
|
|||
field.value = JSON.stringify(rawContentState || {});
|
||||
};
|
||||
|
||||
if (options.entityTypes) {
|
||||
if (options && options.entityTypes) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
options.entityTypes = options.entityTypes.map(entity => Object.assign(entity, {
|
||||
source: registry.getSource(entity.source),
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ from django.forms import Media, widgets
|
|||
from wagtail.admin.edit_handlers import RichTextFieldPanel
|
||||
from wagtail.admin.rich_text.converters.contentstate import ContentstateConverter
|
||||
from wagtail.core.rich_text import features
|
||||
from wagtail.utils.widgets import WidgetWithScript
|
||||
|
||||
|
||||
class DraftailRichTextArea(widgets.Textarea):
|
||||
class DraftailRichTextArea(WidgetWithScript, widgets.Textarea):
|
||||
# this class's constructor accepts a 'features' kwarg
|
||||
accepts_features = True
|
||||
|
||||
|
|
@ -47,5 +48,5 @@ class DraftailRichTextArea(widgets.Textarea):
|
|||
return Media(js=[
|
||||
'wagtailadmin/js/draftail.js',
|
||||
], css={
|
||||
'all': ['wagtailadmin/css/panels/dratail.css']
|
||||
'all': ['wagtailadmin/css/panels/draftail.css']
|
||||
})
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue