private JSONObject getConfigurationForEditor() { try { JSONObject editorConfig = JsonUtils.createJSONObject(editorConfigJson); // configure extensions for (CKEditorPanelExtension extension : extensions) { extension.addConfiguration(editorConfig); } // always use the language of the current CMS locale final Locale locale = getLocale(); editorConfig.put(CKEditorConstants.CONFIG_LANGUAGE, locale.getLanguage()); // convert Hippo-specific 'declarative' keystrokes to numeric ones final JSONArray declarativeAndNumericKeystrokes = editorConfig.optJSONArray(CKEditorConstants.CONFIG_KEYSTROKES); final JSONArray numericKeystrokes = DeclarativeKeystrokesConverter.convertToNumericKeystrokes( declarativeAndNumericKeystrokes); editorConfig.putOpt(CKEditorConstants.CONFIG_KEYSTROKES, numericKeystrokes); // load the localized hippo styles if no other styles are specified JsonUtils.putIfAbsent( editorConfig, CKEditorConstants.CONFIG_STYLES_SET, HippoStyles.getConfigStyleSet(locale)); // disable custom config loading if not configured JsonUtils.putIfAbsent( editorConfig, CKEditorConstants.CONFIG_CUSTOM_CONFIG, StringUtils.EMPTY); if (log.isInfoEnabled()) { log.info( "CKEditor configuration:\n" + editorConfig.toString(LOGGED_EDITOR_CONFIG_INDENT_SPACES)); } return editorConfig; } catch (JSONException e) { throw new IllegalStateException("Error creating CKEditor configuration.", e); } }