Error when using portable text fields within sanity-plugin-internationalized-array
7 replies
Last updated: Aug 23, 2023
P
Error when using portable text (array of type block) fields within sanity-plugin-internationalized-array I am experiencing an error when editing formattable text within internationalized arrays. The studio runs and the fields appear without issues, but when editing the text I get the following error when attempting to edit the field:
I do not get any issues with string fields of type
internationalizedArrayString, so the problem seems related to the default portable text editor and that it may be incompatible with the internationalized array plugin. Do you know of any fixes or workarounds?
Uncaught error: Cannot resolve a Slate point from DOM point: [object Text]This is how the field is set up:
export const internationalizedArrayConfig = { languages, fieldTypes: [ 'string', defineField({ name: 'formattedText', type: 'array', of: [{type: 'block'}] }) ], } const plugins = [ internationalizedArray(internationalizedArrayConfig), ] // Inside the schema defineField({ name: "formattedTextField", title: "Weight example", type: "internationalizedArrayFormattedText", }),
internationalizedArrayString, so the problem seems related to the default portable text editor and that it may be incompatible with the internationalized array plugin. Do you know of any fixes or workarounds?
Aug 22, 2023, 3:26 PM
P
Hi! I'm using version 1.6.2 of the plugin, and Sanity version 3.14.4.
Here is the full dependency list:
Here is the full dependency list:
"dependencies": { "@sanity/document-internationalization": "^2.0.0", "@sanity/eslint-config-studio": "^2.0.1", "@sanity/orderable-document-list": "^1.0.4", "@sanity/ui": "^1.5.0", "@sanity/vision": "^3.12.0", "eslint": "^8.6.0", "lodash": "^4.17.21", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", "sanity": "^3.14.4", "sanity-plugin-internationalized-array": "^1.6.2", "sanity-plugin-workflow": "^1.0.1", "styled-components": "^5.2.0" },
Aug 22, 2023, 6:09 PM
P
That fixed it! I mistakenly thought I was using the latest version with "^1.6.2", but setting it to "1.10.1" fixed it. Thank you so much!
Aug 22, 2023, 6:38 PM
A
user M
I’m having the same user N
’s issue while trying to customize a richText field with renderInput. This is not related to s`anity-plugin-internationalized-array` in my case, while I’m usin`g @sanity/language-filter` for that. Any suggestion?
Aug 23, 2023, 3:55 PM
A
"dependencies": { "@dnd-kit/core": "^6.0.6", "@dnd-kit/sortable": "^7.0.1", "@dnd-kit/utilities": "^3.2.1", "@portabletext/to-html": "^1.0.4", "@sanity/cli": "^2.32.0", "@sanity/eslint-config-studio": "^2.0.0", "@sanity/language-filter": "^3.2.1", "@sanity/production-preview": "^2.29.3", "@sanity/schema": "^3.15.1", "@sanity/ui": "^1.7.8", "@sanity/vision": "^3.15.1", "algoliasearch": "^4.14.2", "cli-progress": "^3.11.2", "deepl-node": "^1.7.2", "dom-parser": "^0.1.6", "eslint": "^8.6.0", "htm": "^3.1.1", "jsdom": "^20.0.3", "json-to-ndjson": "^0.0.1", "node-fetch": "^2.6.7", "prop-types": "^15.8.1", "react": "^18.2.0", "react-country-flag": "^3.0.2", "react-dom": "^18.2.0", "react-icons": "^4.4.0", "react-instantsearch-hooks-web": "^6.32.1", "react-is": "^18.2.0", "sanity": "^3.15.1", "sanity-plugin-hotspot-array": "^1.0.1", "sanity-plugin-html-to-portable-text": "^0.0.7", "sanity-plugin-iframe-pane": "^1.1.1", "sanity-plugin-media": "^2.2.2", "slugify": "^1.6.5", "styled-components": "^5.2.0", "vhtml": "^2.2.0" }, "devDependencies": { "@sanity/types": "^2.31.1", "prettier": "^2.7.1" }
Aug 23, 2023, 3:58 PM
Sanity– build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.