@sanity/document-internationalization 0.3.7 → 0.3.9

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/LICENSE CHANGED
@@ -1,7 +1,10 @@
1
+ MIT License
2
+
1
3
  Copyright © 2020 Liam Martens
4
+ Copyright © 2022 Sanity.io
2
5
 
3
6
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
7
 
5
8
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
9
 
7
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,10 +1,7 @@
1
1
  # Document Internationalization Plugin for Sanity.io
2
2
 
3
- > **NOTE**
4
- >
5
- > This is the **Sanity Studio V2 version** of Document Internationalization Plugin.
6
- >
7
- > For the V3 version, please refer to the [v3-branch](https://github.com/sanity-io/document-internationalization/tree/v3).
3
+ >This is a **Sanity Studio v2** plugin.
4
+ > For the V3 version, please refer to the [v3-branch](https://github.com/sanity-io/document-internationalization).
8
5
 
9
6
  [![npm version](https://img.shields.io/npm/v/@sanity/document-internationalization.svg?style=flat)](https://www.npmjs.com/package/@sanity/document-internationalization)
10
7
 
@@ -43,11 +40,16 @@ A good use of field-level translation could be a `person` schema. It could have
43
40
 
44
41
  With the [Sanity CLI installed](https://www.sanity.io/docs/getting-started-with-sanity-cli), from the same directory as the Studio run:
45
42
 
46
- ```
47
- sanity install @sanity/document-internationalization
43
+ ```sh
44
+ yarn add @sanity/document-internationalization@studio-v2
48
45
  ```
49
46
 
50
- Ensure that `@sanity/document-internationalization` is listed in `plugins` inside `sanity.json`.
47
+ Next, add `"@sanity/document-internationalization"` to `sanity.json` plugins array:
48
+ ```json
49
+ "plugins": [
50
+ "@sanity/document-internationalization"
51
+ ]
52
+ ```
51
53
 
52
54
  The plugin is now installed, but you will need to complete the following steps to see the Document Translation UI:
53
55
 
@@ -4738,17 +4738,24 @@ var getFlagCode = function getFlagCode() {
4738
4738
 
4739
4739
  var _templateObject$2;
4740
4740
  var EmojiBox = styled__default["default"](ui.Box)(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral__default["default"](["\n min-width: 24px;\n transform: translateY(1px);\n"])));
4741
+
4742
+ function flagIcon(flagEmoji) {
4743
+ var flagHtml = twemoji.parse(flagEmoji !== null && flagEmoji !== void 0 ? flagEmoji : "\uD83C\uDDFA\uD83C\uDDF3", {
4744
+ folder: 'svg',
4745
+ ext: '.svg'
4746
+ }); // temporary fix because maxcdn has stopped supporting twemoji
4747
+ // https://github.com/twitter/twemoji/issues/580#issuecomment-1377111079
4748
+
4749
+ return htmlReactParser(flagHtml.replace('twemoji.maxcdn.com/v', 'cdnjs.cloudflare.com/ajax/libs/twemoji'));
4750
+ }
4751
+
4741
4752
  var SingleFlag = function SingleFlag(_ref) {
4742
4753
  var code = _ref.code,
4743
4754
  langCulture = _ref.langCulture;
4744
4755
  var flagEmoji = React.useMemo(function () {
4745
4756
  return code && getFlag(code);
4746
4757
  }, [code]);
4747
- var flagHtml = twemoji.parse(flagEmoji !== null && flagEmoji !== void 0 ? flagEmoji : "\uD83C\uDDFA\uD83C\uDDF3", {
4748
- folder: 'svg',
4749
- ext: '.svg'
4750
- });
4751
- var flagReact = htmlReactParser(flagHtml);
4758
+ var flagReact = flagIcon(flagEmoji);
4752
4759
  var CustomFlagComponent = React.useMemo(function () {
4753
4760
  if (langCulture && customFlagComponents__namespace) {
4754
4761
  var exportedName = langCulture.replace(/[^a-zA-Z0-9_]/g, '_');