@madebywild/sanity-link-field 1.0.0 → 1.0.1
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 +8 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
Sanity object field for internal, external, email, phone, and file links.
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
## Install
|
|
10
9
|
|
|
11
10
|
```bash
|
|
@@ -15,23 +14,23 @@ pnpm add @madebywild/sanity-link-field
|
|
|
15
14
|
## Configure Plugin
|
|
16
15
|
|
|
17
16
|
```ts
|
|
17
|
+
import { defineConfig } from "sanity";
|
|
18
18
|
import { wildSanityLinkFieldPlugin } from "@madebywild/sanity-link-field";
|
|
19
19
|
|
|
20
20
|
export default defineConfig({
|
|
21
21
|
plugins: [
|
|
22
22
|
wildSanityLinkFieldPlugin({
|
|
23
23
|
internalLinkSchemaTypes: [{ type: "page" }, { type: "post" }],
|
|
24
|
-
// Defaults to true.
|
|
25
24
|
weakReferences: true,
|
|
26
|
-
//
|
|
25
|
+
// `true`/`false` or object form.
|
|
27
26
|
sectionTarget: {
|
|
28
27
|
enabled: true,
|
|
29
28
|
query: `
|
|
30
29
|
*[_id == $pageId][0]{
|
|
31
|
-
"sections": array::compact(
|
|
30
|
+
"sections": array::compact(pageBuilder.sectionsArray[]{
|
|
32
31
|
"value": _key,
|
|
33
|
-
"label": coalesce(
|
|
34
|
-
})
|
|
32
|
+
"label": coalesce(sectionSettings.sectionTitle, _type),
|
|
33
|
+
})
|
|
35
34
|
}.sections
|
|
36
35
|
`,
|
|
37
36
|
},
|
|
@@ -43,6 +42,7 @@ export default defineConfig({
|
|
|
43
42
|
## Use in Schema
|
|
44
43
|
|
|
45
44
|
```ts
|
|
45
|
+
import { defineField } from "sanity";
|
|
46
46
|
import { requireLink } from "@madebywild/sanity-link-field";
|
|
47
47
|
|
|
48
48
|
defineField({
|
|
@@ -50,8 +50,8 @@ defineField({
|
|
|
50
50
|
type: "wild.link",
|
|
51
51
|
options: {
|
|
52
52
|
extensions: {
|
|
53
|
-
//
|
|
54
|
-
customText: true,
|
|
53
|
+
// `true` or { enabled: true/false }
|
|
54
|
+
customText: { enabled: true },
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
validation: (R) => requireLink(R),
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madebywild/sanity-link-field",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"license": "
|
|
6
|
+
"license": "MIT",
|
|
7
7
|
"browserslist": "extends @sanity/browserslist-config",
|
|
8
8
|
"exports": {
|
|
9
9
|
"./package.json": "./package.json",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"change-case": "^5.4.4",
|
|
25
|
-
"@madebywild/sanity-utils": "1.0.
|
|
25
|
+
"@madebywild/sanity-utils": "1.0.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@sanity/ui": "^3.1",
|