Skip to content

Commit 890a767

Browse files
authored
Upgrade component to work with React 19
2 parents c137b7b + 6db8902 commit 890a767

File tree

6 files changed

+1029
-833
lines changed

6 files changed

+1029
-833
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ on:
77
branches: [main]
88

99
env:
10-
NODE_VERSION: "18"
10+
NODE_VERSION: "20"
1111

1212
jobs:
1313
full-code-check:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Full-check repository
17-
uses: actions/checkout@v3
18-
- uses: actions/setup-node@v2.5.1
17+
uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
1919
with:
2020
node-version: ${{ env.NODE_VERSION }}
2121
check-latest: true

.github/workflows/docs.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
name: Docs build and deploy
2-
on:
3-
push
4-
# paths: ["src/**"] # Trigger the action only when files change in the folders defined here
2+
on: push
3+
4+
env:
5+
NODE_VERSION: "20"
6+
57
jobs:
68
build-and-deploy:
79
runs-on: ubuntu-latest
@@ -10,6 +12,11 @@ jobs:
1012
uses: actions/checkout@v4
1113
with:
1214
persist-credentials: false
15+
- name: Setup Node.js 📦
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: ${{ env.NODE_VERSION }}
19+
check-latest: true
1320
- name: Install and Build 🔧
1421
run: | # Install packages and build the demo project
1522
yarn install

lib/ContentEditable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ const ContentEditable: React.FC<ContentEditableProps> = ({
268268
return (
269269
<div
270270
className={containerClassName}
271-
style={{ display: "flex", alignItems: "center" }}
271+
style={{ display: "flex", alignItems: "center", position: "relative" }}
272272
>
273273
<div
274274
ref={divRef}
@@ -280,7 +280,7 @@ const ContentEditable: React.FC<ContentEditableProps> = ({
280280
aria-label={placeholder ?? ""}
281281
className={contentEditableClassName}
282282
style={{
283-
padding: "calc((1.5rem * 1.3125)/2) 0 calc((1.5rem * 1.3125)/2) 1rem",
283+
padding: "0.85rem",
284284
overflow: "auto",
285285
height: "auto",
286286
textAlign: "initial",

package.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-basic-contenteditable",
3-
"description": "React 18 contenteditable component. Super-customizable!",
4-
"version": "1.0.2",
3+
"description": "React contenteditable component. Super-customizable!",
4+
"version": "1.0.3",
55
"type": "module",
66
"main": "dist/main.js",
77
"types": "dist/main.d.ts",
@@ -40,20 +40,21 @@
4040
"react-dom": "^18.2.0"
4141
},
4242
"devDependencies": {
43-
"@types/node": "^20.11.17",
44-
"@types/react": "^18.2.55",
45-
"@types/react-dom": "^18.2.19",
46-
"@typescript-eslint/eslint-plugin": "^6.21.0",
47-
"@typescript-eslint/parser": "^6.21.0",
48-
"@vitejs/plugin-react-swc": "^3.5.0",
43+
"@types/node": "^22.10.2",
44+
"@types/react": "^19.0.2",
45+
"@types/react-dom": "^19.0.2",
46+
"@typescript-eslint/eslint-plugin": "^8.18.2",
47+
"@typescript-eslint/parser": "^8.18.2",
48+
"@vitejs/plugin-react-swc": "^3.7.2",
4949
"eslint": "^8.56.0",
5050
"eslint-plugin-react-hooks": "^4.6.0",
51-
"eslint-plugin-react-refresh": "^0.4.5",
52-
"react": "^18.2.0",
53-
"react-dom": "^18.2.0",
54-
"typescript": "^5.2.2",
55-
"vite": "^5.1.0",
56-
"vite-plugin-dts": "^3.7.2"
51+
"eslint-plugin-react-refresh": "^0.4.16",
52+
"glob": "^11.0.0",
53+
"react": "^19.0.0",
54+
"react-dom": "^19.0.0",
55+
"typescript": "^5.7.2",
56+
"vite": "^6.0.6",
57+
"vite-plugin-dts": "^4.4.0"
5758
},
5859
"bugs": {
5960
"url": "https://github.com/ChrisUser/react-basic-contenteditable/issues"

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from "vite"
22
import { extname, relative, resolve } from "path"
33
import { fileURLToPath } from "node:url"
4-
import glob from "glob"
4+
import { glob } from "glob"
55
import react from "@vitejs/plugin-react-swc"
66
import dts from "vite-plugin-dts"
77

0 commit comments

Comments
 (0)