From b856c008a80182eb46decd351e54f9e7af2ddfc9 Mon Sep 17 00:00:00 2001 From: davidkao0902 Date: Mon, 1 Jun 2020 10:46:24 -0700 Subject: [PATCH] PagebreakAdded --- dispatch/modules/content/embeds.py | 4 ++++ .../ArticleEditor/ArticleContentEditor.js | 6 +++-- .../dispatch-editor/embeds/PageBreakEmbed.js | 22 +++++++++++++++++++ .../js/vendor/dispatch-editor/embeds/index.js | 4 +++- .../src/js/vendor/dispatch-editor/index.js | 6 +++-- 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/PageBreakEmbed.js diff --git a/dispatch/modules/content/embeds.py b/dispatch/modules/content/embeds.py index 444c7464c..9878f0d67 100644 --- a/dispatch/modules/content/embeds.py +++ b/dispatch/modules/content/embeds.py @@ -124,6 +124,9 @@ def prepare_data(self, data): 'credit': data.get('credit', None) } +class PageBreakEmbed(AbstractTemplateEmbed): + TEMPLATE = 'embeds/pagebreak.html' + class GalleryEmbed(AbstractTemplateEmbed): TEMPLATE = 'embeds/gallery.html' @@ -161,3 +164,4 @@ def prepare_data(self, data): embeds.register('video', VideoEmbed) embeds.register('image', ImageEmbed) embeds.register('gallery', GalleryEmbed) +embeds.register('pagebreak', PageBreakEmbed) diff --git a/dispatch/static/manager/src/js/components/ArticleEditor/ArticleContentEditor.js b/dispatch/static/manager/src/js/components/ArticleEditor/ArticleContentEditor.js index 15984fe6e..29a776ba0 100644 --- a/dispatch/static/manager/src/js/components/ArticleEditor/ArticleContentEditor.js +++ b/dispatch/static/manager/src/js/components/ArticleEditor/ArticleContentEditor.js @@ -12,7 +12,8 @@ import { WidgetEmbed, PollEmbed, PodcastEmbed, - InteractiveMapEmbed + InteractiveMapEmbed, + PageBreakEmbed } from '../../vendor/dispatch-editor' const embeds = [ @@ -24,7 +25,8 @@ const embeds = [ WidgetEmbed, PollEmbed, PodcastEmbed, - InteractiveMapEmbed + InteractiveMapEmbed, + PageBreakEmbed ] export default class ArticleContentEditor extends React.Component { diff --git a/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/PageBreakEmbed.js b/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/PageBreakEmbed.js new file mode 100644 index 000000000..392e46f87 --- /dev/null +++ b/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/PageBreakEmbed.js @@ -0,0 +1,22 @@ +import React from 'react' +import { TextInput } from '../../../components/inputs' + +import * as Form from '../../../components/Form' + +function PageBreakEmbedComponent(props) { + return ( +
+ + + + +
+ ) +} + + +export default { + type: 'pagebreak', + component: PageBreakEmbedComponent, +} + diff --git a/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/index.js b/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/index.js index 16cec6bc7..9a8ff9ad7 100644 --- a/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/index.js +++ b/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/index.js @@ -7,6 +7,7 @@ import WidgetEmbed from './WidgetEmbed' import PollEmbed from './PollEmbed' import PodcastEmbed from './PodcastEmbed' import InteractiveMapEmbed from './InteractiveMapEmbed' +import PageBreakEmbed from './PageBreakEmbed' export { ImageEmbed, @@ -17,5 +18,6 @@ export { WidgetEmbed, PollEmbed, PodcastEmbed, - InteractiveMapEmbed + InteractiveMapEmbed, + PageBreakEmbed } diff --git a/dispatch/static/manager/src/js/vendor/dispatch-editor/index.js b/dispatch/static/manager/src/js/vendor/dispatch-editor/index.js index debfdcd49..d1262dcf2 100644 --- a/dispatch/static/manager/src/js/vendor/dispatch-editor/index.js +++ b/dispatch/static/manager/src/js/vendor/dispatch-editor/index.js @@ -9,7 +9,8 @@ import { WidgetEmbed, PollEmbed, PodcastEmbed, - InteractiveMapEmbed + InteractiveMapEmbed, + PageBreakEmbed } from './embeds' import { @@ -34,5 +35,6 @@ export { WidgetEmbed, PollEmbed, PodcastEmbed, - InteractiveMapEmbed + InteractiveMapEmbed, + PageBreakEmbed }