From 3901276baefbee2c884e24aa6900b4eaa6e174b3 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 3 Jul 2020 18:39:11 +0200 Subject: [PATCH] fixed copy to clipboard icons --- .../debuggerUI/vmDebugger/DropdownPanel.js | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/DropdownPanel.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/DropdownPanel.js index ab2adf192f..050a55872f 100644 --- a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/DropdownPanel.js +++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/DropdownPanel.js @@ -1,12 +1,12 @@ 'use strict' -var yo = require('yo-yo') -const copy = require('copy-text-to-clipboard') -var EventManager = require('../../../../../lib/events') -var TreeView = require('../../../../ui/TreeView') // TODO setup a direct reference to the UI components +const yo = require('yo-yo') +const copyToClipboard = require('../../../../ui/copy-to-clipboard') +const EventManager = require('../../../../../lib/events') +const TreeView = require('../../../../ui/TreeView') // TODO setup a direct reference to the UI components -var csjs = require('csjs-inject') +const csjs = require('csjs-inject') -var css = csjs` +const css = csjs` .title { display: flex; align-items: center; @@ -24,8 +24,6 @@ var css = csjs` .eyeButton { margin: 3px; } - .eyeButton:hover { - } .dropdownpanel { width: 100%; word-break: break-word; @@ -87,7 +85,7 @@ DropdownPanel.prototype.update = function (_data, _header) { this.view.querySelector('.dropdownpanel .dropdowncontent').style.display = 'block' this.view.querySelector('.dropdownpanel .dropdownrawcontent').innerText = JSON.stringify(_data, null, '\t') if (!this.displayContentOnly) { - this.view.querySelector('.title div.btn-sm').style.display = 'block' + this.view.querySelector('.title i.fa-copy').style.display = 'block' this.view.querySelector('.title span').innerText = _header || ' ' } this.message('') @@ -101,6 +99,11 @@ DropdownPanel.prototype.setContent = function (node) { yo.update(this.view, this.render(null, node)) } +DropdownPanel.prototype.copyClipboard = function () { + const content = this.view.querySelector('.dropdownpanel .dropdownrawcontent') + return content.innerText ? content.innerText : content.textContent +} + DropdownPanel.prototype.render = function (overridestyle, node) { var content = yo`
Empty
` if (this.json) { @@ -108,12 +111,6 @@ DropdownPanel.prototype.render = function (overridestyle, node) { } overridestyle === undefined ? {} : overridestyle var self = this - var title = !self.displayContentOnly ? yo`
-
-
${this.name}
-
-
` : yo`
` - var contentNode = yo` ` + var title = !self.displayContentOnly ? yo`
+
+
${this.name}
+ ${copyToClipboard(() => this.copyClipboard())} +
` : yo`
` + var view = yo`