Repository: brooklyn-ui Updated Branches: refs/heads/master c4eb263fa -> 536a6eb65
Correct firefox multi-lines issue on configuration text-area in the blueprint composer - replace white-space "nowrap" by "pre" otherwise firefox doesn't display new lines - handle shift+enter (in addition to ctrl+enter and option+enter) to create a new line - avoid javascript error when the input is empty and new line is inserted Signed-off-by: Ludovic Plantin <ludovic.plan...@usharesoft.com> Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/df6b98dd Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/df6b98dd Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/df6b98dd Branch: refs/heads/master Commit: df6b98ddc954cc41a31aad4f513c950a31530b79 Parents: c4eb263 Author: Ludovic Plantin <ludovic.plan...@usharesoft.com> Authored: Tue Oct 9 16:02:19 2018 +0200 Committer: Ludovic Plantin <ludovic.plan...@usharesoft.com> Committed: Tue Oct 9 16:17:35 2018 +0200 ---------------------------------------------------------------------- .../app/components/spec-editor/spec-editor.less | 2 +- ui-modules/utils/autogrow/index.js | 8 ++++++-- ui-modules/utils/on-enter/index.js | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/df6b98dd/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.less ---------------------------------------------------------------------- diff --git a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.less b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.less index 29bb911..4d8660a 100644 --- a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.less +++ b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.less @@ -601,7 +601,7 @@ spec-editor { } textarea.auto-grow-multi-row { // multi-line entries shouldn't wrap - white-space: nowrap; + white-space: pre; } .collapsing { transition: height 0.15s; } http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/df6b98dd/ui-modules/utils/autogrow/index.js ---------------------------------------------------------------------- diff --git a/ui-modules/utils/autogrow/index.js b/ui-modules/utils/autogrow/index.js index dfe3949..b95d800 100644 --- a/ui-modules/utils/autogrow/index.js +++ b/ui-modules/utils/autogrow/index.js @@ -54,11 +54,15 @@ export function autoGrowDirective() { }; element.bind('keydown keypress', e => { - if (e.which === 13 && (e.ctrlKey || e.metaKey)) { + if (e.which === 13 && (e.ctrlKey || e.shiftKey || e.metaKey)) { e.preventDefault(); e.stopPropagation(); let cursorPosition = element[0].selectionStart; - ctrl.$setViewValue(ctrl.$modelValue.substring(0, cursorPosition) + "\n" + ctrl.$modelValue.substring(cursorPosition)); + if (ctrl.$modelValue === undefined) { + ctrl.$setViewValue("\n"); + } else { + ctrl.$setViewValue(ctrl.$modelValue.substring(0, cursorPosition) + "\n" + ctrl.$modelValue.substring(cursorPosition)); + } ctrl.$render(); scope.$apply(() => { element[0].selectionEnd = cursorPosition + 1; http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/df6b98dd/ui-modules/utils/on-enter/index.js ---------------------------------------------------------------------- diff --git a/ui-modules/utils/on-enter/index.js b/ui-modules/utils/on-enter/index.js index d146af9..26f787a 100644 --- a/ui-modules/utils/on-enter/index.js +++ b/ui-modules/utils/on-enter/index.js @@ -36,7 +36,7 @@ export function onEnterDirective() { function link(scope, element, attrs) { element.bind("keydown keypress", event => { - if (event.which === 13 && !event.ctrlKey && !event.metaKey) { + if (event.which === 13 && !event.ctrlKey && !event.metaKey && !event.shiftKey) { scope.onEnter(element, event); } });