From 4dc60cd2598ec2da2dad70739c81a9f90a9242aa Mon Sep 17 00:00:00 2001 From: Mark Kuiphuis Date: Thu, 1 Jul 2021 08:45:56 +1000 Subject: [PATCH] Add two mixins for "autocapitalize" and "inputmode" which can be added to input and textarea form elements. The inputmode determines which keyboard is going to be displayed on mobile devices without a physical keyboard. The autocapitalize attribute tells mobile browsers how to capitalize the contents of the form field. --- .gitignore | 1 + .../NodeTypes.FormElements.MultiLineText.yaml | 1 + ...NodeTypes.FormElements.SingleLineText.yaml | 2 ++ .../NodeTypes.Mixin.AutoCapitalize.yaml | 22 ++++++++++++ Configuration/NodeTypes.Mixin.InputMode.yaml | 30 ++++++++++++++++ .../en/NodeTypes/AutoCapitalizeMixin.xlf | 22 ++++++++++++ .../en/NodeTypes/InputModeMixin.xlf | 35 +++++++++++++++++++ 7 files changed, 113 insertions(+) create mode 100644 .gitignore create mode 100644 Configuration/NodeTypes.Mixin.AutoCapitalize.yaml create mode 100644 Configuration/NodeTypes.Mixin.InputMode.yaml create mode 100644 Resources/Private/Translations/en/NodeTypes/AutoCapitalizeMixin.xlf create mode 100644 Resources/Private/Translations/en/NodeTypes/InputModeMixin.xlf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/Configuration/NodeTypes.FormElements.MultiLineText.yaml b/Configuration/NodeTypes.FormElements.MultiLineText.yaml index b67740c..6a810f0 100644 --- a/Configuration/NodeTypes.FormElements.MultiLineText.yaml +++ b/Configuration/NodeTypes.FormElements.MultiLineText.yaml @@ -3,6 +3,7 @@ 'Neos.Form.Builder:FormElement': true 'Neos.Form.Builder:PlaceholderMixin': true 'Neos.Form.Builder:MaxlengthMixin': true + 'Neos.Form.Builder:AutoCapitalizeMixin': true ui: label: 'Multi-line text' icon: 'icon-pencil-square-o' diff --git a/Configuration/NodeTypes.FormElements.SingleLineText.yaml b/Configuration/NodeTypes.FormElements.SingleLineText.yaml index 2357ea7..7a13c52 100644 --- a/Configuration/NodeTypes.FormElements.SingleLineText.yaml +++ b/Configuration/NodeTypes.FormElements.SingleLineText.yaml @@ -4,6 +4,8 @@ 'Neos.Form.Builder:TextValidatorsMixin': true 'Neos.Form.Builder:PlaceholderMixin': true 'Neos.Form.Builder:MaxlengthMixin': true + 'Neos.Form.Builder:AutoCapitalizeMixin': true + 'Neos.Form.Builder:InputModeMixin': true ui: label: 'Single-line text' icon: 'icon-pencil-square-o' diff --git a/Configuration/NodeTypes.Mixin.AutoCapitalize.yaml b/Configuration/NodeTypes.Mixin.AutoCapitalize.yaml new file mode 100644 index 0000000..b238d40 --- /dev/null +++ b/Configuration/NodeTypes.Mixin.AutoCapitalize.yaml @@ -0,0 +1,22 @@ +'Neos.Form.Builder:AutoCapitalizeMixin': + ui: + position: end + properties: + 'autoCapitalize': + type: string + defaultValue: 'sentences' + ui: + label: i18n + inspector: + group: 'formElement' + editor: 'Neos.Neos/Inspector/Editors/SelectBoxEditor' + editorOptions: + values: + off: + label: i18n + characters: + label: i18n + words: + label: i18n + sentences: + label: i18n diff --git a/Configuration/NodeTypes.Mixin.InputMode.yaml b/Configuration/NodeTypes.Mixin.InputMode.yaml new file mode 100644 index 0000000..6f39d21 --- /dev/null +++ b/Configuration/NodeTypes.Mixin.InputMode.yaml @@ -0,0 +1,30 @@ +'Neos.Form.Builder:InputModeMixin': + ui: + position: end + properties: + 'inputMode': + type: string + defaultValue: 'text' + ui: + label: i18n + inspector: + group: 'formElement' + editor: 'Neos.Neos/Inspector/Editors/SelectBoxEditor' + editorOptions: + values: + text: + label: i18n + decimal: + label: i18n + numeric: + label: i18n + tel: + label: i18n + search: + label: i18n + email: + label: i18n + url: + label: i18n + none: + label: i18n \ No newline at end of file diff --git a/Resources/Private/Translations/en/NodeTypes/AutoCapitalizeMixin.xlf b/Resources/Private/Translations/en/NodeTypes/AutoCapitalizeMixin.xlf new file mode 100644 index 0000000..31fe0a3 --- /dev/null +++ b/Resources/Private/Translations/en/NodeTypes/AutoCapitalizeMixin.xlf @@ -0,0 +1,22 @@ + + + + + + Auto capitalize + + + Off + + + Characters + + + Words + + + Sentences + + + + diff --git a/Resources/Private/Translations/en/NodeTypes/InputModeMixin.xlf b/Resources/Private/Translations/en/NodeTypes/InputModeMixin.xlf new file mode 100644 index 0000000..3b4332e --- /dev/null +++ b/Resources/Private/Translations/en/NodeTypes/InputModeMixin.xlf @@ -0,0 +1,35 @@ + + + + + + Input mode (relevant for mobile browsers) + + + Decimal + + + Email + + + None + + + Numeric + + + Search + + + Telephone + + + Text + + + URL + + + + +