diff --git a/Gruntfile.js b/Gruntfile.js index 3bf6dc5..cfdac32 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -10,6 +10,7 @@ module.exports = function (grunt) { all: { src: [ 'src/**/*.js', 'playground/**/*.js', + '!playground/libs/**/*.js', '!playground/rt-main.browser.js', '!playground/bundle/**', '!playground/tmp/**', diff --git a/playground/aceEditor.js b/playground/aceEditor.js index 50ce93a..ce2f0f8 100644 --- a/playground/aceEditor.js +++ b/playground/aceEditor.js @@ -2,6 +2,7 @@ * Created by avim on 11/25/2014. */ 'use strict'; +/*global ace:true*/ define(['react', 'lodash'/*, 'ace'*/], function (React, _/*, ace*/) { var editor = React.createClass({ @@ -15,8 +16,8 @@ var editor = React.createClass({ }, render: function () { - var props = _.omit(this.props, ['id', 'ref', 'key', 'value', 'valueLink', 'onChange']); - props.id = this.state.editorId; + var props = _.omit(this.props, ['ref', 'key', 'value', 'valueLink', 'onChange']); + props.id = this.props.id || this.state.editorId; return React.DOM.div(props); }, componentWillUpdate: function (nextProps/*, nextState*/) { @@ -26,7 +27,7 @@ var editor = React.createClass({ } }, componentDidMount: function () { - this.editor = ace.edit(this.state.editorId); + this.editor = ace.edit(this.props.id || this.state.editorId); // this.editor.setTheme('ace/theme/monokai'); this.editor.setTheme('ace/theme/solarized_light'); if (this.props.mode !== 'html') { diff --git a/playground/css/fiddle.css b/playground/css/fiddle.css index ea58131..952edd1 100644 --- a/playground/css/fiddle.css +++ b/playground/css/fiddle.css @@ -1,3 +1,7 @@ +html { + height: 100%; +} + body { /*padding: 20px;*/ font-family: "Helvetica", "Arial", "FreeSans", "Verdana", "Tahoma", "Lucida Sans", "Lucida Sans Unicode", "Luxi Sans", sans-serif; @@ -5,19 +9,25 @@ body { /*overflow: hidden;*/ padding: 0; margin: 0; - position: relative; + /*position: relative;*/ font-size: 14px; - height: 100%; -} - -html { - height: 100%; + /*height: 100%;*/ + display: block; } #container { height: 100%; } +.playground-container { + position: absolute; + top: 48px; + bottom: 0; + left: 0; + right: 0; + background: #DFDFD5; +} + #header { height: 48px; /*background: #4679bd;*/ @@ -42,10 +52,11 @@ html { } .large-text-area { - height: 90%; + /*height: 90%;*/ width: 100%; - display: block; - margin: 10px; + height: 300px; + /*display: block;*/ + /*margin: 10px;*/ } .result-area { @@ -69,9 +80,10 @@ html { .playground { display: table; height: 100%; + width: 100%; } -.row { +.fiddle-row { display: table-row; height: 50%; } @@ -85,6 +97,7 @@ html { /*float: left;*/ /*margin: 2px;*/ /*padding: 10px;*/ + padding: 1px; } /*position: relative; min-height: 100%;*/ \ No newline at end of file diff --git a/playground/fiddle-main.js b/playground/fiddle-main.js index 81bb787..ff1218a 100644 --- a/playground/fiddle-main.js +++ b/playground/fiddle-main.js @@ -10,11 +10,11 @@ requirejs.config({ //'react/addons': 'http://fb.me/react-with-addons-0.12.1' }, shim: { - lodash: { exports: '_' }, - firebase: { exports: 'Firebase' }, + lodash: {exports: '_'}, + firebase: {exports: 'Firebase'}, //ace: { exports: 'ace' }, - jquery: { exports: '$' }, - react: { exports: 'React' } + jquery: {exports: '$'}, + react: {exports: 'React'} }, map: { '*': { @@ -26,5 +26,61 @@ requirejs.config({ requirejs(['jquery', 'react', 'fiddle'], function ($, React, fiddle) { 'use strict'; window.fiddle = React.render(fiddle(), document.getElementById('container')); + $(function () { + $(window).resize(calcSize); + calcSize(); + }); + + function calcSize() { + var contentHeight = $(document).height() - 48; + //$('#container').height(contentHeight).width($(document).width()); + //$('.code-area').each(function (i) { + // var h = (contentHeight / 2) - 10; + // var w = ($(document).width() / 2) - 10; + // $(this).height(h).width(w); + //}); + + + var h = (contentHeight / 2) - 10; + var w = ($(document).width() / 2) - 10; + //var size = getWindowSize(); + //$('#editor-rt').css({ + // top: 50, left: 0, bottom: h, right: w, position: 'absolute' + //}); + //$('#editor-code').css({ + // top: 50, left: w, bottom: h, right: 0, position: 'absolute' + //}); + //$('#editor-generated').css({ + // top: 50 + h, left: 0, bottom: 0, right: w, position: 'absolute' + //}); + //$('#result-area').css({ + // top: 50 + h, left: w, bottom: 0, right: 0, position: 'absolute' + //}); + + //$('.code-area').each(function (i, k) { + // //var h = (contentHeight / 2) - 10; + // //var w = ($(document).width() / 2) - 10; + // //$(this).height(h).width(w); + // $(this).css({ + // top: 50 + h, left: w, bottom: 0, right: 0, position: 'absolute' + // }); + //}); + + $('.large-text-area').each(function (i, k) { + //var h = (contentHeight / 2) - 10; + //var w = ($(document).width() / 2) - 10; + var $this = $(this); + //$this.parent().width(); + //$this.parent().width(); + console.log('' + $this.parent().height() + ',' + $this.parent().width() ); + //$(this).css({); + + $this.height($this.parent().height() - 2).width($this.parent().width() - 2); + //$(this).css({ + // top: 50 + h, left: w, bottom: 0, right: 0, position: 'absolute' + //}); + }); + //.large-text-area + } }); diff --git a/playground/fiddle.rt b/playground/fiddle.rt index 79e234e..77a605e 100644 --- a/playground/fiddle.rt +++ b/playground/fiddle.rt @@ -2,7 +2,9 @@