@portabletext/plugin-paste-link 4.0.20 → 4.0.22

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.
Files changed (2) hide show
  1. package/README.md +12 -1
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@portabletext/plugin-paste-link`
2
2
 
3
- > Allows pasting links in the Portable Text Editor
3
+ > Allow pasting links in the Portable Text Editor
4
4
 
5
5
  ## Installation
6
6
 
@@ -69,6 +69,17 @@ You can customize the link annotation with the `link` prop:
69
69
  />
70
70
  ```
71
71
 
72
+ The `link` callback returns an annotation built from a `context.schema`
73
+ lookup (`context.schema.annotations.find(...)`) instead of a hardcoded type.
74
+ That lookup is what makes paste-link schema-aware: when the schema has no
75
+ matching annotation the callback returns `undefined` and pasting a URL falls
76
+ through to the default paste handling, so the plugin never adds an annotation
77
+ the schema does not declare. Because `context.schema` is resolved at the
78
+ caret, the same gating follows
79
+ [containers](../schema/README.md#containers-and-sub-schemas): the lookup sees
80
+ the container's sub-schema, so a link is only added where that container
81
+ actually allows it.
82
+
72
83
  ## Behaviors
73
84
 
74
85
  ### Paste URL on selected text
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@portabletext/plugin-paste-link",
3
- "version": "4.0.20",
4
- "description": "Allows pasting links in the Portable Text Editor",
3
+ "version": "4.0.22",
4
+ "description": "Allow pasting links in the Portable Text Editor",
5
5
  "keywords": [
6
6
  "portabletext",
7
7
  "plugin",
@@ -45,12 +45,12 @@
45
45
  "typescript": "5.9.3",
46
46
  "typescript-eslint": "^8.48.0",
47
47
  "vitest": "^4.1.8",
48
- "@portabletext/editor": "^7.6.1",
48
+ "@portabletext/editor": "^7.7.0",
49
49
  "racejar": "2.0.8"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": "^19.2",
53
- "@portabletext/editor": "^7.6.1"
53
+ "@portabletext/editor": "^7.7.0"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">=20.19 <22 || >=22.12"