@sanity/document-internationalization 1.0.5 → 1.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/document-internationalization",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "description": "Provides document level translations for Sanity Studio",
5
5
  "keywords": [
6
6
  "sanity",
@@ -17,7 +17,7 @@ const DISABLED_REASON_TITLE = {
17
17
  }
18
18
 
19
19
  export function createDeleteAction(pluginConfig: Ti18nConfig): DocumentActionComponent {
20
- return function DeleteWith18nAction({id, type, onComplete}): DocumentActionDescription {
20
+ const Action: DocumentActionComponent = ({id, type, onComplete}): DocumentActionDescription => {
21
21
  const toast = useToast()
22
22
  const client = useSanityClient()
23
23
  const config = useConfig(pluginConfig, type)
@@ -115,4 +115,9 @@ export function createDeleteAction(pluginConfig: Ti18nConfig): DocumentActionCom
115
115
  },
116
116
  }
117
117
  }
118
+
119
+ // Reset the `action` name for the newly created i18n action
120
+ Action.action = 'delete'
121
+
122
+ return Action
118
123
  }
@@ -24,7 +24,12 @@ const DISABLED_REASON_TITLE = {
24
24
  }
25
25
 
26
26
  export function createDuplicateAction(pluginConfig: Ti18nConfig): DocumentActionComponent {
27
- return ({id, type, draft, published}): DocumentActionDescription => {
27
+ const Action: DocumentActionComponent = ({
28
+ id,
29
+ type,
30
+ draft,
31
+ published,
32
+ }): DocumentActionDescription => {
28
33
  const toast = useToast()
29
34
  const client = useSanityClient()
30
35
  const config = useConfig(pluginConfig, type)
@@ -74,4 +79,9 @@ export function createDuplicateAction(pluginConfig: Ti18nConfig): DocumentAction
74
79
  onHandle: onDuplicate,
75
80
  }
76
81
  }
82
+
83
+ // Reset the `action` name for the newly created i18n action
84
+ Action.action = 'duplicate'
85
+
86
+ return Action
77
87
  }
@@ -10,7 +10,7 @@ import {IEditState, IUseDocumentOperationResult, Ti18nConfig} from '../types'
10
10
  import {useConfig, useDelayedFlag} from '../hooks'
11
11
 
12
12
  export function createPublishAction(pluginConfig: Ti18nConfig): DocumentActionComponent {
13
- return ({type, id, onComplete}): DocumentActionDescription => {
13
+ const Action: DocumentActionComponent = ({type, id, onComplete}): DocumentActionDescription => {
14
14
  const toast = useToast()
15
15
  const client = useSanityClient()
16
16
  const config = useConfig(pluginConfig, type)
@@ -115,4 +115,9 @@ export function createPublishAction(pluginConfig: Ti18nConfig): DocumentActionCo
115
115
  onHandle,
116
116
  }
117
117
  }
118
+
119
+ // Reset the `action` name for the newly created i18n action
120
+ Action.action = 'publish'
121
+
122
+ return Action
118
123
  }
@@ -31,6 +31,9 @@ export const getFlagCode = (code = ``): string => {
31
31
  // Return :flag-al: (Albania) for `sq` language code
32
32
  case `sq`:
33
33
  return `al`
34
+ // Return :flag-dk: for Danish
35
+ case 'da':
36
+ return 'dk'
34
37
 
35
38
  default:
36
39
  return code