diff options
author | Stefan Giehl <stefan@piwik.org> | 2018-07-03 01:38:35 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-07-03 01:38:35 +0300 |
commit | 1a37b8487f6ce7effc5088301909743bd15a19ee (patch) | |
tree | f0fc678423a2a80fea2ae915bc96d4a98dc07839 /plugins/CoreHome/angularjs/common | |
parent | 1f2753aa2af2ae98b7bb5dfc6b15546c705b7bbc (diff) |
Make it possible to use line breaks in placeholders (#13125)
* Make it possible to use line breaks in placeholders
for safari those line breaks will be replaced with 200 white spaces, as line breaks aren't supported there
* use example.com and example.org as placeholders
Diffstat (limited to 'plugins/CoreHome/angularjs/common')
-rw-r--r-- | plugins/CoreHome/angularjs/common/directives/attributes.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/CoreHome/angularjs/common/directives/attributes.js b/plugins/CoreHome/angularjs/common/directives/attributes.js index 825ed22b96..4c59d71cc2 100644 --- a/plugins/CoreHome/angularjs/common/directives/attributes.js +++ b/plugins/CoreHome/angularjs/common/directives/attributes.js @@ -35,6 +35,13 @@ if (angular.isObject(value)) { value = JSON.stringify(value); } + + // replace line breaks in placeholder with big amount of spaces for safari, + // as line breaks are not support there + if (key === 'placeholder' && /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) { + value = value.replace(/(?:\r\n|\r|\n)/g, (new Array(200)).join(' ')); + } + if (key === 'disabled') { element.prop(key, value); } else { |