Merge branch 'main' of https://github.com/frappe/community into main
This commit is contained in:
@@ -51,7 +51,11 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% 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 %}
|
||||
|
||||
{%- block script %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
{% macro LiveCodeEditor(name, code) %}
|
||||
<div class="canvas-editor row no-gutters" id="editor-{{name}}">
|
||||
{% macro LiveCodeEditorLarge(name, code) %}
|
||||
<div class="livecode-editor livecode-editor-large row no-gutters" id="editor-{{name}}">
|
||||
<div class="col-sm">
|
||||
<div class="heading">
|
||||
<button class="run">Run</button>
|
||||
@@ -20,6 +20,31 @@
|
||||
</div>
|
||||
{% 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) %}
|
||||
<script type="text/javascript" src="{{ livecode_url }}/static/livecode.js"></script>
|
||||
@@ -27,7 +52,7 @@
|
||||
var livecodeEditors = [];
|
||||
|
||||
$(function() {
|
||||
$(".canvas-editor").each((i, e) => {
|
||||
$(".livecode-editor").each((i, e) => {
|
||||
var editor = new LiveCodeEditor(e, {
|
||||
runtime: "python-canvas",
|
||||
base_url: "{{ livecode_url }}",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% 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 head_include %}
|
||||
@@ -47,7 +47,7 @@
|
||||
{% endif %}
|
||||
|
||||
<div class="sketch-editor">
|
||||
{{LiveCodeEditor(sketch.name, sketch.code) }}
|
||||
{{LiveCodeEditorLarge(sketch.name, sketch.code) }}
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user