Skip to content

Commit

Permalink
fix(lib): add translatable as part of the plugin payload
Browse files Browse the repository at this point in the history
  • Loading branch information
BibiSebi committed Feb 20, 2024
1 parent d576fe4 commit d24fb14
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type FieldPluginData<Content> = {
blockUid: string | undefined
token: string | undefined
uid: string
translatable: boolean
releases: Release[]
releaseId: number | undefined
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const pluginStateFromStateChangeMessage = <Content>(
blockUid: message.blockId ?? undefined,
token: message.token ?? undefined,
options: recordFromFieldPluginOptions(message.schema.options),
translatable: message.schema.translatable ?? false,
uid: message.uid ?? undefined,
content: validateResult.content,
isModalOpen: message.isModalOpen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { hasKey } from '../../../utils'
export type FieldPluginSchema = {
field_type: string
options: FieldPluginOption[]
translatable: boolean
}

export type FieldPluginOption = { name: string; value: string }
Expand All @@ -21,4 +22,6 @@ export const isFieldPluginSchema = (it: unknown): it is FieldPluginSchema =>
typeof it.field_type === 'string' &&
hasKey(it, 'options') &&
Array.isArray(it.options) &&
it.options.every(isFieldPluginOption)
it.options.every(isFieldPluginOption) &&
hasKey(it, 'translatable') &&
typeof it.translatable === 'boolean'

0 comments on commit d24fb14

Please sign in to comment.