-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added package for tioptap image resize, slash cmd
- Loading branch information
0 parents
commit 9b122df
Showing
70 changed files
with
10,156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
build: | ||
name: Build and Check Exports | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
# To use Remote Caching, uncomment the next lines and follow the steps below. | ||
# env: | ||
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | ||
# TURBO_TEAM: ${{ vars.TURBO_TEAM }} | ||
# TURBO_REMOTE_ONLY: true | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- name: pnpm-setup | ||
uses: pnpm/action-setup@v2 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v4 | ||
|
||
- name: Install Dependencies | ||
run: pnpm install | ||
|
||
- name: Build And Check Exports | ||
run: pnpm run ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# Dependencies | ||
node_modules | ||
.pnp | ||
.pnp.js | ||
|
||
# Local env files | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# Testing | ||
coverage | ||
|
||
# Turbo | ||
.turbo | ||
|
||
# Vercel | ||
.vercel | ||
|
||
# Build Outputs | ||
.next/ | ||
out/ | ||
build | ||
dist | ||
|
||
|
||
# Debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Misc | ||
.DS_Store | ||
*.pem |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"eslint.workingDirectories": [ | ||
{ | ||
"mode": "auto" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
|
||
# Tiptap Extensions | ||
|
||
Tiptap extensions and headless components for image nodes and a slash command for React.js | ||
|
||
## @harshtalks/tiptap-image | ||
|
||
It extends tiptap image extension to support image resizing and alignment. | ||
Existing third party/unofficial plugins are not flexible. | ||
This package contains - | ||
1. UI headless components to render alignment menu in a bubble menu. | ||
2. Image extension extended from tiptap-extension-image to support resizing and alignment out of the box | ||
|
||
It supports both useEditor hook and EditorProvider from tiptap. | ||
|
||
|
||
## Installation | ||
|
||
Install my-project with npm | ||
|
||
```bash | ||
pnpm add @harshtalks/tiptap-image | ||
``` | ||
|
||
You can use npm, bun, or yarn etc. | ||
|
||
## Usage | ||
|
||
```tsx | ||
"use client"; | ||
|
||
import { useEditor, EditorContent } from "@tiptap/react"; | ||
import StarterKit from "@tiptap/starter-kit"; | ||
import { ImageExtension, ImageAligner } from "@harshtalks/tiptap-image"; | ||
import "./globals.css"; | ||
import { useCallback } from "react"; | ||
|
||
export default function Home() { | ||
const editor = useEditor({ | ||
extensions: [StarterKit, ImageExtension], | ||
content: | ||
"<p>This is a basic example of implementing images. Drag to re-order.</p>", | ||
}); | ||
|
||
const addImage = useCallback(() => { | ||
const url = window.prompt("URL"); | ||
|
||
if (url) { | ||
editor?.chain().focus().setImage({ src: url }).run(); | ||
} | ||
}, [editor]); | ||
|
||
if (!editor) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="p-12"> | ||
<button type="button" onClick={addImage}> | ||
Add Image | ||
</button> | ||
|
||
<div> | ||
<ImageAligner.Root editor={editor}> | ||
<ImageAligner.AlignMenu> | ||
<ImageAligner.Items className="bg-white flex items-center border text-white rounded p-4"> | ||
<ImageAligner.Item alignment="left">Left Align</ImageAligner.Item> | ||
<ImageAligner.Item alignment="center"> | ||
Center Align | ||
</ImageAligner.Item> | ||
<ImageAligner.Item alignment="right"> | ||
Right Align | ||
</ImageAligner.Item> | ||
</ImageAligner.Items> | ||
</ImageAligner.AlignMenu> | ||
</ImageAligner.Root> | ||
</div> | ||
|
||
<EditorContent className="p-8 border rounded-md" editor={editor} /> | ||
</div> | ||
); | ||
} | ||
|
||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["next/core-web-vitals", "next/typescript"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
.yarn/install-state.gz | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# tiptap-extensions-demo | ||
|
||
## 0.1.12 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- @harshtalks/tiptap-image@1.0.1 | ||
|
||
## 0.1.11 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- @harshtalks/tiptap-image@0.0.1 | ||
|
||
## 0.1.10 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- @harshtalks/tiptap-image@0.0.2 | ||
- @harshtalks/tiptap-slash@0.0.2 | ||
|
||
## 0.1.9 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- @harshtalks/tiptap-image@0.0.1 | ||
- @harshtalks/tiptap-slash@0.0.1 | ||
|
||
## 0.1.8 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- @harshtalks/tiptap-image@1.0.1 | ||
- @harshtalks/tiptap-slash@1.0.1 | ||
|
||
## 0.1.7 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- Updated dependencies | ||
- Updated dependencies | ||
- @harshtalks/tiptap-image@0.5.0 | ||
- @harshtalks/tiptap-slash@0.4.0 | ||
|
||
## 0.1.6 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- Updated dependencies | ||
- @harshtalks/tiptap-image@0.4.0 | ||
- @harshtalks/tiptap-slash@0.3.0 | ||
|
||
## 0.1.5 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- @harshtalks/tiptap-slash@0.2.0 | ||
|
||
## 0.1.4 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- Updated dependencies | ||
- @harshtalks/tiptap-image@0.3.0 | ||
- @harshtalks/tiptap-slash@0.1.0 | ||
|
||
## 0.1.3 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- Updated dependencies | ||
- @harshtalks/tiptap-image@0.2.0 | ||
- @harshtalks/tiptap-slash@0.2.0 | ||
|
||
## 0.1.2 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- Updated dependencies | ||
- @harshtalks/tiptap-image@0.1.0 | ||
- @harshtalks/tiptap-slash@0.1.0 | ||
|
||
## 0.1.1 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- Updated dependencies | ||
- @harshtalks/tiptap-image@3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). | ||
|
||
## Getting Started | ||
|
||
First, run the development server: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
# or | ||
pnpm dev | ||
# or | ||
bun dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. | ||
|
||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. | ||
|
||
## Learn More | ||
|
||
To learn more about Next.js, take a look at the following resources: | ||
|
||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
|
||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! | ||
|
||
## Deploy on Vercel | ||
|
||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
|
||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "tiptap-extensions-demo", | ||
"version": "0.1.12", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint" | ||
}, | ||
"dependencies": { | ||
"@harshtalks/image-tiptap": "workspace:*", | ||
"@harshtalks/slash-tiptap": "workspace:*", | ||
"@tailwindcss/typography": "^0.5.15", | ||
"@tiptap/extension-placeholder": "^2.7.2", | ||
"@tiptap/pm": "^2.7.2", | ||
"@tiptap/react": "^2.7.2", | ||
"@tiptap/starter-kit": "^2.7.2", | ||
"next": "14.2.13", | ||
"react": "^18", | ||
"react-dom": "^18" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"eslint": "^8", | ||
"eslint-config-next": "14.2.13", | ||
"postcss": "^8", | ||
"tailwindcss": "^3.4.1", | ||
"typescript": "^5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** @type {import('postcss-load-config').Config} */ | ||
const config = { | ||
plugins: { | ||
tailwindcss: {}, | ||
}, | ||
}; | ||
|
||
export default config; |
Oops, something went wrong.