Skip to content

Commit

Permalink
Refactored toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
umerfaruk committed Mar 15, 2024
1 parent c32fa22 commit d824558
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 18 deletions.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import { ListPlugin } from '@lexical/react/LexicalListPlugin';
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
import {
$convertFromMarkdownString,
TRANSFORMERS,
} from '@lexical/markdown';
import { MarkdownShortcutPlugin } from '@lexical/react/LexicalMarkdownShortcutPlugin';
import {CAN_USE_DOM} from './utils/canUseDOM';

// ------------------------------------------------------
import ToolbarPlugin from "./plugins/toolbar";
import ToolbarPlugin from "./plugins/toolbarPlugin";
import AutoLinkPlugin from './plugins/autoLink.Plugin';
import { HorizontalRulePlugin } from './plugins/horizontalRulePlugin';
import LinkPlugin from './plugins/link.Plugin';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { Button, Dropdown, Space } from "antd";

// Local imports
import Icons from '../icons'
import Icons from '../../icons'
// ----------------------------------------------------------------
function AlignFormatDropDown({ editor, disabled = false, locale }) {
const items = [{
Expand Down Expand Up @@ -44,7 +44,6 @@ function AlignFormatDropDown({ editor, disabled = false, locale }) {
<Dropdown disabled={disabled} menu={{items}}>
<Button type="text" size="large" icon={<Icons.AlignLeft />}>
<Space>
{locale.resources.align}
<Icons.Down />
</Space>
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { $createHeadingNode, $createQuoteNode } from '@lexical/rich-text';
import { Button, Dropdown, Space } from "antd";

// Local imports
import Icons from '../icons'
import Icons from '../../icons'

// ----------------------------------------------------------------

Expand Down Expand Up @@ -180,11 +180,8 @@ function BlockFormatDropDown({
items,
}}>
<Button type="text" size="large" icon={selectedItem?.icon ?? <Icons.Paragraph />}>
<Space>
{selectedItem?.label ?? locale.resources.normal}
<Icons.Down />
</Space>
</Button>
</Button>
</Dropdown>
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Button, Dropdown, Select, Space } from "antd";
import Icons from '../icons';
import Icons from '../../icons';

// --------------------------------------------------

Expand Down
12 changes: 6 additions & 6 deletions src/plugins/toolbar.js → src/plugins/toolbarPlugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ import { useCallback, useEffect, useState } from "react";
import { Button, Divider, InputNumber, Tooltip } from "antd";
// -----------------------------------------------------------

import { sanitizeUrl } from '../utils/url';
import { getSelectedNode } from '../utils/getSelectedNode';
import { sanitizeUrl } from '../../utils/url';
import { getSelectedNode } from '../../utils/getSelectedNode';
import FontDropDown, { defaultFont } from "./fontDropdown";
import BlockFormatDropDown, { blockTypeToBlockName } from './blockFormatDropDown';
import InsertDropDown from "./insertDropDown";
import ToolsDropdown from "./toolsDropDown";
import Icons from '../icons'
import CheckButton from "../components/checkButton";
import Icons from '../../icons'
import CheckButton from "../../components/checkButton";
import AlignFormatDropDown from "./alignFormatDropDown";
import styles from "../styles.module.css";
import { SAVE_COMMAND } from '../commands/saveCommand';
import styles from "../../styles.module.css";
import { SAVE_COMMAND } from '../../commands/saveCommand';
// -----------------------------------------------------------

const ToolbarPlugin = ({ configuration, setIsLinkEditMode, locale }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {INSERT_HORIZONTAL_RULE_COMMAND} from '@lexical/react/LexicalHorizontalRu
// 3rd party
import { Button, Dropdown, Space } from "antd";
// local import
import Icons from "../icons";
import Icons from "../../icons";

// --------------------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { Fragment } from 'react';

import { AUTO_CORRECT_COMMAND, SPELLCHECK_COMMAND, PUNCTUATION_CORRECT_COMMAND } from '../commands/spellCheckCommand';
import { AUTO_CORRECT_COMMAND, SPELLCHECK_COMMAND, PUNCTUATION_CORRECT_COMMAND } from '../../commands/spellCheckCommand';

// 3rd party
import { Button, Dropdown, Space, Tooltip } from "antd";
// local import
import Icons from "../icons";
import Icons from "../../icons";

// --------------------------------------

Expand Down

0 comments on commit d824558

Please sign in to comment.