Skip to content

Commit

Permalink
chore: import from @tiptap/react insteaf of @tiptap/core (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aslam97 authored Nov 1, 2024
1 parent f86a2dc commit c0369b1
Show file tree
Hide file tree
Showing 14 changed files with 229 additions and 215 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The Minimal Tiptap Editor is a lightweight, customizable rich text editor compon
1. Install the required packages:

```bash
npm install @tiptap/core @tiptap/extension-code-block-lowlight lowlight react-medium-image-zoom @tiptap/extension-color @tiptap/extension-heading @tiptap/extension-horizontal-rule @tiptap/extension-image @tiptap/extension-link @tiptap/extension-placeholder @tiptap/extension-text-style @tiptap/extension-typography @tiptap/pm @tiptap/react @tiptap/starter-kit
npm install @tiptap/extension-code-block-lowlight lowlight react-medium-image-zoom @tiptap/extension-color @tiptap/extension-heading @tiptap/extension-horizontal-rule @tiptap/extension-image @tiptap/extension-link @tiptap/extension-placeholder @tiptap/extension-text-style @tiptap/extension-typography @tiptap/pm @tiptap/react @tiptap/starter-kit
```

2. Set up the `TooltipProvider`:
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"format": "prettier --write ."
},
"dependencies": {
"@hookform/resolvers": "^3.9.0",
"@hookform/resolvers": "^3.9.1",
"@radix-ui/react-context-menu": "^2.2.2",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-icons": "^1.3.1",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-separator": "^1.1.0",
Expand All @@ -24,7 +24,6 @@
"@radix-ui/react-toggle": "^1.1.0",
"@radix-ui/react-toggle-group": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"@tiptap/core": "^2.9.1",
"@tiptap/extension-code-block-lowlight": "^2.9.1",
"@tiptap/extension-color": "^2.9.1",
"@tiptap/extension-heading": "^2.9.1",
Expand Down Expand Up @@ -56,7 +55,7 @@
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.15",
"@types/node": "^20.17.0",
"@types/node": "^20.17.5",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^7.18.0",
Expand Down
411 changes: 213 additions & 198 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { z } from 'zod'
import { cn } from './lib/utils'
import { Hero } from './components/custom/hero'
import { BentoMinimalTiptap } from './components/custom/types'
import type { Editor } from '@tiptap/core'
import type { Editor } from '@tiptap/react'
import { useCallback, useRef } from 'react'

export default function App() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Editor, Extension } from '@tiptap/core'
import { type Editor, Extension } from '@tiptap/react'
import { Plugin, PluginKey } from '@tiptap/pm/state'
import type { FileError, FileValidationOptions } from '../../utils'
import { filterFiles } from '../../utils'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import type { Editor } from '@tiptap/core'
import type { Editor } from '@tiptap/react'
import type { Node } from '@tiptap/pm/model'
import { isUrl } from '../../../utils'

Expand Down
2 changes: 1 addition & 1 deletion src/components/minimal-tiptap/extensions/image/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface CustomImageOptions extends ImageOptions, Omit<FileValidationOptions, '
onValidationError?: (errors: FileError[]) => void
}

declare module '@tiptap/core' {
declare module '@tiptap/react' {
interface Commands<ReturnType> {
setImages: {
setImages: (attrs: { src: string | File; alt?: string; title?: string }[]) => ReturnType
Expand Down
4 changes: 2 additions & 2 deletions src/components/minimal-tiptap/extensions/link/link.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mergeAttributes } from '@tiptap/core'
import { mergeAttributes } from '@tiptap/react'
import TiptapLink from '@tiptap/extension-link'
import type { EditorView } from '@tiptap/pm/view'
import { getMarkRange } from '@tiptap/core'
import { getMarkRange } from '@tiptap/react'
import { Plugin, TextSelection } from '@tiptap/pm/state'

export const Link = TiptapLink.extend({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Extension } from '@tiptap/core'
import { Extension } from '@tiptap/react'

export const ResetMarksOnEnter = Extension.create({
name: 'resetMarksOnEnter',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Extension } from '@tiptap/core'
import { Extension } from '@tiptap/react'
import { Plugin, PluginKey } from '@tiptap/pm/state'
import { Decoration, DecorationSet } from '@tiptap/pm/view'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Extension } from '@tiptap/core'
import { Extension } from '@tiptap/react'

export const UnsetAllMarks = Extension.create({
addKeyboardShortcuts() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/minimal-tiptap/hooks/use-minimal-tiptap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import type { Editor } from '@tiptap/core'
import type { Editor } from '@tiptap/react'
import type { Content, UseEditorOptions } from '@tiptap/react'
import { StarterKit } from '@tiptap/starter-kit'
import { useEditor } from '@tiptap/react'
Expand Down
2 changes: 1 addition & 1 deletion src/components/minimal-tiptap/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Editor } from '@tiptap/core'
import type { Editor } from '@tiptap/react'
import type { EditorView } from '@tiptap/pm/view'
import type { EditorState } from '@tiptap/pm/state'

Expand Down
2 changes: 1 addition & 1 deletion src/components/minimal-tiptap/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Editor } from '@tiptap/core'
import type { Editor } from '@tiptap/react'
import type { MinimalTiptapProps } from './minimal-tiptap'

type ShortcutKeyResult = {
Expand Down

0 comments on commit c0369b1

Please sign in to comment.