Просмотр исходного кода

Revert "HUE-8888 [editor] Switch clipboard copy from text to formatted html table (#987)"

This reverts commit e15ac5c8fb59c6a9f68c47165cb45dd08c10de15.
Jean-Francois Desjeans Gauthier 6 лет назад
Родитель
Сommit
bed1fb4cb3

+ 0 - 2
desktop/core/src/desktop/templates/common_header_footer_components.mako

@@ -285,8 +285,6 @@ from metadata.conf import has_optimizer, OPTIMIZER
   </div>
 </div>
 
-<div class="clipboard-content"></div>
-
 <script type="text/javascript">
 
   $(document).ready(function () {

+ 8 - 11
desktop/core/src/desktop/templates/common_notebook_ko_components.mako

@@ -389,33 +389,30 @@ from notebook.conf import ENABLE_SQL_INDEXER
         });
 
         var clipboard = new Clipboard('.clipboard' + self.snippet.id().split('-')[0], {
-          target: function (trigger) {
+          text: function () {
             if (self.snippet.result && self.snippet.result.data()) {
               var data = self.snippet.result.data();
-              var result = '<table><tr>';
+              var result = '';
               for (var i = 1; i < self.snippet.result.meta().length; i++) { // Skip the row number column
-                result += '<th>' + hueUtils.html2text(self.snippet.result.meta()[i].name) + '</th>';
+                result += hueUtils.html2text(self.snippet.result.meta()[i].name) + '\t';
               }
-              result += '</tr>';
+              result += '\n';
               data.forEach(function (row) {
-                result += '<tr>';
                 for (var i = 1; i < row.length; i++) { // Skip the row number column
-                  result += '<td>' + hueUtils.html2text(row[i]) + '</td>';
+                  result += hueUtils.html2text(row[i]) + '\t';
                 }
-                result += '</tr>';
+                result += '\n';
               });
-              $('.clipboard-content').html(result);
+              return result;
             } else {
-              $('.clipboard-content').html(window.I18n('Error while copying results.'));
+              return window.I18n('Error while copying results.');
             }
-            return $('.clipboard-content')[0];
           }
         });
 
         clipboard.on('success', function (e) {
           $.jHueNotify.info(self.snippet.result.data().length + ' ' + window.I18n('result(s) copied to the clipboard'));
           e.clearSelection();
-          $('.clipboard-content').empty();
         });
 
         self.trySaveResults = function () {