@portabletext/plugin-one-line 1.0.0 → 1.0.2
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 +24 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
1
|
# One-Line Plugin
|
|
2
2
|
|
|
3
3
|
> 🤏 Restricts the Portable Text Editor to a single line
|
|
4
|
+
|
|
5
|
+
The plugin blocks `insert.break` events and provides smart handling of other `insert.*` events like `insert.block`.
|
|
6
|
+
|
|
7
|
+
Configure it with as high priority as possible to make sure other plugins don't overwrite `insert.*` events before this plugin gets a chance to do so.
|
|
8
|
+
|
|
9
|
+
Import the `OneLinePlugin` React component and place it inside the `EditorProvider` to automatically register the necessary Behaviors:
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import {
|
|
13
|
+
defineSchema,
|
|
14
|
+
EditorProvider,
|
|
15
|
+
PortableTextEditable,
|
|
16
|
+
} from '@portabletext/editor'
|
|
17
|
+
import {OneLinePlugin} from '@portabletext/plugin-one-line'
|
|
18
|
+
|
|
19
|
+
function App() {
|
|
20
|
+
return (
|
|
21
|
+
<EditorProvider initialConfig={{schemaDefinition: defineSchema({})}}>
|
|
22
|
+
<PortableTextEditable />
|
|
23
|
+
<OneLinePlugin />
|
|
24
|
+
</EditorProvider>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portabletext/plugin-one-line",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "🤏 Restricts the Portable Text Editor to a single line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portabletext",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@portabletext/editor": "^1.48.
|
|
41
|
+
"@portabletext/editor": "^1.48.4",
|
|
42
42
|
"@types/react": "^19.1.2",
|
|
43
43
|
"react": "^19.1.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@portabletext/editor": "^1.48.
|
|
46
|
+
"@portabletext/editor": "^1.48.4",
|
|
47
47
|
"react": "^19.1.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|