From fa48bcd788949602a482929946eb319919655909 Mon Sep 17 00:00:00 2001 From: davidkao0902 Date: Thu, 11 Jun 2020 04:16:36 +0000 Subject: [PATCH 1/4] dropcap function added --- dispatch/modules/content/embeds.py | 10 +++++++ dispatch/static/manager/package.json | 2 +- .../ArticleEditor/ArticleContentEditor.js | 6 ++-- .../dispatch-editor/embeds/DropCapEmbed.js | 29 +++++++++++++++++++ .../dispatch-editor/embeds/PageBreakEmbed.js | 4 +-- .../js/vendor/dispatch-editor/embeds/index.js | 4 ++- .../src/js/vendor/dispatch-editor/index.js | 6 ++-- 7 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/DropCapEmbed.js diff --git a/dispatch/modules/content/embeds.py b/dispatch/modules/content/embeds.py index 9878f0d67..ad3abd412 100644 --- a/dispatch/modules/content/embeds.py +++ b/dispatch/modules/content/embeds.py @@ -126,6 +126,15 @@ def prepare_data(self, data): class PageBreakEmbed(AbstractTemplateEmbed): TEMPLATE = 'embeds/pagebreak.html' + +class DropCapEmbed(AbstractTemplateEmbed): + TEMPLATE = 'embeds/dropcap.html' + + @classmethod + def prepare_data(self, data): + return { + 'paragraph': data.get('paragraph', None) + } class GalleryEmbed(AbstractTemplateEmbed): TEMPLATE = 'embeds/gallery.html' @@ -165,3 +174,4 @@ def prepare_data(self, data): embeds.register('image', ImageEmbed) embeds.register('gallery', GalleryEmbed) embeds.register('pagebreak', PageBreakEmbed) +embeds.register('dropcap', DropCapEmbed) diff --git a/dispatch/static/manager/package.json b/dispatch/static/manager/package.json index 08f51a827..95432f454 100644 --- a/dispatch/static/manager/package.json +++ b/dispatch/static/manager/package.json @@ -86,5 +86,5 @@ "watch": "webpack --watch --config webpack.dev.config.js", "dev": "webpack --config webpack.dev.config.js", "build": "webpack -p --config webpack.config.js" - } + } } diff --git a/dispatch/static/manager/src/js/components/ArticleEditor/ArticleContentEditor.js b/dispatch/static/manager/src/js/components/ArticleEditor/ArticleContentEditor.js index 29a776ba0..4b755b74f 100644 --- a/dispatch/static/manager/src/js/components/ArticleEditor/ArticleContentEditor.js +++ b/dispatch/static/manager/src/js/components/ArticleEditor/ArticleContentEditor.js @@ -13,7 +13,8 @@ import { PollEmbed, PodcastEmbed, InteractiveMapEmbed, - PageBreakEmbed + PageBreakEmbed, + DropCapEmbed } from '../../vendor/dispatch-editor' const embeds = [ @@ -26,7 +27,8 @@ const embeds = [ PollEmbed, PodcastEmbed, InteractiveMapEmbed, - PageBreakEmbed + PageBreakEmbed, + DropCapEmbed ] export default class ArticleContentEditor extends React.Component { diff --git a/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/DropCapEmbed.js b/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/DropCapEmbed.js new file mode 100644 index 000000000..b9ebb60a5 --- /dev/null +++ b/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/DropCapEmbed.js @@ -0,0 +1,29 @@ +import React from 'react' +import { TextInput } from '../../../components/inputs' + +import * as Form from '../../../components/Form' + +function DropCapEmbedComponent(props) { + return ( +
+ + + props.updateField('paragraph', e.target.value)} /> + + +
+ ) +} + + +export default { + type: 'dropcap', + component: DropCapEmbedComponent, + defaultData: { + paragraph: '' + } +} + 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 index 392e46f87..88b5f5d76 100644 --- a/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/PageBreakEmbed.js +++ b/dispatch/static/manager/src/js/vendor/dispatch-editor/embeds/PageBreakEmbed.js @@ -1,9 +1,7 @@ import React from 'react' -import { TextInput } from '../../../components/inputs' - import * as Form from '../../../components/Form' -function PageBreakEmbedComponent(props) { +function PageBreakEmbedComponent() { return (
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 9a8ff9ad7..e8629b7a1 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 @@ -8,6 +8,7 @@ import PollEmbed from './PollEmbed' import PodcastEmbed from './PodcastEmbed' import InteractiveMapEmbed from './InteractiveMapEmbed' import PageBreakEmbed from './PageBreakEmbed' +import DropCapEmbed from './DropCapEmbed' export { ImageEmbed, @@ -19,5 +20,6 @@ export { PollEmbed, PodcastEmbed, InteractiveMapEmbed, - PageBreakEmbed + PageBreakEmbed, + DropCapEmbed } 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 d1262dcf2..3282bec48 100644 --- a/dispatch/static/manager/src/js/vendor/dispatch-editor/index.js +++ b/dispatch/static/manager/src/js/vendor/dispatch-editor/index.js @@ -10,7 +10,8 @@ import { PollEmbed, PodcastEmbed, InteractiveMapEmbed, - PageBreakEmbed + PageBreakEmbed, + DropCapEmbed } from './embeds' import { @@ -36,5 +37,6 @@ export { PollEmbed, PodcastEmbed, InteractiveMapEmbed, - PageBreakEmbed + PageBreakEmbed, + DropCapEmbed } From 43547d0b9edc64967d7221e049bbdcbe6d5e6848 Mon Sep 17 00:00:00 2001 From: davidkao0902 Date: Thu, 11 Jun 2020 16:15:34 +0000 Subject: [PATCH 2/4] version change to 1.1 --- dispatch/static/manager/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dispatch/static/manager/package.json b/dispatch/static/manager/package.json index 95432f454..cb2ab5f94 100644 --- a/dispatch/static/manager/package.json +++ b/dispatch/static/manager/package.json @@ -1,6 +1,6 @@ { "name": "dispatch", - "version": "1.0.3", + "version": "1.1.0", "description": "The frontend framework for the Dispatch publishing platform.", "author": "Peter Siemens ", "homepage": "https://www.ubyssey.ca", From 7f719f0a8cfb18e7cf237017dbfba26225d08e0d Mon Sep 17 00:00:00 2001 From: davidkao0902 Date: Thu, 11 Jun 2020 16:27:55 +0000 Subject: [PATCH 3/4] version change --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6a9b4f2a4..28dd32801 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup(name='dispatch', - version='1.0.3', + version='1.1.0', description='A publishing platform for modern newspapers', url='https://github.com/ubyssey/dispatch', author='Peter Siemens', From a86d200b5b398cc558a48bc13f8b902914eae2d6 Mon Sep 17 00:00:00 2001 From: Keegan Landrigan Date: Thu, 11 Jun 2020 09:33:29 -0700 Subject: [PATCH 4/4] version var --> 1.10 --- dispatch/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dispatch/__init__.py b/dispatch/__init__.py index 1b6caa8e7..e9057461f 100644 --- a/dispatch/__init__.py +++ b/dispatch/__init__.py @@ -1,3 +1,3 @@ -__version__ = '1.0.3' +__version__ = '1.1.0'