@thangph2146/nextjs-editor 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1999 -2011
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Trong `app/layout.tsx` hoặc `_app.tsx`:
|
|
|
26
26
|
import "@thangph2146/nextjs-editor/styles.css"
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
**Lưu ý:** Chỉ cần import file trên. Bạn **không** cần thêm `@source` hay cấu hình nào trong `globals.css`. Style editor được đóng gói sẵn, scope trong `#editor-x
|
|
29
|
+
**Lưu ý:** Chỉ cần import file trên. Bạn **không** cần thêm `@source` hay cấu hình nào trong `globals.css`. Style editor được đóng gói sẵn, scope trong `#editor-x` và **không bọc trong @layer** (unlayered). Để style editor không bị SCSS app ghi đè, nên import `styles.css` sau cùng (sau globals và SCSS của app).
|
|
30
30
|
|
|
31
31
|
### 2. Dùng component Editor (Client Component)
|
|
32
32
|
|
|
@@ -66,7 +66,7 @@ export function MyEditor() {
|
|
|
66
66
|
|
|
67
67
|
## Tránh SCSS/CSS của app ghi đè editor
|
|
68
68
|
|
|
69
|
-
Style editor được build **không bọc trong @layer** (unlayered)
|
|
69
|
+
Style editor được build **không bọc trong @layer** (unlayered). **Nên import `@thangph2146/nextjs-editor/styles.css` sau cùng** trong `layout.tsx` (sau globals và SCSS của app) để style editor có thứ tự load sau và dễ thắng khi specificity ngang nhau. App có thể ghi đè style editor nếu dùng selector cùng hoặc cao hơn specificity (vd. trùng `#editor-x` hoặc class trong scope).
|
|
70
70
|
|
|
71
71
|
Mọi style global/SCSS không nằm trong Tailwind cần nằm trong `@layer app`. **Lưu ý:** Trong Sass, `@use` không được phép bên trong `@layer`, nên không bọc trực tiếp nội dung có `@use` trong một block `@layer app { }`.
|
|
72
72
|
|
|
@@ -98,7 +98,7 @@ Tạo file `src/app/globals-app.css`:
|
|
|
98
98
|
|
|
99
99
|
Rồi trong `layout.tsx` import sau `globals.css`: `import "./globals-app.css"`. (Một số bundler có thể không compile `.scss` khi import từ `.css`.)
|
|
100
100
|
|
|
101
|
-
Sau khi cấu hình (nếu dùng), style
|
|
101
|
+
Sau khi cấu hình (nếu dùng), style editor (đã load khi import `@thangph2146/nextjs-editor/styles.css`) có thứ tự sau SCSS trong `@layer app`; cấu trúc Tailwind và theme của editor trong `#editor-x` có thể bị app ghi đè nếu selector app có specificity cao hơn.
|
|
102
102
|
|
|
103
103
|
## Cấu hình API thư viện ảnh
|
|
104
104
|
|
package/dist/index.cjs
CHANGED
|
@@ -33386,7 +33386,8 @@ function Editor({
|
|
|
33386
33386
|
{
|
|
33387
33387
|
ref: editorRef,
|
|
33388
33388
|
className: cn(
|
|
33389
|
-
"
|
|
33389
|
+
"w-full min-w-0",
|
|
33390
|
+
!readOnly && "bg-background rounded-lg shadow"
|
|
33390
33391
|
),
|
|
33391
33392
|
id: "editor-x",
|
|
33392
33393
|
children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(EditorContainerProvider, { value: { maxWidth: editorMaxWidth }, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|