| 180 | |
| 181 | // If the value is a map, keys can be customized via config. |
| 182 | getKeys(field) { |
| 183 | const defaults = { |
| 184 | code: 'code', |
| 185 | lang: 'lang', |
| 186 | }; |
| 187 | |
| 188 | // Force default keys if widget is an editor component code block. |
| 189 | if (this.props.isEditorComponent) { |
| 190 | return defaults; |
| 191 | } |
| 192 | |
| 193 | const keys = field.get('keys', Map()).toJS(); |
| 194 | return { ...defaults, ...keys }; |
| 195 | } |
| 196 | |
| 197 | // Determine if the persisted value is a map rather than a plain string. A map |
| 198 | // value allows both the code string and the language to be persisted. |