From 23244f5a510cada631a4506828fd8fdbef3cd8f0 Mon Sep 17 00:00:00 2001 From: BlueSodaWater <835059949@qq.com> Date: Sun, 2 Jul 2023 13:34:51 +0800 Subject: [PATCH] Fix the issue that clear content when paste the same content in namespace (#4919) --- CHANGES.md | 1 + .../scripts/directive/namespace-panel-directive.js | 12 ++---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index dda6ea314c7..356786ab9de 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -28,6 +28,7 @@ Apollo 2.2.0 * [Bump springboot version from 2.7.9 to 2.7.11](https://github.com/apolloconfig/apollo/pull/4828) * [[Multi-Database Support][h2] Support run on h2](https://github.com/apolloconfig/apollo/pull/4851) * [Fix the issue that env special case handling is missing in some case](https://github.com/apolloconfig/apollo/pull/4887) +* [Fix the issue that clear content when paste the same content in namespace](https://github.com/apolloconfig/apollo/pull/4922) ------------------ All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/13?closed=1) \ No newline at end of file diff --git a/apollo-portal/src/main/resources/static/scripts/directive/namespace-panel-directive.js b/apollo-portal/src/main/resources/static/scripts/directive/namespace-panel-directive.js index 974c599d5f2..9254d861ef6 100644 --- a/apollo-portal/src/main/resources/static/scripts/directive/namespace-panel-directive.js +++ b/apollo-portal/src/main/resources/static/scripts/directive/namespace-panel-directive.js @@ -989,16 +989,8 @@ function directive($window, $translate, toastr, AppUtil, EventManager, Permissio }) }, onChange: function (e) { - if ((e[0].action === 'insert') && (scope.namespace.hasOwnProperty("editText")) && (scope.namespace.editText.length === 0)) { - let text = '' - for (let i = 0; i < e[0].lines.length; i++) { - if (i === 0) { - text = e[0].lines[0] - } else { - text += '\r\n' + e[0].lines[i] - } - } - scope.namespace.editText = text + if ((e[0].action === 'insert') && (scope.namespace.hasOwnProperty("editText"))) { + scope.namespace.editText = e[1].session.getValue() } }