From b31260a5010cb7ec56933173ff01cb397a8f39dd Mon Sep 17 00:00:00 2001 From: Thibaud Colas Date: Wed, 17 Jan 2018 10:57:56 +0200 Subject: [PATCH] Remove over-engineering index.js for Draftail sources folder --- client/src/components/Draftail/index.js | 13 +++++++++++-- client/src/components/Draftail/sources/index.js | 14 -------------- .../src/components/Draftail/sources/index.test.js | 7 ------- 3 files changed, 11 insertions(+), 23 deletions(-) delete mode 100644 client/src/components/Draftail/sources/index.js delete mode 100644 client/src/components/Draftail/sources/index.test.js diff --git a/client/src/components/Draftail/index.js b/client/src/components/Draftail/index.js index 7b86eafc82..f26efb9932 100644 --- a/client/src/components/Draftail/index.js +++ b/client/src/components/Draftail/index.js @@ -6,12 +6,16 @@ import { IS_IE11 } from '../../config/wagtailConfig'; import Icon from '../Icon/Icon'; -import sources from './sources'; import Link from './decorators/Link'; import Document from './decorators/Document'; import ImageBlock from './blocks/ImageBlock'; import EmbedBlock from './blocks/EmbedBlock'; +import LinkSource from './sources/LinkSource'; +import DocumentSource from './sources/DocumentSource'; +import ImageSource from './sources/ImageSource'; +import EmbedSource from './sources/EmbedSource'; + import registry from './registry'; const wrapWagtailIcon = type => { @@ -82,7 +86,12 @@ export const initEditor = (fieldName, options = {}) => { ReactDOM.render(editor, editorWrapper); }; -registry.registerSources(sources); +registry.registerSources({ + LinkSource, + DocumentSource, + ImageSource, + EmbedSource, +}); registry.registerDecorators({ Link, Document, diff --git a/client/src/components/Draftail/sources/index.js b/client/src/components/Draftail/sources/index.js deleted file mode 100644 index 0fe4cd0801..0000000000 --- a/client/src/components/Draftail/sources/index.js +++ /dev/null @@ -1,14 +0,0 @@ -import LinkSource from './LinkSource'; -import ImageSource from './ImageSource'; -import DocumentSource from './DocumentSource'; -import EmbedSource from './EmbedSource'; - -/** - * Mapping object from name to component. - */ -export default { - LinkSource, - ImageSource, - DocumentSource, - EmbedSource, -}; diff --git a/client/src/components/Draftail/sources/index.test.js b/client/src/components/Draftail/sources/index.test.js deleted file mode 100644 index 099d9228e4..0000000000 --- a/client/src/components/Draftail/sources/index.test.js +++ /dev/null @@ -1,7 +0,0 @@ -import sources from './index'; - -describe('sources', () => { - it('exists', () => { - expect(sources).toBeInstanceOf(Object); - }); -});