Merge branch 'main' of https://github.com/frappe/community into main
This commit is contained in:
@@ -1,15 +1,35 @@
|
|||||||
|
|
||||||
.canvas-wrapper {
|
.livecode-editor-large .canvas-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.livecode-editor-large canvas {
|
||||||
|
position: relative;
|
||||||
|
z-index: 0;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
height: 300px;
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.livecode-editor-large .code {
|
||||||
|
width: 100%;
|
||||||
|
padding: 5px;
|
||||||
|
min-height: 330px;
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
|
.livecode-editor-large .output {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.livecode-editor-large .CodeMirror {
|
||||||
|
height: 320px;
|
||||||
|
}
|
||||||
|
|
||||||
.canvas-editor canvas {
|
.canvas-editor canvas {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
height: 300px;
|
|
||||||
width: 300px;
|
|
||||||
}
|
}
|
||||||
.canvas-wrapper .output {
|
.canvas-wrapper .output {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -19,17 +39,18 @@
|
|||||||
top: 0px;
|
top: 0px;
|
||||||
background-color: rgba(255, 255, 255, 0);
|
background-color: rgba(255, 255, 255, 0);
|
||||||
margin: 15px;
|
margin: 15px;
|
||||||
|
max-height: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.canvas-editor .code {
|
.canvas-editor .code {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
min-height: 330px;
|
/* min-height: 330px; */
|
||||||
resize: none;
|
resize: none;
|
||||||
}
|
}
|
||||||
.canvas-editor .output {
|
/* .canvas-editor .output {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
} */
|
||||||
|
|
||||||
.heading {
|
.heading {
|
||||||
background: #eee;
|
background: #eee;
|
||||||
@@ -39,18 +60,18 @@
|
|||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.canvas-editor h2 {
|
.livecode-editor-large h2 {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.canvas-editor .run {
|
.livecode-editor-large .run {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.canvas-editor .col-sm {
|
.livecode-editor-large .col-sm {
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,3 +88,49 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.canvas-editor .CodeMirror {
|
||||||
|
background: #ffe;
|
||||||
|
border: 1px solid #eed;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas {
|
||||||
|
border: 2px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.canvas-wrapper {
|
||||||
|
margin-bottom: -200px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.canvas-wrapper {
|
||||||
|
padding-top: 20px;
|
||||||
|
margin-left: 2em;
|
||||||
|
}
|
||||||
|
.canvas-wrapper .output {
|
||||||
|
left: 2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.livecode-controls {
|
||||||
|
margin-left: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.livecode-controls a {
|
||||||
|
margin-left: 10px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.canvas-editor {
|
||||||
|
margin: 10px 0px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -51,7 +51,11 @@
|
|||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro render_section_text(s) %}
|
{% macro render_section_text(s) %}
|
||||||
{{ frappe.utils.md_to_html(s.contents) }}
|
<div class="row">
|
||||||
|
<div class="col-md-9">
|
||||||
|
{{ frappe.utils.md_to_html(s.contents) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{%- block script %}
|
{%- block script %}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
{% macro LiveCodeEditor(name, code) %}
|
{% macro LiveCodeEditorLarge(name, code) %}
|
||||||
<div class="canvas-editor row no-gutters" id="editor-{{name}}">
|
<div class="livecode-editor livecode-editor-large row no-gutters" id="editor-{{name}}">
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="heading">
|
<div class="heading">
|
||||||
<button class="run">Run</button>
|
<button class="run">Run</button>
|
||||||
@@ -20,6 +20,31 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro LiveCodeEditor(name, code) %}
|
||||||
|
<div class="livecode-editor canvas-editor" id="editor-{{name}}">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div>
|
||||||
|
<textarea class="code">{{code}}</textarea>
|
||||||
|
<div class="livecode-controls">
|
||||||
|
<button type="button" class="run">Run</button>
|
||||||
|
<a href="javascript:;" class="reset">Reset</a>
|
||||||
|
<a href="javascript:;" class="clear">Clear</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="canvas-wrapper">
|
||||||
|
<canvas class="canvas" width="150" height="150"></canvas>
|
||||||
|
<pre class="output"></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% macro LiveCodeEditorJS(name, code) %}
|
{% macro LiveCodeEditorJS(name, code) %}
|
||||||
<script type="text/javascript" src="{{ livecode_url }}/static/livecode.js"></script>
|
<script type="text/javascript" src="{{ livecode_url }}/static/livecode.js"></script>
|
||||||
@@ -27,7 +52,7 @@
|
|||||||
var livecodeEditors = [];
|
var livecodeEditors = [];
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$(".canvas-editor").each((i, e) => {
|
$(".livecode-editor").each((i, e) => {
|
||||||
var editor = new LiveCodeEditor(e, {
|
var editor = new LiveCodeEditor(e, {
|
||||||
runtime: "python-canvas",
|
runtime: "python-canvas",
|
||||||
base_url: "{{ livecode_url }}",
|
base_url: "{{ livecode_url }}",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{% extends "templates/base.html" %}
|
{% extends "templates/base.html" %}
|
||||||
{% from "www/macros/livecode.html" import LiveCodeEditor, LiveCodeEditorJS with context %}
|
{% from "www/macros/livecode.html" import LiveCodeEditorLarge, LiveCodeEditorJS with context %}
|
||||||
|
|
||||||
{% block title %}{{sketch.title}}{% endblock %}
|
{% block title %}{{sketch.title}}{% endblock %}
|
||||||
{% block head_include %}
|
{% block head_include %}
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="sketch-editor">
|
<div class="sketch-editor">
|
||||||
{{LiveCodeEditor(sketch.name, sketch.code) }}
|
{{LiveCodeEditorLarge(sketch.name, sketch.code) }}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user