Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core/fields/diffs): use new types in Portable-text-diffs
- Loading branch information
1 parent
f1152f7
commit b2aa1f2
Showing
6 changed files
with
70 additions
and
63 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
packages/sanity/src/core/field/types/portableText/diff/components/Annotation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 8 additions & 3 deletions
11
packages/sanity/src/core/field/types/portableText/diff/components/InlineObject.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 4 additions & 21 deletions
25
packages/sanity/src/core/field/types/portableText/diff/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,11 @@ | ||
import {ObjectSchemaType, SchemaType} from '@sanity/types' | ||
import {PortableTextTextBlock} from '@sanity/types' | ||
import {ObjectDiff} from '../../../types' | ||
|
||
export type PortableTextBlock = { | ||
_key: string | ||
_type: string | ||
children: PortableTextChild[] | ||
markDefs?: {_key: string; _type: string}[] | ||
style?: string | ||
export type PortableTextDiff = ObjectDiff & { | ||
displayValue: PortableTextTextBlock | ||
origin: ObjectDiff | ||
} | ||
|
||
export type PortableTextChild = { | ||
_key: string | ||
_type: string | ||
marks?: string[] | ||
text?: string | ||
} | ||
|
||
export type SpanTypeSchema = SchemaType & { | ||
decorators?: {title: string; value: string}[] | ||
annotations?: ObjectSchemaType[] | ||
} | ||
|
||
export type PortableTextDiff = ObjectDiff & {displayValue: PortableTextBlock; origin: ObjectDiff} | ||
|
||
export type MarkSymbolMap = Record<string, string[]> | ||
|
||
export type InlineSymbolMap = Record<string, string> |