Merge pull request #627 from serapath-contribution/master

REFACTOR (2) change layout of app container
pull/1/head
yann300 7 years ago committed by GitHub
commit 08a2c2492a
  1. 15
      assets/css/browser-solidity.css
  2. 22
      src/app.js
  3. 11
      src/app/editor.js
  4. 14
      src/app/righthand-panel.js

@ -8,15 +8,6 @@ body {
font-weight: normal; font-weight: normal;
} }
#editor {
position: absolute;
top: 0;
left: 0;
width: auto;
bottom: 0;
right: 37em;
}
.scroller { .scroller {
position: absolute; position: absolute;
z-index: 999; z-index: 999;
@ -428,12 +419,6 @@ body {
border-right: 2px solid hsla(215, 81%, 79%, .3); border-right: 2px solid hsla(215, 81%, 79%, .3);
} }
#editor .ace-tm .ace_gutter,
#editor .ace-tm .ace_gutter-active-line,
#editor .ace-tm .ace_marker-layer .ace_active-line {
background-color: rgba(225, 229, 251, 0.5);
}
input[readonly] { input[readonly] {
display: block; display: block;
width: 100%; width: 100%;

@ -30,6 +30,14 @@ var RighthandPanel = require('./app/righthand-panel')
var examples = require('./app/example-contracts') var examples = require('./app/example-contracts')
var css = csjs` var css = csjs`
.browsersolidity {
position : absolute;
top : 0;
left : 0;
width : auto;
bottom : 0;
right : 37em;
}
.editor-container { .editor-container {
display : flex; display : flex;
position : absolute; position : absolute;
@ -58,8 +66,8 @@ class App {
var self = this var self = this
if (self._view.el) return self._view.el if (self._view.el) return self._view.el
/***************************************************************************/ /***************************************************************************/
var el = yo` self._view.el = yo`
<div id="editor"> <div class=${css.browsersolidity}>
<div id="tabs-bar"> <div id="tabs-bar">
<div class="scroller scroller-left"><i class="fa fa-chevron-left "></i></div> <div class="scroller scroller-left"><i class="fa fa-chevron-left "></i></div>
<div class="scroller scroller-right"><i class="fa fa-chevron-right "></i></div> <div class="scroller scroller-right"><i class="fa fa-chevron-right "></i></div>
@ -73,7 +81,7 @@ class App {
<div id="dragbar"></div> <div id="dragbar"></div>
</div> </div>
` `
return el return self._view.el
} }
} }
@ -662,7 +670,11 @@ function run () {
// ---------------- Righthand-panel -------------------- // ---------------- Righthand-panel --------------------
var rhpAPI = { var rhpAPI = {
config: config, config: config,
onResize: onResize, setEditorSize (delta) {
$('#righthand-panel').css('width', delta)
self._view.el.style.right = delta + 'px'
onResize()
},
reAdjust: reAdjust, reAdjust: reAdjust,
warnCompilerLoading: (msg) => { warnCompilerLoading: (msg) => {
renderer.clear() renderer.clear()
@ -692,7 +704,7 @@ function run () {
window.onresize = onResize window.onresize = onResize
onResize() onResize()
document.querySelector('#editor').addEventListener('change', onResize) self._view.el.addEventListener('change', onResize)
document.querySelector('#editorWrap').addEventListener('change', onResize) document.querySelector('#editorWrap').addEventListener('change', onResize)
// ----------------- compiler ---------------------- // ----------------- compiler ----------------------

@ -1,7 +1,7 @@
'use strict' 'use strict'
var EventManager = require('ethereum-remix').lib.EventManager var EventManager = require('ethereum-remix').lib.EventManager
var yo = require('yo-yo')
var csjs = require('csjs-inject') var csjs = require('csjs-inject')
var ace = require('brace') var ace = require('brace')
var Range = ace.acequire('ace/range').Range var Range = ace.acequire('ace/range').Range
@ -14,6 +14,15 @@ var css = csjs`
width : 100%; width : 100%;
} }
` `
document.head.appendChild(yo`
<style>
.ace-tm .ace_gutter,
.ace-tm .ace_gutter-active-line,
.ace-tm .ace_marker-layer .ace_active-line {
background-color: rgba(225, 229, 251, 0.5);
}
</style>
`)
function Editor (editorElement) { function Editor (editorElement) {
var editor = ace.edit(editorElement) var editor = ace.edit(editorElement)

@ -28,6 +28,8 @@ var css = csjs`
module.exports = RighthandPanel module.exports = RighthandPanel
function RighthandPanel (container, appAPI, events, opts) { function RighthandPanel (container, appAPI, events, opts) {
var self = this
self._api = appAPI
var optionViews = yo`<div id="optionViews" class="settingsView"></div>` var optionViews = yo`<div id="optionViews" class="settingsView"></div>`
var element = yo` var element = yo`
<div id="righthand-panel"> <div id="righthand-panel">
@ -61,7 +63,7 @@ function RighthandPanel (container, appAPI, events, opts) {
var hidingRHP = false var hidingRHP = false
$('.toggleRHP').click(function () { $('.toggleRHP').click(function () {
hidingRHP = !hidingRHP hidingRHP = !hidingRHP
setEditorSize(hidingRHP ? 0 : appAPI.config.get(EDITOR_WINDOW_SIZE)) 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-right', !hidingRHP)
$('.toggleRHP i').toggleClass('fa-angle-double-left', hidingRHP) $('.toggleRHP i').toggleClass('fa-angle-double-left', hidingRHP)
}) })
@ -98,12 +100,6 @@ function RighthandPanel (container, appAPI, events, opts) {
var $body = $('body') var $body = $('body')
function setEditorSize (delta) {
$('#righthand-panel').css('width', delta)
$('#editor').css('right', delta)
appAPI.onResize()
}
function getEditorSize () { function getEditorSize () {
return $('#righthand-panel').width() return $('#righthand-panel').width()
} }
@ -115,14 +111,14 @@ function RighthandPanel (container, appAPI, events, opts) {
$(document).unbind('mousemove') $(document).unbind('mousemove')
dragging = false dragging = false
delta = (delta < 50) ? 50 : delta delta = (delta < 50) ? 50 : delta
setEditorSize(delta) self._api.setEditorSize(delta)
appAPI.config.set(EDITOR_WINDOW_SIZE, delta) appAPI.config.set(EDITOR_WINDOW_SIZE, delta)
appAPI.reAdjust() appAPI.reAdjust()
} }
}) })
if (appAPI.config.exists(EDITOR_WINDOW_SIZE)) { if (appAPI.config.exists(EDITOR_WINDOW_SIZE)) {
setEditorSize(appAPI.config.get(EDITOR_WINDOW_SIZE)) self._api.setEditorSize(appAPI.config.get(EDITOR_WINDOW_SIZE))
} else { } else {
appAPI.config.set(EDITOR_WINDOW_SIZE, getEditorSize()) appAPI.config.set(EDITOR_WINDOW_SIZE, getEditorSize())
} }

Loading…
Cancel
Save