@@ -11,34 +11,35 @@ import { stripRichTextPartSelection } from "./stripRichTextTextPartSelection";
1111
1212function getRichTextComponentConfigFragment (
1313 sourceRichTextComponentConfig : RichTextComponentConfig ,
14- editorContext : EditorContextType
14+ focussedField : EditorContextType [ "focussedField" ] ,
15+ locale : EditorContextType [ "contextParams" ] [ "locale" ] ,
16+ formValues : EditorContextType [ "form" ] [ "values" ] ,
17+ definitions : EditorContextType [ "definitions" ]
1518) : RichTextComponentConfig & {
1619 _itemProps ?: Record < string , unknown > ;
1720} {
18- const { focussedField, form, contextParams } = editorContext ;
19-
2021 const newRichTextComponentConfig : RichTextComponentConfig = {
2122 ...sourceRichTextComponentConfig ,
2223 elements : {
23- [ contextParams . locale ] : [ ] ,
24+ [ locale ] : [ ] ,
2425 } ,
2526 } ;
2627
2728 focussedField . forEach ( ( focusedField ) => {
2829 const textPartConfig : RichTextPartComponentConfig = get (
29- form . values ,
30+ formValues ,
3031 stripRichTextPartSelection ( focusedField )
3132 ) ;
3233
3334 const { path, range } = parseFocusedRichTextPartConfigPath ( focusedField ) ;
3435
35- const newTextPartConfig = duplicateConfig ( textPartConfig , editorContext ) ;
36+ const newTextPartConfig = duplicateConfig ( textPartConfig , definitions ) ;
3637
3738 if ( range ) {
3839 newTextPartConfig . value = textPartConfig . value . slice ( ...range ) ;
3940 }
4041
41- let lastParentConfigPath = `elements.${ contextParams . locale } ` ;
42+ let lastParentConfigPath = `elements.${ locale } ` ;
4243
4344 path . slice ( 0 , - 1 ) . forEach ( ( pathIndex , index ) => {
4445 let currentConfigPath = lastParentConfigPath ;
0 commit comments