@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/lib/index.esm.js +1 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/DeleteWithi18nAction.tsx +6 -1
- package/src/actions/DuplicateWithi18nAction.tsx +11 -1
- package/src/actions/PublishWithi18nAction.ts +6 -1
- package/src/utils/getFlag.ts +3 -0
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ const DISABLED_REASON_TITLE = {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function createDeleteAction(pluginConfig: Ti18nConfig): DocumentActionComponent {
|
|
20
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|
package/src/utils/getFlag.ts
CHANGED