RoleForm: Add zero-width char after each `/` in permission and restriction labels

Helps browsers break onto newlines if it's too narrow.
This commit is contained in:
Johannes Meyer 2019-12-09 08:21:55 +01:00
parent f5dc25b5c7
commit e2bcdd365a
1 changed files with 12 additions and 2 deletions

View File

@ -209,7 +209,12 @@ class RoleForm extends RepositoryForm
'autosubmit' => isset($spec['isFullPerm']),
'disabled' => $hasFullPerm ?: null,
'value' => $hasFullPerm,
'label' => isset($spec['label']) ? $spec['label'] : $spec['name'],
'label' => preg_replace(
// Adds a zero-width char after each slash to help browsers break onto newlines
'~(?<!<)/~',
'/&#8203;',
isset($spec['label']) ? $spec['label'] : $spec['name']
),
'description' => isset($spec['description']) ? $spec['description'] : $spec['name']
]
)
@ -234,7 +239,12 @@ class RoleForm extends RepositoryForm
'text',
$name,
[
'label' => isset($spec['label']) ? $spec['label'] : $spec['name'],
'label' => preg_replace(
// Adds a zero-width char after each slash to help browsers break onto newlines
'~(?<!<)/~',
'/&#8203;',
isset($spec['label']) ? $spec['label'] : $spec['name']
),
'description' => $spec['description']
]
)