From 62951986aec54df1599e9f988afd9f62379c6b3b Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 3 Feb 2021 14:14:22 +0100 Subject: [PATCH] Add break_title option for link widget in order to be able to break link's title into new line based on a given delimiter --- api/js/etemplate/et2_widget_link.js | 9 +++++++++ api/js/etemplate/et2_widget_link.ts | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/api/js/etemplate/et2_widget_link.js b/api/js/etemplate/et2_widget_link.js index da5eccf582..d08436c5db 100644 --- a/api/js/etemplate/et2_widget_link.js +++ b/api/js/etemplate/et2_widget_link.js @@ -24,6 +24,7 @@ var __extends = (this && this.__extends) || (function () { })(); var _a; Object.defineProperty(exports, "__esModule", { value: true }); +exports.et2_link_add = exports.et2_link_list = exports.et2_link_string = exports.et2_link = exports.et2_link_entry = exports.et2_link_apps = exports.et2_link_to = void 0; /*egw:uses /vendor/bower-asset/jquery/dist/jquery.js; /vendor/bower-asset/jquery-ui/jquery-ui.js; @@ -1143,6 +1144,8 @@ var et2_link = /** @class */ (function (_super) { _value.title = ""; } } + if (this.options.break_title && _value.title) + _value.title = _value.title.replace(this.options.break_title, "\r\n"); this.set_title(this.link, _value.title); }; /** @@ -1226,6 +1229,12 @@ var et2_link = /** @class */ (function (_super) { "type": "string", "default": null, "description": "Optional parameter to be passed to egw().open in order to open links in specified target eg. _blank" + }, + "break_title": { + "name": "break title", + "type": "string", + "default": null, + "description": "Breaks title into multiple lines based on selected delimiter by replacing it with '\r\n'" } }; et2_link.legacyOptions = ["only_app"]; diff --git a/api/js/etemplate/et2_widget_link.ts b/api/js/etemplate/et2_widget_link.ts index 7402a14d4e..97ad14eb74 100644 --- a/api/js/etemplate/et2_widget_link.ts +++ b/api/js/etemplate/et2_widget_link.ts @@ -1322,6 +1322,12 @@ export class et2_link extends et2_valueWidget implements et2_IDetachedDOM "type": "string", "default": null, "description": "Optional parameter to be passed to egw().open in order to open links in specified target eg. _blank" + }, + "break_title": { + "name": "break title", + "type": "string", + "default": null, + "description": "Breaks title into multiple lines based on selected delimiter by replacing it with '\r\n'" } }; public static readonly legacyOptions = ["only_app"]; @@ -1440,6 +1446,7 @@ export class et2_link extends et2_valueWidget implements et2_IDetachedDOM _value.title = ""; } } + if (this.options.break_title && _value.title) _value.title = _value.title.replace(this.options.break_title, "\r\n"); this.set_title(this.link, _value.title); }