From d4f4bb532f65a8613bf86773a29279865b51dfbf Mon Sep 17 00:00:00 2001 From: Matt Hook Date: Thu, 25 Aug 2022 10:11:25 +1200 Subject: [PATCH] fix(web-editor): add search hint text [EE-3967] (#7496) --- app/constants.js | 5 +- .../web-editor-form.controller.js | 3 +- .../web-editor-form/web-editor-form.html | 40 +++++++++++++-- app/portainer/react/components/index.ts | 2 +- app/portainer/services/codeMirror.js | 2 +- app/portainer/services/codeMirrorDialog.css | 49 +++++++++++++++++++ app/react/components/Tip/Tooltip/Tooltip.tsx | 5 +- 7 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 app/portainer/services/codeMirrorDialog.css diff --git a/app/constants.js b/app/constants.js index 0ff897a57..5212ba524 100644 --- a/app/constants.js +++ b/app/constants.js @@ -31,7 +31,7 @@ export const KUBERNETES_SYSTEM_NAMESPACES = ['kube-system', 'kube-public', 'kube export const PORTAINER_FADEOUT = 1500; export const STACK_NAME_VALIDATION_REGEX = '^[-_a-z0-9]+$'; export const TEMPLATE_NAME_VALIDATION_REGEX = '^[-_a-z0-9]+$'; -export const BROWSER_OS_PLATFORM = navigator.userAgent.indexOf('Windows NT') > -1 ? 'win' : 'lin'; +export const BROWSER_OS_PLATFORM = navigator.userAgent.indexOf('Windows') > -1 ? 'win' : navigator.userAgent.indexOf('Mac') > -1 ? 'mac' : 'lin'; export const NEW_LINE_BREAKER = BROWSER_OS_PLATFORM === 'win' ? '\r\n' : '\n'; // don't declare new constants, either: @@ -66,4 +66,5 @@ angular .constant('PAGINATION_MAX_ITEMS', PAGINATION_MAX_ITEMS) .constant('APPLICATION_CACHE_VALIDITY', APPLICATION_CACHE_VALIDITY) .constant('CONSOLE_COMMANDS_LABEL_PREFIX', CONSOLE_COMMANDS_LABEL_PREFIX) - .constant('PREDEFINED_NETWORKS', PREDEFINED_NETWORKS); + .constant('PREDEFINED_NETWORKS', PREDEFINED_NETWORKS) + .constant('BROWSER_OS_PLATFORM', BROWSER_OS_PLATFORM); diff --git a/app/portainer/components/form-components/web-editor-form/web-editor-form.controller.js b/app/portainer/components/form-components/web-editor-form/web-editor-form.controller.js index 6a5f3305e..54128bfab 100644 --- a/app/portainer/components/form-components/web-editor-form/web-editor-form.controller.js +++ b/app/portainer/components/form-components/web-editor-form/web-editor-form.controller.js @@ -1,7 +1,8 @@ class WebEditorFormController { /* @ngInject */ - constructor() { + constructor(BROWSER_OS_PLATFORM) { this.editorUpdate = this.editorUpdate.bind(this); + this.BROWSER_OS_PLATFORM = BROWSER_OS_PLATFORM; } editorUpdate(cm) { diff --git a/app/portainer/components/form-components/web-editor-form/web-editor-form.html b/app/portainer/components/form-components/web-editor-form/web-editor-form.html index b4bc88d30..f72bfbf41 100644 --- a/app/portainer/components/form-components/web-editor-form/web-editor-form.html +++ b/app/portainer/components/form-components/web-editor-form/web-editor-form.html @@ -1,7 +1,41 @@ -
-
Web editor
-
+
+
Web editor +
+ Ctrl+F for search + Cmd+F for search + + + + +
+
+