@portabletext/editor 1.18.2 → 1.18.4
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/lib/behaviors/index.cjs +4 -11
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.js +4 -11
- package/lib/behaviors/index.js.map +1 -1
- package/lib/index.cjs +4 -10
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -2
- package/lib/index.d.ts +1 -2
- package/lib/index.js +4 -10
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/editor/define-schema.ts +1 -13
- package/src/utils/looks-like-url.test.ts +9 -3
- package/src/utils/looks-like-url.ts +5 -21
package/lib/index.d.cts
CHANGED
|
@@ -2,6 +2,7 @@ import {Patch} from '@portabletext/patches'
|
|
|
2
2
|
import type {
|
|
3
3
|
ArrayDefinition,
|
|
4
4
|
ArraySchemaType,
|
|
5
|
+
BlockDecoratorDefinition,
|
|
5
6
|
BlockListDefinition,
|
|
6
7
|
BlockStyleDefinition,
|
|
7
8
|
KeyedSegment,
|
|
@@ -11,7 +12,6 @@ import type {
|
|
|
11
12
|
TypedObject,
|
|
12
13
|
} from '@sanity/types'
|
|
13
14
|
import {
|
|
14
|
-
BlockDecoratorDefinition,
|
|
15
15
|
Path,
|
|
16
16
|
PortableTextBlock,
|
|
17
17
|
PortableTextChild,
|
|
@@ -86,7 +86,6 @@ export declare type AddedAnnotationPaths = {
|
|
|
86
86
|
export declare type BaseDefinition = {
|
|
87
87
|
name: string
|
|
88
88
|
title?: string
|
|
89
|
-
icon?: BlockDecoratorDefinition['icon']
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
/**
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {Patch} from '@portabletext/patches'
|
|
|
2
2
|
import type {
|
|
3
3
|
ArrayDefinition,
|
|
4
4
|
ArraySchemaType,
|
|
5
|
+
BlockDecoratorDefinition,
|
|
5
6
|
BlockListDefinition,
|
|
6
7
|
BlockStyleDefinition,
|
|
7
8
|
KeyedSegment,
|
|
@@ -11,7 +12,6 @@ import type {
|
|
|
11
12
|
TypedObject,
|
|
12
13
|
} from '@sanity/types'
|
|
13
14
|
import {
|
|
14
|
-
BlockDecoratorDefinition,
|
|
15
15
|
Path,
|
|
16
16
|
PortableTextBlock,
|
|
17
17
|
PortableTextChild,
|
|
@@ -86,7 +86,6 @@ export declare type AddedAnnotationPaths = {
|
|
|
86
86
|
export declare type BaseDefinition = {
|
|
87
87
|
name: string
|
|
88
88
|
title?: string
|
|
89
|
-
icon?: BlockDecoratorDefinition['icon']
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
/**
|
package/lib/index.js
CHANGED
|
@@ -87,13 +87,11 @@ function compileSchemaDefinition(definition) {
|
|
|
87
87
|
// fields to objects with the name `image`
|
|
88
88
|
name: blockObject.name === "image" ? "tmp-image" : blockObject.name,
|
|
89
89
|
title: blockObject.title,
|
|
90
|
-
icon: blockObject.icon,
|
|
91
90
|
fields: []
|
|
92
91
|
})) ?? [], inlineObjects = definition?.inlineObjects?.map((inlineObject) => defineType({
|
|
93
92
|
type: "object",
|
|
94
93
|
name: inlineObject.name,
|
|
95
94
|
title: inlineObject.title,
|
|
96
|
-
icon: inlineObject.icon,
|
|
97
95
|
fields: []
|
|
98
96
|
})) ?? [], portableTextSchema = defineField({
|
|
99
97
|
type: "array",
|
|
@@ -109,25 +107,21 @@ function compileSchemaDefinition(definition) {
|
|
|
109
107
|
marks: {
|
|
110
108
|
decorators: definition?.decorators?.map((decorator) => ({
|
|
111
109
|
title: decorator.title ?? startCase(decorator.name),
|
|
112
|
-
value: decorator.name
|
|
113
|
-
icon: decorator.icon
|
|
110
|
+
value: decorator.name
|
|
114
111
|
})) ?? [],
|
|
115
112
|
annotations: definition?.annotations?.map((annotation) => ({
|
|
116
113
|
name: annotation.name,
|
|
117
114
|
type: "object",
|
|
118
|
-
title: annotation.title
|
|
119
|
-
icon: annotation.icon
|
|
115
|
+
title: annotation.title
|
|
120
116
|
})) ?? []
|
|
121
117
|
},
|
|
122
118
|
lists: definition?.lists?.map((list) => ({
|
|
123
119
|
value: list.name,
|
|
124
|
-
title: list.title ?? startCase(list.name)
|
|
125
|
-
icon: list.icon
|
|
120
|
+
title: list.title ?? startCase(list.name)
|
|
126
121
|
})) ?? [],
|
|
127
122
|
styles: definition?.styles?.map((style) => ({
|
|
128
123
|
value: style.name,
|
|
129
|
-
title: style.title ?? startCase(style.name)
|
|
130
|
-
icon: style.icon
|
|
124
|
+
title: style.title ?? startCase(style.name)
|
|
131
125
|
})) ?? []
|
|
132
126
|
}]
|
|
133
127
|
}), schema = Schema.compile({
|