Skip to content

Commit

Permalink
feat: sub, superscripts and bullet fixes (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylengn committed Sep 17, 2024
1 parent 2263be7 commit 608bdd1
Show file tree
Hide file tree
Showing 18 changed files with 1,185 additions and 1,334 deletions.
364 changes: 184 additions & 180 deletions demo/package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions demo/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useEffect, useState } from 'react';
import DdocEditor from '../../package/ddoc-editor';
import { JSONContent } from '@tiptap/react';
import { Button, Tag, IconButton, LucideIcon } from '@fileverse/ui';
import { BadgeCheck } from 'lucide-react';

function App() {
const [enableCollaboration, setEnableCollaboration] = useState(false);
Expand Down Expand Up @@ -46,7 +45,7 @@ function App() {
Saved in local storage
</Tag>
<div className="w-6 h-6 rounded color-bg-secondary flex justify-center items-center border color-border-default xl:hidden">
<BadgeCheck size={16} color="#77818A" />
<LucideIcon name="BadgeCheck" size="sm" className="text-[#77818A]" />
</div>
</div>
<div className="flex gap-2">
Expand Down
1,398 changes: 683 additions & 715 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@fileverse-dev/ddoc",
"private": false,
"description": "DDoc",
"version": "2.0.3-patch-1",
"version": "2.0.3-patch-2",
"main": "dist/index.es.js",
"module": "dist/index.es.js",
"exports": {
Expand All @@ -28,7 +28,7 @@
"dependencies": {
"@_ueberdosis/prosemirror-tables": "^1.1.3",
"@aarkue/tiptap-math-extension": "^1.3.3",
"@fileverse/ui": "^4.1.1-patch-4",
"@fileverse/ui": "^4.1.1-patch-6",
"@radix-ui/react-focus-scope": "^1.1.0",
"@radix-ui/react-popover": "^1.0.7",
"@tippyjs/react": "^4.2.6",
Expand All @@ -47,6 +47,8 @@
"@tiptap/extension-link": "^2.5.4",
"@tiptap/extension-list-item": "^2.5.4",
"@tiptap/extension-placeholder": "^2.5.4",
"@tiptap/extension-subscript": "^2.5.4",
"@tiptap/extension-superscript": "^2.5.4",
"@tiptap/extension-task-item": "^2.5.4",
"@tiptap/extension-task-list": "^2.5.4",
"@tiptap/extension-text-align": "^2.5.4",
Expand All @@ -63,7 +65,6 @@
"ethers": "^6.13.1",
"framer-motion": "^11.2.12",
"katex": "^0.16.11",
"lucide-react": "^0.379.0",
"markdown-it-footnote": "^4.0.0",
"platform": "^1.3.6",
"prosemirror-model": "^1.21.0",
Expand Down
26 changes: 0 additions & 26 deletions package/common/icon.tsx

This file was deleted.

10 changes: 5 additions & 5 deletions package/components/color-selector.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LucideIcon } from '@fileverse/ui';
import { Editor } from '@tiptap/core';
import cx from 'classnames';
import { Check, ChevronDown } from 'lucide-react';
import cn from 'classnames';
import { Dispatch, FC, SetStateAction } from 'react';

export interface BubbleColorMenuItem {
Expand Down Expand Up @@ -66,7 +66,7 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
>
<span style={{ color: activeItem?.color || '#000000' }}>A</span>

<ChevronDown className="h-4 w-4 " />
<LucideIcon name="ChevronDown" size="sm" />
</button>

{isOpen && (
Expand All @@ -78,7 +78,7 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
editor.chain().focus().setColor(color).run();
setIsOpen(false);
}}
className={cx(
className={cn(
'flex items-center justify-between rounded-sm px-2 py-1 text-sm text-stone-600 hover:bg-stone-100',
{
'text-blue-600': editor.isActive('textStyle', { color }),
Expand All @@ -95,7 +95,7 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
<span>{name}</span>
</div>
{editor.isActive('textStyle', { color }) && (
<Check className="h-4 w-4" />
<LucideIcon name="Check" size="sm" />
)}
</button>
))}
Expand Down
12 changes: 12 additions & 0 deletions package/components/editor-bubble-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ export const EditorBubbleMenu = (props: EditorBubbleMenuProps) => {
command: () => props.editor.chain().focus().toggleStrike().run(),
icon: 'Strikethrough',
},
{
name: 'Superscript',
isActive: () => props.editor.isActive('superscript'),
command: () => props.editor.chain().focus().toggleSuperscript().run(),
icon: 'Superscript',
},
{
name: 'Subscript',
isActive: () => props.editor.isActive('subscript'),
command: () => props.editor.chain().focus().toggleSubscript().run(),
icon: 'Subscript',
},
{
name: 'Alignment',
isActive: () => toolVisibility === IEditorTool.ALIGNMENT,
Expand Down
5 changes: 2 additions & 3 deletions package/components/editor-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
} from './editor-utils';
import { Editor } from '@tiptap/react';
import { IEditorTool } from '../hooks/use-visibility';
import { ChevronDown } from 'lucide-react';
import {
Tooltip,
Divider,
Expand Down Expand Up @@ -169,7 +168,7 @@ const TiptapToolBar = ({
editor?.isActive('textStyle', { fontFamily: font.value }),
)?.title || 'Font'}
</span>
<ChevronDown size={16} />
<LucideIcon name="ChevronDown" size="sm" />
</button>
}
content={
Expand All @@ -196,7 +195,7 @@ const TiptapToolBar = ({
? 'Heading 3'
: 'Text'}
</span>
<ChevronDown size={16} />
<LucideIcon name="ChevronDown" size="sm" />
</button>
}
content={
Expand Down
Loading

0 comments on commit 608bdd1

Please sign in to comment.