diff --git a/src-gwt/org/opencms/gwt/client/ui/input/tinymce/CmsTinyMCEHelper.java b/src-gwt/org/opencms/gwt/client/ui/input/tinymce/CmsTinyMCEHelper.java index 237df57c8fd..fcdce7c1d98 100644 --- a/src-gwt/org/opencms/gwt/client/ui/input/tinymce/CmsTinyMCEHelper.java +++ b/src-gwt/org/opencms/gwt/client/ui/input/tinymce/CmsTinyMCEHelper.java @@ -151,7 +151,9 @@ public static native JavaScriptObject generateOptionsForTiny(String configuratio options.valid_elements = "*[*]"; options.allow_script_urls = true; } - + if (config.link_default_protocol) { + options.link_default_protocol = config.link_default_protocol; + } if (config.toolbar_items) { toolbarGroup = @org.opencms.gwt.client.ui.input.tinymce.CmsTinyMCEHelper::createToolbar(Lcom/google/gwt/core/client/JavaScriptObject;)(config.toolbar_items); toolbarGroup += " | spellchecker"; diff --git a/src/org/opencms/widgets/CmsHtmlWidget.java b/src/org/opencms/widgets/CmsHtmlWidget.java index 13e84e87189..b7af471374b 100644 --- a/src/org/opencms/widgets/CmsHtmlWidget.java +++ b/src/org/opencms/widgets/CmsHtmlWidget.java @@ -215,6 +215,11 @@ public static JSONObject getJSONConfiguration( result.put("spellcheck_language", contentLocale.getLanguage()); } + String linkDefaultProtocol = widgetOptions.getLinkDefaultProtocol(); + if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(linkDefaultProtocol)) { + result.put("link_default_protocol", linkDefaultProtocol); + } + String editorOptions = widgetOptions.getEditorConfigPath(); if (editorOptions != null) { try { @@ -244,6 +249,7 @@ public static JSONObject getJSONConfiguration( e); } } + } catch (JSONException e) { LOG.error(e.getLocalizedMessage(), e); } diff --git a/src/org/opencms/widgets/CmsHtmlWidgetOption.java b/src/org/opencms/widgets/CmsHtmlWidgetOption.java index b2d67060eb2..94266c30a44 100644 --- a/src/org/opencms/widgets/CmsHtmlWidgetOption.java +++ b/src/org/opencms/widgets/CmsHtmlWidgetOption.java @@ -296,6 +296,9 @@ public class CmsHtmlWidgetOption { /** Option for the "show/hide visual control characters" button. */ public static final String OPTION_VISUALCHARS = "visualchars"; + /** Option for the default protocol for links */ + public static final String OPTION_LINKDEFAULTPROTOCOL = "linkdefaultprotocol:"; + /** The optional buttons that can be additionally added to the button bar. */ public static final String[] OPTIONAL_BUTTONS = { OPTION_ANCHOR, @@ -408,8 +411,12 @@ public class CmsHtmlWidgetOption { /** The style XML path. */ private String m_stylesXmlPath; + /** Path to an external TinyMCE JSON config file. */ private String m_editorConfigPath; + /** The link default protocol */ + private String m_linkDefaultProtocol; + /** * Creates a new empty HTML widget object object.
*/
@@ -508,6 +515,7 @@ public static String createConfigurationString(CmsHtmlWidgetOption option) {
result.append(option.getFormatSelectOptions());
added = true;
}
+
if (null != option.getEditorConfigPath()) {
if (added) {
result.append(DELIMITER_OPTION);
@@ -516,6 +524,12 @@ public static String createConfigurationString(CmsHtmlWidgetOption option) {
result.append(option.getEditorConfigPath());
added = true;
}
+
+ if (CmsStringUtil.isNotEmpty(option.getLinkDefaultProtocol())) {
+ result.append(OPTION_LINKDEFAULTPROTOCOL);
+ result.append(option.getLinkDefaultProtocol());
+ }
+
return result.toString();
}
@@ -863,6 +877,16 @@ public List
*
@@ -1055,6 +1079,17 @@ public void setHiddenButtons(List
*
@@ -1263,6 +1298,12 @@ protected void parseOptions(String configuration) {
m_importCss = true;
} else if (option.startsWith(OPTION_ALLOWSCRIPTS)) {
m_allowScripts = true;
+ } else if (option.startsWith(OPTION_LINKDEFAULTPROTOCOL)) {
+ // the link default protocol
+ option = option.substring(OPTION_LINKDEFAULTPROTOCOL.length());
+ if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(option)) {
+ setLinkDefaultProtocol(option);
+ }
} else {
// check if option describes an additional button
if (OPTIONAL_BUTTONS_LIST.contains(option)) {