From 6f67ead7a34ea494bf08bb68bced93279c18c1fb Mon Sep 17 00:00:00 2001 From: Israel Date: Fri, 11 Oct 2024 10:07:21 -0300 Subject: [PATCH] refact: optimize and sort imports --- src/Megadraft.js | 6 ++-- src/components/ActionsProvider.js | 2 +- src/components/Dropdown.js | 6 ++-- src/components/DropdownItem.js | 4 +-- src/components/ErrorBoundary.js | 6 ++-- src/components/Media.js | 4 +-- src/components/MediaMessage.js | 2 +- src/components/MegadraftEditor.js | 30 +++++++++---------- src/components/ModalPluginItem.js | 2 +- src/components/MoveControl.js | 4 +-- src/components/Sidebar.js | 8 ++--- src/components/Toolbar.js | 8 ++--- src/components/ToolbarItem.js | 4 +-- src/components/plugin/BlockAction.js | 2 +- src/components/plugin/BlockActionGroup.js | 2 +- src/components/plugin/BlockContent.js | 2 +- src/components/plugin/BlockInput.js | 2 +- src/components/plugin/CommonBlock.js | 4 +-- src/decorators/defaultDecorator.js | 2 +- src/icons.js | 28 ++++++++--------- src/insertDataBlock.js | 8 ++--- src/plugins/image/plugin.js | 2 +- src/plugins/not-found/NotFoundBlock.js | 4 +-- src/plugins/video/plugin.js | 2 +- src/utils.js | 2 +- tests/components/Dropdown_test.js | 4 +-- tests/components/ErrorBoundary_test.js | 2 +- tests/components/LinkInput_test.js | 2 +- tests/components/MediaMessage_test.js | 2 +- tests/components/MediaWrapper_test.js | 2 +- tests/components/Media_test.js | 6 ++-- tests/components/MegadraftEditor_test.js | 10 +++---- tests/components/PluginsModal_test.js | 6 ++-- tests/components/Separator_test.js | 2 +- tests/components/modalpluginlist_test.js | 2 +- .../plugin/BlockActionGroup_test.js | 4 +-- tests/components/plugin/BlockAction_test.js | 4 +-- tests/components/plugin/BlockInput_test.js | 2 +- tests/components/plugin/CommonBlock_test.js | 4 +-- tests/components/plugin/NotFoundBlock_test.js | 4 +-- tests/components/sidebar_test.js | 20 ++++++------- tests/components/toolbar_test.js | 4 +-- tests/helpers/setup.js | 4 +-- tests/plugins/image/ImageBlock_test.js | 4 +-- tests/plugins/image/ImageButton_test.js | 2 +- website/components/docs.js | 8 ++--- website/components/example.js | 4 +-- website/components/menubar.js | 12 ++++---- website/components/toggleButton.js | 4 +-- website/index.js | 8 ++--- 50 files changed, 136 insertions(+), 136 deletions(-) diff --git a/src/Megadraft.js b/src/Megadraft.js index 54cf13b0..89994a27 100644 --- a/src/Megadraft.js +++ b/src/Megadraft.js @@ -6,14 +6,14 @@ import DraftJS from "draft-js"; -import insertDataBlock from "./insertDataBlock"; import Media from "./components/Media"; -import MegadraftEditor from "./components/MegadraftEditor"; -import MegadraftIcons from "./icons"; import MegadraftMediaMessage from "./components/MediaMessage"; +import MegadraftEditor from "./components/MegadraftEditor"; import * as MegadraftPlugin from "./components/plugin"; import Sidebar from "./components/Sidebar"; import Toolbar from "./components/Toolbar"; +import MegadraftIcons from "./icons"; +import insertDataBlock from "./insertDataBlock"; import * as utils from "./utils"; const Megadraft = { diff --git a/src/components/ActionsProvider.js b/src/components/ActionsProvider.js index fa96dd13..e904368c 100644 --- a/src/components/ActionsProvider.js +++ b/src/components/ActionsProvider.js @@ -4,8 +4,8 @@ * License: MIT */ -import React, { useContext } from "react"; import PropTypes from "prop-types"; +import React, { useContext } from "react"; export const defaultAction = () => {}; diff --git a/src/components/Dropdown.js b/src/components/Dropdown.js index 346276b4..235a2a1b 100644 --- a/src/components/Dropdown.js +++ b/src/components/Dropdown.js @@ -4,12 +4,12 @@ * License: MIT */ -import React, { useEffect, useRef, useState } from "react"; -import PropTypes from "prop-types"; import classNames from "classnames"; +import PropTypes from "prop-types"; +import React, { useEffect, useRef, useState } from "react"; -import DropdownItem from "./DropdownItem"; import icons from "../icons"; +import DropdownItem from "./DropdownItem"; const Dropdown = ({ items = [], selected, onChange }) => { const wrapperRef = useRef(null); diff --git a/src/components/DropdownItem.js b/src/components/DropdownItem.js index d0b2756a..1c3cc915 100644 --- a/src/components/DropdownItem.js +++ b/src/components/DropdownItem.js @@ -4,9 +4,9 @@ * License: MIT */ -import React from "react"; -import PropTypes from "prop-types"; import classNames from "classnames"; +import PropTypes from "prop-types"; +import React from "react"; export default function DropdownItem(props) { const Icon = props.item.icon; diff --git a/src/components/ErrorBoundary.js b/src/components/ErrorBoundary.js index 35fbd1a2..99a8ae77 100644 --- a/src/components/ErrorBoundary.js +++ b/src/components/ErrorBoundary.js @@ -6,10 +6,10 @@ import React, { Component } from "react"; -import { BlockContent, CommonBlock } from "./plugin"; -import MediaMessage from "./MediaMessage"; -import icons from "../icons"; import { replaceData } from "../i18n"; +import icons from "../icons"; +import MediaMessage from "./MediaMessage"; +import { BlockContent, CommonBlock } from "./plugin"; class ErrorBoundary extends Component { constructor(props) { diff --git a/src/components/Media.js b/src/components/Media.js index 1a150213..df05ccc8 100644 --- a/src/components/Media.js +++ b/src/components/Media.js @@ -4,8 +4,8 @@ * License: MIT */ -import React, { useMemo, useCallback } from "react"; -import { EditorState, SelectionState, Modifier } from "draft-js"; +import { EditorState, Modifier, SelectionState } from "draft-js"; +import React, { useCallback, useMemo } from "react"; import ErrorBoundary from "./ErrorBoundary"; import MediaWrapper from "./MediaWrapper"; diff --git a/src/components/MediaMessage.js b/src/components/MediaMessage.js index e550a372..e8027462 100644 --- a/src/components/MediaMessage.js +++ b/src/components/MediaMessage.js @@ -4,8 +4,8 @@ * License: MIT */ -import React from "react"; import classNames from "classnames"; +import React from "react"; const MediaMessage = ({ text, type }) => { if (text) { diff --git a/src/components/MegadraftEditor.js b/src/components/MegadraftEditor.js index 43ac644b..3f3aae17 100644 --- a/src/components/MegadraftEditor.js +++ b/src/components/MegadraftEditor.js @@ -19,31 +19,31 @@ return x; }; -import React, { Component } from "react"; import { + ContentBlock, + DefaultDraftBlockRenderMap, Editor, - RichUtils, - getDefaultKeyBinding, EditorState, - genKey, - ContentBlock, + RichUtils, SelectionState, - DefaultDraftBlockRenderMap + genKey, + getDefaultKeyBinding } from "draft-js"; import Immutable from "immutable"; +import React, { Component } from "react"; -import DefaultToolbar from "./Toolbar"; -import Sidebar from "./Sidebar"; -import Media from "./Media"; -import MoveControl from "./MoveControl"; -import MegadraftBlock from "./MegadraftBlock"; -import { swapDataUp, swapDataDown } from "../swapDataBlock"; -import i18nConfig from "../i18n"; -import notFoundPlugin from "../plugins/not-found/plugin"; -import DEFAULT_PLUGINS from "../plugins/default"; import DEFAULT_ACTIONS from "../actions/default"; import DEFAULT_ENTITY_INPUTS from "../entity_inputs/default"; +import i18nConfig from "../i18n"; +import DEFAULT_PLUGINS from "../plugins/default"; +import notFoundPlugin from "../plugins/not-found/plugin"; +import { swapDataDown, swapDataUp } from "../swapDataBlock"; import ActionsProvider, { defaultAction } from "./ActionsProvider"; +import Media from "./Media"; +import MegadraftBlock from "./MegadraftBlock"; +import MoveControl from "./MoveControl"; +import Sidebar from "./Sidebar"; +import DefaultToolbar from "./Toolbar"; const NO_RESET_STYLE_DEFAULT = ["ordered-list-item", "unordered-list-item"]; diff --git a/src/components/ModalPluginItem.js b/src/components/ModalPluginItem.js index 4e6ebbde..c8395f21 100644 --- a/src/components/ModalPluginItem.js +++ b/src/components/ModalPluginItem.js @@ -6,8 +6,8 @@ import React, { Component } from "react"; -import { ActionsContext } from "./ActionsProvider"; import { PLUGINS_MODAL_ADD_PLUGIN } from "../constants"; +import { ActionsContext } from "./ActionsProvider"; export default class ModalPluginItem extends Component { static contextType = ActionsContext; diff --git a/src/components/MoveControl.js b/src/components/MoveControl.js index d2512fb3..b62e1b75 100644 --- a/src/components/MoveControl.js +++ b/src/components/MoveControl.js @@ -4,12 +4,12 @@ * License: MIT */ -import React from "react"; import classNames from "classnames"; +import React from "react"; import icons from "../icons"; import MegadraftBlock from "./MegadraftBlock"; -import { BLOCK_SWAP_UP, BLOCK_SWAP_DOWN } from "../constants"; +import { BLOCK_SWAP_DOWN, BLOCK_SWAP_UP } from "../constants"; const Options = ({ onClickUp, diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js index fb329c17..9f46cdf8 100644 --- a/src/components/Sidebar.js +++ b/src/components/Sidebar.js @@ -4,24 +4,24 @@ * License: MIT */ +import classNames from "classnames"; import React, { Component } from "react"; import ReactDOM from "react-dom"; -import classNames from "classnames"; import icons from "../icons"; import { SIDEBAR_ADD_PLUGIN, + SIDEBAR_CLICK_MORE, SIDEBAR_EXPAND, - SIDEBAR_SHRINK, - SIDEBAR_CLICK_MORE + SIDEBAR_SHRINK } from "../constants"; import { ActionsContext } from "./ActionsProvider"; import "setimmediate"; -import PluginsModal from "./PluginsModal"; import { getSelectedBlockElement } from "../utils"; +import PluginsModal from "./PluginsModal"; class BlockStyles extends Component { static contextType = ActionsContext; diff --git a/src/components/Toolbar.js b/src/components/Toolbar.js index 43f72830..b29682cc 100644 --- a/src/components/Toolbar.js +++ b/src/components/Toolbar.js @@ -4,12 +4,12 @@ * License: MIT */ -import React, { Component } from "react"; -import PropTypes from "prop-types"; -import { EditorState, RichUtils } from "draft-js"; import classNames from "classnames"; -import ToolbarItem from "./ToolbarItem"; +import { EditorState, RichUtils } from "draft-js"; +import PropTypes from "prop-types"; +import React, { Component } from "react"; import { getSelectionCoords } from "../utils"; +import ToolbarItem from "./ToolbarItem"; export default class Toolbar extends Component { static defaultProps = { diff --git a/src/components/ToolbarItem.js b/src/components/ToolbarItem.js index cab2192f..f66d521f 100644 --- a/src/components/ToolbarItem.js +++ b/src/components/ToolbarItem.js @@ -4,9 +4,9 @@ * License: MIT */ -import React from "react"; -import PropTypes from "prop-types"; import classNames from "classnames"; +import PropTypes from "prop-types"; +import React from "react"; import Separator from "./Separator"; export default function ToolbarItem({ item, active, toggle }) { diff --git a/src/components/plugin/BlockAction.js b/src/components/plugin/BlockAction.js index a4a36c75..63d1900a 100644 --- a/src/components/plugin/BlockAction.js +++ b/src/components/plugin/BlockAction.js @@ -4,8 +4,8 @@ * License: MIT */ -import React from "react"; import PropTypes from "prop-types"; +import React from "react"; export default function BlockAction(props) { const Icon = props.item.icon; diff --git a/src/components/plugin/BlockActionGroup.js b/src/components/plugin/BlockActionGroup.js index bcdb90d6..21a4ffd9 100644 --- a/src/components/plugin/BlockActionGroup.js +++ b/src/components/plugin/BlockActionGroup.js @@ -4,8 +4,8 @@ * License: MIT */ -import React from "react"; import PropTypes from "prop-types"; +import React from "react"; import BlockAction from "./BlockAction"; diff --git a/src/components/plugin/BlockContent.js b/src/components/plugin/BlockContent.js index e1f6da7e..6df94aa8 100644 --- a/src/components/plugin/BlockContent.js +++ b/src/components/plugin/BlockContent.js @@ -4,8 +4,8 @@ * License: MIT */ -import React from "react"; import classNames from "classnames"; +import React from "react"; export default function BlockContent(props) { const className = classNames("block__content", { diff --git a/src/components/plugin/BlockInput.js b/src/components/plugin/BlockInput.js index 3a4cb358..730e2f8b 100644 --- a/src/components/plugin/BlockInput.js +++ b/src/components/plugin/BlockInput.js @@ -4,8 +4,8 @@ * License: MIT */ -import React from "react"; import classNames from "classnames"; +import React from "react"; import icons from "../../icons"; diff --git a/src/components/plugin/CommonBlock.js b/src/components/plugin/CommonBlock.js index 88070dc5..ad468824 100644 --- a/src/components/plugin/CommonBlock.js +++ b/src/components/plugin/CommonBlock.js @@ -13,8 +13,8 @@ import { BlockWrapper } from "../../components/plugin"; import { - DEFAULT_DISPLAY_OPTIONS, - DEFAULT_DISPLAY_KEY + DEFAULT_DISPLAY_KEY, + DEFAULT_DISPLAY_OPTIONS } from "../../components/plugin/defaults"; export default function CommonBlock(props) { diff --git a/src/decorators/defaultDecorator.js b/src/decorators/defaultDecorator.js index 241bb9b0..dd9c5fbc 100644 --- a/src/decorators/defaultDecorator.js +++ b/src/decorators/defaultDecorator.js @@ -5,8 +5,8 @@ */ import { CompositeDecorator } from "draft-js"; -import { createTypeStrategy } from "../utils"; import Link from "../components/Link"; +import { createTypeStrategy } from "../utils"; const decorator = new CompositeDecorator([ { diff --git a/src/icons.js b/src/icons.js index 74beef74..28efdfef 100644 --- a/src/icons.js +++ b/src/icons.js @@ -4,27 +4,27 @@ * License: MIT */ -import BoldIcon from "./icons/bold"; -import ItalicIcon from "./icons/italic"; -import ULIcon from "./icons/ul"; -import OLIcon from "./icons/ol"; -import H2Icon from "./icons/h2"; import BlockQuoteIcon from "./icons/blockquote"; -import LinkIcon from "./icons/link"; +import BoldIcon from "./icons/bold"; +import CloseIcon from "./icons/close"; +import CropIcon from "./icons/crop"; import CrossIcon from "./icons/cross"; -import ImageIcon from "./icons/image"; -import VideoIcon from "./icons/video"; -import EditIcon from "./icons/edit"; import DeleteIcon from "./icons/delete"; -import CropIcon from "./icons/crop"; +import DropdownArrow from "./icons/dropdownArrow"; +import EditIcon from "./icons/edit"; +import ErrorIcon from "./icons/error"; +import H2Icon from "./icons/h2"; +import ImageIcon from "./icons/image"; +import ItalicIcon from "./icons/italic"; +import LinkIcon from "./icons/link"; import MediaBigIcon from "./icons/mediaBig"; import MediaMediumIcon from "./icons/mediaMedium"; import MediaSmallIcon from "./icons/mediaSmall"; -import DropdownArrow from "./icons/dropdownArrow"; -import ErrorIcon from "./icons/error"; -import UnlinkIcon from "./icons/unlink"; -import CloseIcon from "./icons/close"; import MoreIcon from "./icons/more"; +import OLIcon from "./icons/ol"; +import ULIcon from "./icons/ul"; +import UnlinkIcon from "./icons/unlink"; +import VideoIcon from "./icons/video"; const icons = { BoldIcon, diff --git a/src/insertDataBlock.js b/src/insertDataBlock.js index 773ac45c..487fab53 100644 --- a/src/insertDataBlock.js +++ b/src/insertDataBlock.js @@ -15,11 +15,11 @@ import Immutable from "immutable"; import { - genKey, - EditorState, + BlockMapBuilder, ContentBlock, - Modifier, - BlockMapBuilder + EditorState, + genKey, + Modifier } from "draft-js"; const { List, Map } = Immutable; diff --git a/src/plugins/image/plugin.js b/src/plugins/image/plugin.js index f015d872..d6cb1a9b 100644 --- a/src/plugins/image/plugin.js +++ b/src/plugins/image/plugin.js @@ -4,8 +4,8 @@ * License: MIT */ -import ImageButton from "./ImageButton"; import ImageBlock from "./ImageBlock"; +import ImageButton from "./ImageButton"; export default { title: "Image", diff --git a/src/plugins/not-found/NotFoundBlock.js b/src/plugins/not-found/NotFoundBlock.js index 44aae75e..e789226e 100644 --- a/src/plugins/not-found/NotFoundBlock.js +++ b/src/plugins/not-found/NotFoundBlock.js @@ -6,10 +6,10 @@ import React from "react"; -import { BlockContent, CommonBlock } from "../../components/plugin"; import MediaMessage from "../../components/MediaMessage"; -import icons from "../../icons"; +import { BlockContent, CommonBlock } from "../../components/plugin"; import { replaceData } from "../../i18n"; +import icons from "../../icons"; export default function NotFoundBlock(props) { const { diff --git a/src/plugins/video/plugin.js b/src/plugins/video/plugin.js index a5dfd3ea..453bad19 100644 --- a/src/plugins/video/plugin.js +++ b/src/plugins/video/plugin.js @@ -4,8 +4,8 @@ * License: MIT */ -import VideoButton from "./VideoButton"; import VideoBlock from "./VideoBlock"; +import VideoButton from "./VideoButton"; export default { title: "Video", diff --git a/src/utils.js b/src/utils.js index 6c2eebde..0129011a 100644 --- a/src/utils.js +++ b/src/utils.js @@ -6,8 +6,8 @@ */ import { - convertToRaw, convertFromRaw, + convertToRaw, EditorState, getVisibleSelectionRect } from "draft-js"; diff --git a/tests/components/Dropdown_test.js b/tests/components/Dropdown_test.js index 6020e079..a74e6c9b 100644 --- a/tests/components/Dropdown_test.js +++ b/tests/components/Dropdown_test.js @@ -4,12 +4,12 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; -import icons from "../../src/icons"; import Dropdown from "../../src/components/Dropdown"; import DropdownItem from "../../src/components/DropdownItem"; +import icons from "../../src/icons"; describe("Dropdown Component", () => { let testContext; diff --git a/tests/components/ErrorBoundary_test.js b/tests/components/ErrorBoundary_test.js index bc5333e3..d052ed22 100644 --- a/tests/components/ErrorBoundary_test.js +++ b/tests/components/ErrorBoundary_test.js @@ -4,8 +4,8 @@ * License: MIT */ -import React from "react"; import { shallow } from "enzyme"; +import React from "react"; import ErrorBoundary from "../../src/components/ErrorBoundary"; import i18nConfig from "../../src/i18n"; diff --git a/tests/components/LinkInput_test.js b/tests/components/LinkInput_test.js index 6e5f1976..c8cad0cc 100644 --- a/tests/components/LinkInput_test.js +++ b/tests/components/LinkInput_test.js @@ -4,8 +4,8 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; import LinkInput from "../../src/entity_inputs/LinkInput"; import i18nConfig from "../../src/i18n"; diff --git a/tests/components/MediaMessage_test.js b/tests/components/MediaMessage_test.js index 84f08a10..99de5c5a 100644 --- a/tests/components/MediaMessage_test.js +++ b/tests/components/MediaMessage_test.js @@ -4,8 +4,8 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; import MediaMessage from "../../src/components/MediaMessage"; diff --git a/tests/components/MediaWrapper_test.js b/tests/components/MediaWrapper_test.js index 65738472..45ed8215 100644 --- a/tests/components/MediaWrapper_test.js +++ b/tests/components/MediaWrapper_test.js @@ -4,8 +4,8 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; import MediaWrapper from "../../src/components/MediaWrapper"; diff --git a/tests/components/Media_test.js b/tests/components/Media_test.js index 55f742d7..0c058295 100644 --- a/tests/components/Media_test.js +++ b/tests/components/Media_test.js @@ -4,13 +4,13 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; import Media from "../../src/components/Media"; -import { editorStateFromRaw } from "../../src/utils"; -import DEFAULT_PLUGINS from "../../src/plugins/default"; import i18nConfig from "../../src/i18n"; +import DEFAULT_PLUGINS from "../../src/plugins/default"; +import { editorStateFromRaw } from "../../src/utils"; import errorPlugin from "../../tests/plugins/error/plugin"; describe("Media Component", () => { diff --git a/tests/components/MegadraftEditor_test.js b/tests/components/MegadraftEditor_test.js index 7525cc78..20e9032c 100644 --- a/tests/components/MegadraftEditor_test.js +++ b/tests/components/MegadraftEditor_test.js @@ -4,19 +4,19 @@ * License: MIT */ -import React, { Component, useState } from "react"; import { Editor, EditorState, SelectionState } from "draft-js"; import { mount } from "enzyme"; +import React, { Component, useState } from "react"; -import MegadraftEditor from "../../src/components/MegadraftEditor"; import Media from "../../src/components/Media"; +import MegadraftEditor from "../../src/components/MegadraftEditor"; import Sidebar, { ToggleButton } from "../../src/components/Sidebar"; import Toolbar from "../../src/components/Toolbar"; -import { editorStateFromRaw } from "../../src/utils"; +import { BLOCK_SWAP_DOWN, BLOCK_SWAP_UP } from "../../src/constants"; +import i18nConfig from "../../src/i18n"; import image from "../../src/plugins/image/plugin"; import NotFoundPlugin from "../../src/plugins/not-found/plugin"; -import i18nConfig from "../../src/i18n"; -import { BLOCK_SWAP_UP, BLOCK_SWAP_DOWN } from "../../src/constants"; +import { editorStateFromRaw } from "../../src/utils"; const replaceSelection = (newSelection, wrapper, blockKey) => { const selectionState = SelectionState.createEmpty(blockKey); diff --git a/tests/components/PluginsModal_test.js b/tests/components/PluginsModal_test.js index ab7bfe76..9fdebab7 100644 --- a/tests/components/PluginsModal_test.js +++ b/tests/components/PluginsModal_test.js @@ -4,12 +4,12 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; -import image from "../../src/plugins/image/plugin"; -import PluginsModal from "../../src/components/PluginsModal"; import { ActionsContext } from "../../src/components/ActionsProvider"; +import PluginsModal from "../../src/components/PluginsModal"; +import image from "../../src/plugins/image/plugin"; describe("PluginsModal", () => { beforeEach(() => { diff --git a/tests/components/Separator_test.js b/tests/components/Separator_test.js index d672d6ca..81478a27 100644 --- a/tests/components/Separator_test.js +++ b/tests/components/Separator_test.js @@ -4,8 +4,8 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; import Separator from "../../src/components/Separator"; diff --git a/tests/components/modalpluginlist_test.js b/tests/components/modalpluginlist_test.js index 3eee4918..3288c284 100644 --- a/tests/components/modalpluginlist_test.js +++ b/tests/components/modalpluginlist_test.js @@ -4,8 +4,8 @@ * License: MIT */ -import React, { Component } from "react"; import { mount } from "enzyme"; +import React, { Component } from "react"; import cp from "utils-copy"; import { ModalBody } from "backstage-modal"; diff --git a/tests/components/plugin/BlockActionGroup_test.js b/tests/components/plugin/BlockActionGroup_test.js index ff55fc04..17904e00 100644 --- a/tests/components/plugin/BlockActionGroup_test.js +++ b/tests/components/plugin/BlockActionGroup_test.js @@ -4,13 +4,13 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; import icons from "../../../src/icons"; -import BlockActionGroup from "../../../src/components/plugin/BlockActionGroup"; import BlockAction from "../../../src/components/plugin/BlockAction"; +import BlockActionGroup from "../../../src/components/plugin/BlockActionGroup"; describe("BlockActionGroup Component", () => { let testContext; diff --git a/tests/components/plugin/BlockAction_test.js b/tests/components/plugin/BlockAction_test.js index fe4c2556..7e04120a 100644 --- a/tests/components/plugin/BlockAction_test.js +++ b/tests/components/plugin/BlockAction_test.js @@ -4,11 +4,11 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; -import icons from "../../../src/icons"; import BlockAction from "../../../src/components/plugin/BlockAction"; +import icons from "../../../src/icons"; describe("BlockAction Component", () => { let testContext; diff --git a/tests/components/plugin/BlockInput_test.js b/tests/components/plugin/BlockInput_test.js index b948a562..d7223db3 100644 --- a/tests/components/plugin/BlockInput_test.js +++ b/tests/components/plugin/BlockInput_test.js @@ -4,8 +4,8 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; import { BlockInput } from "../../../src/components/plugin"; diff --git a/tests/components/plugin/CommonBlock_test.js b/tests/components/plugin/CommonBlock_test.js index aae4c190..85c8c0a5 100644 --- a/tests/components/plugin/CommonBlock_test.js +++ b/tests/components/plugin/CommonBlock_test.js @@ -4,12 +4,12 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; -import icons from "../../../src/icons"; import Dropdown from "../../../src/components/Dropdown"; import CommonBlock from "../../../src/components/plugin/CommonBlock"; +import icons from "../../../src/icons"; describe("CommonBlock Component", () => { let testContext; diff --git a/tests/components/plugin/NotFoundBlock_test.js b/tests/components/plugin/NotFoundBlock_test.js index af372d26..fc49e001 100644 --- a/tests/components/plugin/NotFoundBlock_test.js +++ b/tests/components/plugin/NotFoundBlock_test.js @@ -4,11 +4,11 @@ * License: MIT */ -import React from "react"; import { shallow } from "enzyme"; +import React from "react"; +import i18nConfig from "../../../src/i18n"; import icons from "../../../src/icons"; import NotFoundBlock from "../../../src/plugins/not-found/NotFoundBlock"; -import i18nConfig from "../../../src/i18n"; describe("NotFoundBlock Component", () => { let testContext; diff --git a/tests/components/sidebar_test.js b/tests/components/sidebar_test.js index 4fd42fd1..ac66e7af 100644 --- a/tests/components/sidebar_test.js +++ b/tests/components/sidebar_test.js @@ -4,23 +4,23 @@ * License: MIT */ -import React, { Component } from "react"; import { mount } from "enzyme"; +import React, { Component } from "react"; import cp from "utils-copy"; -import i18nConfig from "../../src/i18n"; -import Sidebar, { ToggleButton, SideMenu } from "../../src/components/Sidebar"; import ActionsProvider from "../../src/components/ActionsProvider"; import PluginsModal from "../../src/components/PluginsModal"; -import image from "../../src/plugins/image/plugin"; -import { editorStateFromRaw } from "../../src/utils"; -import DEFAULT_PLUGINS from "../../src/plugins/default.js"; -import ImageButton from "../../src/plugins/image/ImageButton"; +import Sidebar, { SideMenu, ToggleButton } from "../../src/components/Sidebar"; import { - SIDEBAR_EXPAND, - SIDEBAR_SHRINK, + SIDEBAR_ADD_PLUGIN, SIDEBAR_CLICK_MORE, - SIDEBAR_ADD_PLUGIN + SIDEBAR_EXPAND, + SIDEBAR_SHRINK } from "../../src/constants"; +import i18nConfig from "../../src/i18n"; +import DEFAULT_PLUGINS from "../../src/plugins/default.js"; +import ImageButton from "../../src/plugins/image/ImageButton"; +import image from "../../src/plugins/image/plugin"; +import { editorStateFromRaw } from "../../src/utils"; class SidebarWrapper extends Component { constructor(props) { diff --git a/tests/components/toolbar_test.js b/tests/components/toolbar_test.js index 1fe386e4..144615d5 100644 --- a/tests/components/toolbar_test.js +++ b/tests/components/toolbar_test.js @@ -4,17 +4,17 @@ * License: MIT */ -import React, { Component } from "react"; import { EditorState, SelectionState } from "draft-js"; import { mount } from "enzyme"; +import React, { Component } from "react"; import Toolbar from "../../src/components/Toolbar"; import ToolbarItem from "../../src/components/ToolbarItem"; -import { editorStateFromRaw } from "../../src/utils"; import Separator from "../../src/components/Separator"; import LinkInput from "../../src/entity_inputs/LinkInput"; import i18nConfig from "../../src/i18n"; +import { editorStateFromRaw } from "../../src/utils"; export default class ToolbarWrapper extends Component { constructor(props) { diff --git a/tests/helpers/setup.js b/tests/helpers/setup.js index 34325014..01d61020 100644 --- a/tests/helpers/setup.js +++ b/tests/helpers/setup.js @@ -4,9 +4,9 @@ * License: MIT */ -import jsdom from "jsdom"; -import { configure } from "enzyme"; import Adapter from "@wojtekmaj/enzyme-adapter-react-17"; +import { configure } from "enzyme"; +import jsdom from "jsdom"; const { JSDOM } = jsdom; const dom = new JSDOM(""); diff --git a/tests/plugins/image/ImageBlock_test.js b/tests/plugins/image/ImageBlock_test.js index ae56e86d..871d1c04 100644 --- a/tests/plugins/image/ImageBlock_test.js +++ b/tests/plugins/image/ImageBlock_test.js @@ -4,11 +4,11 @@ * License: MIT */ -import React from "react"; import { mount } from "enzyme"; +import React from "react"; -import ImageBlock from "../../../src/plugins/image/ImageBlock"; import icons from "../../../src/icons"; +import ImageBlock from "../../../src/plugins/image/ImageBlock"; describe("ImageBlock", () => { let testContext; diff --git a/tests/plugins/image/ImageButton_test.js b/tests/plugins/image/ImageButton_test.js index 8aace4a1..2558d1c0 100644 --- a/tests/plugins/image/ImageButton_test.js +++ b/tests/plugins/image/ImageButton_test.js @@ -4,8 +4,8 @@ * License: MIT */ +import { mount, shallow } from "enzyme"; import React from "react"; -import { shallow, mount } from "enzyme"; import ImageButton from "../../../src/plugins/image/ImageButton"; import { editorStateFromRaw } from "../../../src/utils"; diff --git a/website/components/docs.js b/website/components/docs.js index b26a5352..2493923f 100644 --- a/website/components/docs.js +++ b/website/components/docs.js @@ -8,13 +8,13 @@ import React from "react"; import Scroll from "react-scroll"; import { StickyContainer } from "react-sticky"; -import MenuBar from "./menubar"; -import Overview from "../../docs/overview.md"; +import ReactMarkdown from "react-markdown"; +import CustomEntities from "../../docs/custom_entities.md"; import Customization from "../../docs/customization.md"; +import Overview from "../../docs/overview.md"; import Plugins from "../../docs/plugins.md"; import Serializing from "../../docs/serializing.md"; -import CustomEntities from "../../docs/custom_entities.md"; -import ReactMarkdown from "react-markdown"; +import MenuBar from "./menubar"; import { highlightCode } from "./highlightCode"; diff --git a/website/components/example.js b/website/components/example.js index 90ed6f20..51a45874 100644 --- a/website/components/example.js +++ b/website/components/example.js @@ -4,10 +4,10 @@ * License: MIT */ -import React, { useState, useEffect } from "react"; +import React, { useEffect, useState } from "react"; import { MegadraftEditor } from "../../src/Megadraft"; -import { editorStateToJSON, editorStateFromRaw } from "../../src/utils"; +import { editorStateFromRaw, editorStateToJSON } from "../../src/utils"; import { highlightCode } from "./highlightCode"; import INITIAL_CONTENT from "./contentExample"; diff --git a/website/components/menubar.js b/website/components/menubar.js index fbbe614b..82cbec5a 100644 --- a/website/components/menubar.js +++ b/website/components/menubar.js @@ -1,15 +1,15 @@ -import React, { useState, useRef } from "react"; -import { Sticky } from "react-sticky"; -import Scroll from "react-scroll"; +import React, { useRef, useState } from "react"; import { Link } from "react-router-dom"; +import Scroll from "react-scroll"; +import { Sticky } from "react-sticky"; +import Button from "@material-ui/core/Button"; import { common } from "@material-ui/core/colors"; -import Grid from "@material-ui/core/Grid"; -import MenuItem from "@material-ui/core/MenuItem"; import Divider from "@material-ui/core/Divider"; +import Grid from "@material-ui/core/Grid"; import Menu from "@material-ui/core/Menu"; +import MenuItem from "@material-ui/core/MenuItem"; import Toolbar from "@material-ui/core/Toolbar"; -import Button from "@material-ui/core/Button"; import { useCallback } from "react"; import { Burger } from "./icons/burger"; diff --git a/website/components/toggleButton.js b/website/components/toggleButton.js index 3d51d92b..45802e60 100644 --- a/website/components/toggleButton.js +++ b/website/components/toggleButton.js @@ -1,6 +1,6 @@ -import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; import Button from "@material-ui/core/Button"; +import { makeStyles } from "@material-ui/core/styles"; +import React from "react"; import { yellow } from "@material-ui/core/colors"; diff --git a/website/index.js b/website/index.js index 1ff8d17b..f45a5765 100644 --- a/website/index.js +++ b/website/index.js @@ -7,21 +7,21 @@ import React from "react"; import { createRoot } from "react-dom/client"; -import { hashHistory, Route, Switch, HashRouter } from "react-router-dom"; +import { hashHistory, HashRouter, Route, Switch } from "react-router-dom"; import Scroll from "react-scroll"; import { StickyContainer } from "react-sticky"; -import { ThemeProvider } from "@material-ui/styles"; import Grid from "@material-ui/core/Grid"; import { common } from "@material-ui/core/colors"; +import { ThemeProvider } from "@material-ui/styles"; -import MenuBar from "./components/menubar"; import Docs from "./components/docs"; -import theme from "./components/megadrafttheme"; import Example from "./components/example"; import Header from "./components/header"; import { highlightCode } from "./components/highlightCode"; import LetsRockArrow from "./components/icons/arrow-down"; +import theme from "./components/megadrafttheme"; +import MenuBar from "./components/menubar"; import ToggleButton from "./components/toggleButton"; const LinkScroll = Scroll.Link;