@sanity/document-internationalization 0.3.2 → 0.3.3
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/CHANGELOG.md +3 -0
- package/README.md +2 -1
- package/lib/language-select/index.js +14 -12
- package/lib/language-select/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v0.3.3
|
|
4
|
+
* Fixes [#59](https://github.com/sanity-io/document-internationalization/issues/59) - Missing `_weak` field in base reference
|
|
5
|
+
|
|
3
6
|
## v0.1.7
|
|
4
7
|
* For base I18n documents the default "Delete" action will now be replaced with the Delete (incl. translations)" action. The default "Delete" action does not make sense for base documents in any scenario as it results in broken references.
|
|
5
8
|
|
package/README.md
CHANGED
|
@@ -62,7 +62,8 @@ The plugin is now installed, but you will need to complete the following steps t
|
|
|
62
62
|
4. [GraphQL support](docs/graphql-intl-doc.md)
|
|
63
63
|
5. [Advanced languages](docs/advanced-languages.md)
|
|
64
64
|
6. [Usage with custom publish action](docs/usage-with-custom-publish.md)
|
|
65
|
-
7. [
|
|
65
|
+
7. [If you don't see the plugin document actions](docs/usage-with-custom-publish.md#add-additional-actions)
|
|
66
|
+
8. [GROQ query examples](/docs/groq-query-examples.md)
|
|
66
67
|
|
|
67
68
|
## Migrating from sanity-plugin-intl-input
|
|
68
69
|
|
|
@@ -5375,7 +5375,7 @@ var LanguageSelectListItem = function LanguageSelectListItem(_ref5) {
|
|
|
5375
5375
|
routerContext.navigateUrl(href);
|
|
5376
5376
|
}, [routerContext, routerPanesState, groupIndex]);
|
|
5377
5377
|
var handleCreateClick = React__default["default"].useCallback( /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
5378
|
-
var baseDocument, langFieldName, referencesFieldName, baseFieldName;
|
|
5378
|
+
var baseDocument, langFieldName, referencesFieldName, baseFieldName, referenceBehavior;
|
|
5379
5379
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
5380
5380
|
while (1) {
|
|
5381
5381
|
switch (_context.prev = _context.next) {
|
|
@@ -5386,16 +5386,18 @@ var LanguageSelectListItem = function LanguageSelectListItem(_ref5) {
|
|
|
5386
5386
|
langFieldName = config.fieldNames.lang;
|
|
5387
5387
|
referencesFieldName = config.fieldNames.references;
|
|
5388
5388
|
baseFieldName = config.fieldNames.baseReference;
|
|
5389
|
-
|
|
5389
|
+
referenceBehavior = config.referenceBehavior;
|
|
5390
|
+
_context.next = 9;
|
|
5390
5391
|
return getSanityClient().createIfNotExists(_objectSpread$2(_objectSpread$2({
|
|
5391
5392
|
_id: "drafts.".concat(translatedId),
|
|
5392
5393
|
_type: currentDocumentType
|
|
5393
5394
|
}, baseDocument ? objectOmit(baseDocument, ["_id", "_type", referencesFieldName]) : {}), {}, _defineProperty__default["default"]({}, langFieldName, language.id), baseDocument !== null && baseDocument !== void 0 && baseDocument._id ? _defineProperty__default["default"]({}, baseFieldName, {
|
|
5394
5395
|
_type: 'reference',
|
|
5395
|
-
_ref: baseDocument._id.replace("drafts.*", "")
|
|
5396
|
+
_ref: baseDocument._id.replace("drafts.*", ""),
|
|
5397
|
+
_weak: referenceBehavior === 'weak'
|
|
5396
5398
|
}) : {}));
|
|
5397
5399
|
|
|
5398
|
-
case
|
|
5400
|
+
case 9:
|
|
5399
5401
|
toast.push({
|
|
5400
5402
|
closable: true,
|
|
5401
5403
|
status: 'success',
|
|
@@ -5403,11 +5405,11 @@ var LanguageSelectListItem = function LanguageSelectListItem(_ref5) {
|
|
|
5403
5405
|
description: baseLanguage ? UiMessages.translationCreatedToast.description(baseLanguage.title) : undefined
|
|
5404
5406
|
});
|
|
5405
5407
|
openDocumentInCurrentPane(translatedId, currentDocumentType);
|
|
5406
|
-
_context.next =
|
|
5408
|
+
_context.next = 16;
|
|
5407
5409
|
break;
|
|
5408
5410
|
|
|
5409
|
-
case
|
|
5410
|
-
_context.prev =
|
|
5411
|
+
case 13:
|
|
5412
|
+
_context.prev = 13;
|
|
5411
5413
|
_context.t0 = _context["catch"](0);
|
|
5412
5414
|
toast.push({
|
|
5413
5415
|
closable: true,
|
|
@@ -5415,17 +5417,17 @@ var LanguageSelectListItem = function LanguageSelectListItem(_ref5) {
|
|
|
5415
5417
|
title: _context.t0.toString()
|
|
5416
5418
|
});
|
|
5417
5419
|
|
|
5418
|
-
case
|
|
5419
|
-
_context.prev =
|
|
5420
|
+
case 16:
|
|
5421
|
+
_context.prev = 16;
|
|
5420
5422
|
setPending(false);
|
|
5421
|
-
return _context.finish(
|
|
5423
|
+
return _context.finish(16);
|
|
5422
5424
|
|
|
5423
|
-
case
|
|
5425
|
+
case 19:
|
|
5424
5426
|
case "end":
|
|
5425
5427
|
return _context.stop();
|
|
5426
5428
|
}
|
|
5427
5429
|
}
|
|
5428
|
-
}, _callee, null, [[0,
|
|
5430
|
+
}, _callee, null, [[0, 13, 16, 19]]);
|
|
5429
5431
|
})), [baseDocumentEditState.draft, baseDocumentEditState.published, config.fieldNames.lang, config.fieldNames.references, config.fieldNames.baseReference, translatedId, currentDocumentType, language.id, language.title, toast, baseLanguage, openDocumentInCurrentPane]);
|
|
5430
5432
|
var handleOpenClick = React__default["default"].useCallback(function () {
|
|
5431
5433
|
openDocumentInCurrentPane(translatedId, currentDocumentType);
|