|
|
|
@ -27,23 +27,26 @@ var css = csjs` |
|
|
|
|
|
|
|
|
|
module.exports = RighthandPanel |
|
|
|
|
|
|
|
|
|
function RighthandPanel (container, appAPI, events, opts) { |
|
|
|
|
function RighthandPanel (appAPI, events, opts) { |
|
|
|
|
var self = this |
|
|
|
|
self._api = appAPI |
|
|
|
|
var optionViews = yo`<div id="optionViews" class="settingsView"></div>` |
|
|
|
|
var options = yo` |
|
|
|
|
<ul id="options"> |
|
|
|
|
<li class="envView" title="Environment">Contract</li> |
|
|
|
|
<li class="settingsView" title="Settings">Settings</li> |
|
|
|
|
<li class="publishView" title="Publish" >Files</li> |
|
|
|
|
<li class="debugView" title="Debugger">Debugger</li> |
|
|
|
|
<li class="staticanalysisView" title="Static Analysis">Analysis</li> |
|
|
|
|
<li id="helpButton"><a href="https://remix.readthedocs.org" target="_blank" title="Open Documentation">Docs</a></li> |
|
|
|
|
</ul> |
|
|
|
|
` |
|
|
|
|
var element = yo` |
|
|
|
|
<div id="righthand-panel"> |
|
|
|
|
<div id="header"> |
|
|
|
|
<div id="menu"> |
|
|
|
|
<img id="solIcon" title="Solidity realtime compiler and runtime" src="assets/img/remix_logo_512x512.svg" alt="Solidity realtime compiler and runtime"> |
|
|
|
|
<ul id="options"> |
|
|
|
|
<li class="envView" title="Environment">Contract</li> |
|
|
|
|
<li class="settingsView" title="Settings">Settings</li> |
|
|
|
|
<li class="publishView" title="Publish" >Files</li> |
|
|
|
|
<li class="debugView" title="Debugger">Debugger</li> |
|
|
|
|
<li class="staticanalysisView" title="Static Analysis">Analysis</li> |
|
|
|
|
<li id="helpButton"><a href="https://remix.readthedocs.org" target="_blank" title="Open Documentation">Docs</a></li> |
|
|
|
|
</ul> |
|
|
|
|
${options} |
|
|
|
|
</div> |
|
|
|
|
${optionViews} |
|
|
|
|
</div> |
|
|
|
@ -54,72 +57,73 @@ function RighthandPanel (container, appAPI, events, opts) { |
|
|
|
|
analysisTab(optionViews, appAPI, events, opts) |
|
|
|
|
debuggerTab(optionViews, appAPI, events, opts) |
|
|
|
|
filesTab(optionViews, appAPI, events, opts) |
|
|
|
|
container.appendChild(element) |
|
|
|
|
|
|
|
|
|
;[...container.querySelectorAll('#header #options li')].forEach((el) => { el.classList.add(css.options) }) |
|
|
|
|
|
|
|
|
|
// ----------------- toggle right hand panel -----------------
|
|
|
|
|
|
|
|
|
|
var hidingRHP = false |
|
|
|
|
$('.toggleRHP').click(function () { |
|
|
|
|
hidingRHP = !hidingRHP |
|
|
|
|
self._api.setEditorSize(hidingRHP ? 0 : appAPI.config.get(EDITOR_WINDOW_SIZE)) |
|
|
|
|
$('.toggleRHP i').toggleClass('fa-angle-double-right', !hidingRHP) |
|
|
|
|
$('.toggleRHP i').toggleClass('fa-angle-double-left', hidingRHP) |
|
|
|
|
}) |
|
|
|
|
self.render = function () { return element } |
|
|
|
|
|
|
|
|
|
// ----------------- tabbed menu -----------------
|
|
|
|
|
var tabbedMenuAPI = { |
|
|
|
|
warnCompilerLoading: appAPI.warnCompilerLoading |
|
|
|
|
} |
|
|
|
|
// load tabbed menu component
|
|
|
|
|
var tabContainer // @TODO
|
|
|
|
|
var tabEvents = {compiler: events.compiler, app: events.app} |
|
|
|
|
tabbedMenu(tabContainer, tabbedMenuAPI, tabEvents, {}) |
|
|
|
|
|
|
|
|
|
// ----------------- resizeable ui ---------------
|
|
|
|
|
|
|
|
|
|
var EDITOR_WINDOW_SIZE = 'editorWindowSize' |
|
|
|
|
|
|
|
|
|
var dragging = false |
|
|
|
|
$('#dragbar').mousedown(function (e) { |
|
|
|
|
e.preventDefault() |
|
|
|
|
dragging = true |
|
|
|
|
var main = $('#righthand-panel') |
|
|
|
|
var ghostbar = $('<div id="ghostbar">', { |
|
|
|
|
css: { |
|
|
|
|
top: main.offset().top, |
|
|
|
|
left: main.offset().left |
|
|
|
|
} |
|
|
|
|
}).prependTo('body') |
|
|
|
|
self.init = function () { |
|
|
|
|
;[...options.children].forEach((el) => { el.classList.add(css.options) }) |
|
|
|
|
// ----------------- toggle right hand panel -----------------
|
|
|
|
|
|
|
|
|
|
$(document).mousemove(function (e) { |
|
|
|
|
ghostbar.css('left', e.pageX + 2) |
|
|
|
|
var hidingRHP = false |
|
|
|
|
$('.toggleRHP').click(function () { |
|
|
|
|
hidingRHP = !hidingRHP |
|
|
|
|
self._api.setEditorSize(hidingRHP ? 0 : appAPI.config.get(EDITOR_WINDOW_SIZE)) |
|
|
|
|
$('.toggleRHP i').toggleClass('fa-angle-double-right', !hidingRHP) |
|
|
|
|
$('.toggleRHP i').toggleClass('fa-angle-double-left', hidingRHP) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
var $body = $('body') |
|
|
|
|
// ----------------- tabbed menu -----------------
|
|
|
|
|
var tabbedMenuAPI = { |
|
|
|
|
warnCompilerLoading: appAPI.warnCompilerLoading |
|
|
|
|
} |
|
|
|
|
// load tabbed menu component
|
|
|
|
|
var tabEvents = {compiler: events.compiler, app: events.app} |
|
|
|
|
tabbedMenu(options, tabbedMenuAPI, tabEvents, {}) |
|
|
|
|
|
|
|
|
|
// ----------------- resizeable ui ---------------
|
|
|
|
|
|
|
|
|
|
var EDITOR_WINDOW_SIZE = 'editorWindowSize' |
|
|
|
|
|
|
|
|
|
var dragging = false |
|
|
|
|
$('#dragbar').mousedown(function (e) { |
|
|
|
|
e.preventDefault() |
|
|
|
|
dragging = true |
|
|
|
|
var main = $('#righthand-panel') |
|
|
|
|
var ghostbar = $('<div id="ghostbar">', { |
|
|
|
|
css: { |
|
|
|
|
top: main.offset().top, |
|
|
|
|
left: main.offset().left |
|
|
|
|
} |
|
|
|
|
}).prependTo('body') |
|
|
|
|
|
|
|
|
|
$(document).mousemove(function (e) { |
|
|
|
|
ghostbar.css('left', e.pageX + 2) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
function getEditorSize () { |
|
|
|
|
return $('#righthand-panel').width() |
|
|
|
|
} |
|
|
|
|
var $body = $('body') |
|
|
|
|
|
|
|
|
|
$(document).mouseup(function (e) { |
|
|
|
|
if (dragging) { |
|
|
|
|
var delta = $body.width() - e.pageX + 2 |
|
|
|
|
$('#ghostbar').remove() |
|
|
|
|
$(document).unbind('mousemove') |
|
|
|
|
dragging = false |
|
|
|
|
delta = (delta < 50) ? 50 : delta |
|
|
|
|
self._api.setEditorSize(delta) |
|
|
|
|
appAPI.config.set(EDITOR_WINDOW_SIZE, delta) |
|
|
|
|
appAPI.reAdjust() |
|
|
|
|
function getEditorSize () { |
|
|
|
|
return $('#righthand-panel').width() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
if (appAPI.config.exists(EDITOR_WINDOW_SIZE)) { |
|
|
|
|
self._api.setEditorSize(appAPI.config.get(EDITOR_WINDOW_SIZE)) |
|
|
|
|
} else { |
|
|
|
|
appAPI.config.set(EDITOR_WINDOW_SIZE, getEditorSize()) |
|
|
|
|
$(document).mouseup(function (e) { |
|
|
|
|
if (dragging) { |
|
|
|
|
var delta = $body.width() - e.pageX + 2 |
|
|
|
|
$('#ghostbar').remove() |
|
|
|
|
$(document).unbind('mousemove') |
|
|
|
|
dragging = false |
|
|
|
|
delta = (delta < 50) ? 50 : delta |
|
|
|
|
self._api.setEditorSize(delta) |
|
|
|
|
appAPI.config.set(EDITOR_WINDOW_SIZE, delta) |
|
|
|
|
appAPI.reAdjust() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
if (appAPI.config.exists(EDITOR_WINDOW_SIZE)) { |
|
|
|
|
self._api.setEditorSize(appAPI.config.get(EDITOR_WINDOW_SIZE)) |
|
|
|
|
} else { |
|
|
|
|
appAPI.config.set(EDITOR_WINDOW_SIZE, getEditorSize()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|