@opensaas/stack-tiptap 0.39.2 → 0.40.0
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/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +6 -0
- package/dist/components/TiptapField.d.ts.map +1 -1
- package/dist/components/TiptapField.js +0 -2
- package/dist/config/types.d.ts +5 -15
- package/dist/config/types.d.ts.map +1 -1
- package/dist/fields/richText.d.ts.map +1 -1
- package/dist/fields/richText.js +3 -5
- package/package.json +3 -3
- package/src/components/TiptapField.tsx +0 -5
- package/src/config/types.ts +5 -15
- package/src/fields/richText.ts +3 -5
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
> @opensaas/stack-tiptap@0.
|
|
2
|
+
> @opensaas/stack-tiptap@0.40.0 build /home/runner/work/stack/stack/packages/tiptap
|
|
3
3
|
> tsc && npm run copy:css
|
|
4
4
|
|
|
5
5
|
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
|
|
6
6
|
npm warn Unknown env config "npm-globalconfig". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
|
|
7
7
|
npm warn Unknown env config "_jsr-registry". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
|
|
8
8
|
|
|
9
|
-
> @opensaas/stack-tiptap@0.
|
|
9
|
+
> @opensaas/stack-tiptap@0.40.0 copy:css
|
|
10
10
|
> mkdir -p dist/styles && cp src/styles/tiptap.css dist/styles/
|
|
11
11
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @opensaas/stack-tiptap
|
|
2
2
|
|
|
3
|
+
## 0.40.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#973](https://github.com/OpenSaasAU/stack/pull/973) [`8f76533`](https://github.com/OpenSaasAU/stack/commit/8f765333e3067c741c69f535927cc82115c60ed1) Thanks [@borisno2](https://github.com/borisno2)! - Comment cleanup only, no behavior change: removed restating/narration comments, kept TSDoc on public config options and field builders, and kept external API/behavior constraint notes (Prisma, S3, Vercel Blob, Keystone parity, Next.js SSR, Zod).
|
|
8
|
+
|
|
3
9
|
## 0.39.2
|
|
4
10
|
|
|
5
11
|
## 0.39.1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TiptapField.d.ts","sourceRoot":"","sources":["../../src/components/TiptapField.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA4B,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAI1E,OAAO,sBAAsB,CAAA;AAE7B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAA;IAClC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAA;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAa,EACb,WAAgC,EAChC,SAAe,EACf,SAAS,GACV,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"TiptapField.d.ts","sourceRoot":"","sources":["../../src/components/TiptapField.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA4B,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAI1E,OAAO,sBAAsB,CAAA;AAE7B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAA;IAClC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAA;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAa,EACb,WAAgC,EAChC,SAAe,EACf,SAAS,GACV,EAAE,gBAAgB,2CAqJlB"}
|
|
@@ -37,13 +37,11 @@ export function TiptapField({ name, value, onChange, label, error, disabled, req
|
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
|
-
// Update content when value changes externally
|
|
41
40
|
useEffect(() => {
|
|
42
41
|
if (editor && value !== editor.getJSON()) {
|
|
43
42
|
editor.commands.setContent(value || '');
|
|
44
43
|
}
|
|
45
44
|
}, [editor, value]);
|
|
46
|
-
// Update editable state when mode or disabled changes
|
|
47
45
|
useEffect(() => {
|
|
48
46
|
if (editor) {
|
|
49
47
|
editor.setEditable(isEditable);
|
package/dist/config/types.d.ts
CHANGED
|
@@ -9,25 +9,15 @@ export type RichTextField<TTypeInfo extends TypeInfo = TypeInfo> = BaseFieldConf
|
|
|
9
9
|
isRequired?: boolean;
|
|
10
10
|
};
|
|
11
11
|
ui?: {
|
|
12
|
-
/**
|
|
13
|
-
* Placeholder text for empty editor
|
|
14
|
-
*/
|
|
12
|
+
/** Placeholder text for empty editor */
|
|
15
13
|
placeholder?: string;
|
|
16
|
-
/**
|
|
17
|
-
* Minimum height for editor in pixels
|
|
18
|
-
*/
|
|
14
|
+
/** Minimum height for editor in pixels */
|
|
19
15
|
minHeight?: number;
|
|
20
|
-
/**
|
|
21
|
-
* Maximum height for editor in pixels
|
|
22
|
-
*/
|
|
16
|
+
/** Maximum height for editor in pixels */
|
|
23
17
|
maxHeight?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Custom React component to render this field
|
|
26
|
-
*/
|
|
18
|
+
/** Custom React component to render this field */
|
|
27
19
|
component?: any;
|
|
28
|
-
/**
|
|
29
|
-
* Custom field type name to use from the global registry
|
|
30
|
-
*/
|
|
20
|
+
/** Custom field type name to use from the global registry */
|
|
31
21
|
fieldType?: string;
|
|
32
22
|
};
|
|
33
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAE5E;;;GAGG;AACH,MAAM,MAAM,aAAa,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,IAAI,eAAe,CAAC,SAAS,CAAC,GAAG;IAC9F,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,CAAC,EAAE;QACX,UAAU,CAAC,EAAE,OAAO,CAAA;KACrB,CAAA;IACD,EAAE,CAAC,EAAE;QACH
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAE5E;;;GAGG;AACH,MAAM,MAAM,aAAa,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,IAAI,eAAe,CAAC,SAAS,CAAC,GAAG;IAC9F,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,CAAC,EAAE;QACX,UAAU,CAAC,EAAE,OAAO,CAAA;KACrB,CAAA;IACD,EAAE,CAAC,EAAE;QACH,wCAAwC;QACxC,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,0CAA0C;QAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,0CAA0C;QAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,kDAAkD;QAElD,SAAS,CAAC,EAAE,GAAG,CAAA;QACf,6DAA6D;QAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.d.ts","sourceRoot":"","sources":["../../src/fields/richText.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"richText.d.ts","sourceRoot":"","sources":["../../src/fields/richText.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,aAAa,CAsC7E"}
|
package/dist/fields/richText.js
CHANGED
|
@@ -25,19 +25,17 @@ export function richText(options) {
|
|
|
25
25
|
getZodSchema: (fieldName, operation) => {
|
|
26
26
|
const validation = options?.validation;
|
|
27
27
|
const isRequired = validation?.isRequired;
|
|
28
|
-
//
|
|
29
|
-
// Tiptap outputs JSONContent which is a complex nested structure
|
|
28
|
+
// Tiptap emits a complex nested JSONContent structure; accept any valid JSON.
|
|
30
29
|
const baseSchema = z.any();
|
|
31
30
|
if (isRequired && operation === 'create') {
|
|
32
|
-
//
|
|
31
|
+
// Reject undefined on create.
|
|
33
32
|
return baseSchema;
|
|
34
33
|
}
|
|
35
34
|
else if (isRequired && operation === 'update') {
|
|
36
|
-
//
|
|
35
|
+
// Allow undefined on update (partial updates).
|
|
37
36
|
return z.union([baseSchema, z.undefined()]);
|
|
38
37
|
}
|
|
39
38
|
else {
|
|
40
|
-
// Not required
|
|
41
39
|
return baseSchema.optional();
|
|
42
40
|
}
|
|
43
41
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensaas/stack-tiptap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"description": "Tiptap rich text editor integration for OpenSaas Stack",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"react": "^19.2.8",
|
|
57
57
|
"react-dom": "^19.2.8",
|
|
58
58
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
59
|
-
"@opensaas/stack-core": "0.
|
|
60
|
-
"@opensaas/stack-ui": "0.
|
|
59
|
+
"@opensaas/stack-core": "0.40.0",
|
|
60
|
+
"@opensaas/stack-ui": "0.40.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "tsc && npm run copy:css",
|
|
@@ -66,14 +66,12 @@ export function TiptapField({
|
|
|
66
66
|
},
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
-
// Update content when value changes externally
|
|
70
69
|
useEffect(() => {
|
|
71
70
|
if (editor && value !== editor.getJSON()) {
|
|
72
71
|
editor.commands.setContent(value || '')
|
|
73
72
|
}
|
|
74
73
|
}, [editor, value])
|
|
75
74
|
|
|
76
|
-
// Update editable state when mode or disabled changes
|
|
77
75
|
useEffect(() => {
|
|
78
76
|
if (editor) {
|
|
79
77
|
editor.setEditable(isEditable)
|
|
@@ -98,9 +96,7 @@ export function TiptapField({
|
|
|
98
96
|
{required && <span className="text-destructive">*</span>}
|
|
99
97
|
</label>
|
|
100
98
|
|
|
101
|
-
{/* Editor with toolbar */}
|
|
102
99
|
<div className={`tiptap-editor ${error ? 'border-destructive' : ''}`}>
|
|
103
|
-
{/* Toolbar */}
|
|
104
100
|
{isEditable && editor && (
|
|
105
101
|
<div className="tiptap-toolbar">
|
|
106
102
|
<button
|
|
@@ -174,7 +170,6 @@ export function TiptapField({
|
|
|
174
170
|
</div>
|
|
175
171
|
)}
|
|
176
172
|
|
|
177
|
-
{/* Editor content */}
|
|
178
173
|
<div
|
|
179
174
|
className={disabled ? 'opacity-50 cursor-not-allowed' : ''}
|
|
180
175
|
style={{
|
package/src/config/types.ts
CHANGED
|
@@ -10,26 +10,16 @@ export type RichTextField<TTypeInfo extends TypeInfo = TypeInfo> = BaseFieldConf
|
|
|
10
10
|
isRequired?: boolean
|
|
11
11
|
}
|
|
12
12
|
ui?: {
|
|
13
|
-
/**
|
|
14
|
-
* Placeholder text for empty editor
|
|
15
|
-
*/
|
|
13
|
+
/** Placeholder text for empty editor */
|
|
16
14
|
placeholder?: string
|
|
17
|
-
/**
|
|
18
|
-
* Minimum height for editor in pixels
|
|
19
|
-
*/
|
|
15
|
+
/** Minimum height for editor in pixels */
|
|
20
16
|
minHeight?: number
|
|
21
|
-
/**
|
|
22
|
-
* Maximum height for editor in pixels
|
|
23
|
-
*/
|
|
17
|
+
/** Maximum height for editor in pixels */
|
|
24
18
|
maxHeight?: number
|
|
25
|
-
/**
|
|
26
|
-
* Custom React component to render this field
|
|
27
|
-
*/
|
|
19
|
+
/** Custom React component to render this field */
|
|
28
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
21
|
component?: any
|
|
30
|
-
/**
|
|
31
|
-
* Custom field type name to use from the global registry
|
|
32
|
-
*/
|
|
22
|
+
/** Custom field type name to use from the global registry */
|
|
33
23
|
fieldType?: string
|
|
34
24
|
}
|
|
35
25
|
}
|
package/src/fields/richText.ts
CHANGED
|
@@ -28,18 +28,16 @@ export function richText(options?: Omit<RichTextField, 'type'>): RichTextField {
|
|
|
28
28
|
const validation = options?.validation
|
|
29
29
|
const isRequired = validation?.isRequired
|
|
30
30
|
|
|
31
|
-
//
|
|
32
|
-
// Tiptap outputs JSONContent which is a complex nested structure
|
|
31
|
+
// Tiptap emits a complex nested JSONContent structure; accept any valid JSON.
|
|
33
32
|
const baseSchema = z.any()
|
|
34
33
|
|
|
35
34
|
if (isRequired && operation === 'create') {
|
|
36
|
-
//
|
|
35
|
+
// Reject undefined on create.
|
|
37
36
|
return baseSchema
|
|
38
37
|
} else if (isRequired && operation === 'update') {
|
|
39
|
-
//
|
|
38
|
+
// Allow undefined on update (partial updates).
|
|
40
39
|
return z.union([baseSchema, z.undefined()])
|
|
41
40
|
} else {
|
|
42
|
-
// Not required
|
|
43
41
|
return baseSchema.optional()
|
|
44
42
|
}
|
|
45
43
|
},
|