diff --git a/common/lib/xmodule/xmodule/js/src/capa/schematic.js b/common/lib/xmodule/xmodule/js/src/capa/schematic.js index 8e7e9aaa27..c856987bc3 100644 --- a/common/lib/xmodule/xmodule/js/src/capa/schematic.js +++ b/common/lib/xmodule/xmodule/js/src/capa/schematic.js @@ -1987,23 +1987,6 @@ function update_schematics() { } window.update_schematics = update_schematics; -// add ourselves to the tasks that get performed when window is loaded -function add_schematic_handler(other_onload) { - return function() { - // execute othe onload functions first - if (other_onload) other_onload(); - - update_schematics(); - } -} - -// ask each schematic input widget to update its value field for submission -function prepare_schematics() { - var schematics = $('.schematic'); - for (var i = schematics.length - 1; i >= 0; i--) - schematics[i].schematic.update_value(); -} - schematic = (function() { var background_style = 'rgb(220,220,220)'; var element_style = 'rgb(255,255,255)'; @@ -6196,4 +6179,3 @@ schematic = (function() { } return module; }()); - diff --git a/common/static/js/capa/schematicinput.js b/common/static/js/capa/schematicinput.js index e4769374c4..65e81d2e10 100644 --- a/common/static/js/capa/schematicinput.js +++ b/common/static/js/capa/schematicinput.js @@ -1,8 +1,3 @@ -var schematic_height = 220; -var schematic_width = 400; -var styling_height_delta = 2; //How many pixels are added to the height of the box because of styling (like a shadow) -var styling_width_delta = 2; - $(function() { // TODO: someone should fix all of this... //$("a[rel*=leanModal]").leanModal(); //TODO: Make this work with the new modal library. Try and integrate this with the "slices" @@ -50,9 +45,5 @@ $(function() { editingCircuit.schematic.load_schematic(saving_circuit, ""); editingCircuit.schematic.zoomall(); - - if (editingCircuit.codeMirrorLine) { - editingCircuit.codeMirrorLine.replace(0, null, "circuit-schematic:" + saving_circuit); - } }); }); diff --git a/common/static/js/vendor/CodeMirror/addons/edx_markdown.js b/common/static/js/vendor/CodeMirror/addons/edx_markdown.js index f107b0bac4..3900683e9c 100644 --- a/common/static/js/vendor/CodeMirror/addons/edx_markdown.js +++ b/common/static/js/vendor/CodeMirror/addons/edx_markdown.js @@ -19,7 +19,7 @@ CodeMirror.defineMode("edx_markdown", function(cmCfg, modeCfg) { , olRE = /^[0-9]+\.\s+/ , headerRE = /^(?:\={3,}|-{3,})$/ , textRE = /^[^\[*_\\<>`]+/ - , circuitRE = /^circuit-schematic:(.*)$/; + ; function switchInline(stream, state, f) { state.f = state.inline = f; @@ -55,43 +55,9 @@ CodeMirror.defineMode("edx_markdown", function(cmCfg, modeCfg) { .replace(/'/g, "'"); } - var circuit_formatter = { - creator: function(text) { - var circuit_value = text.match(circuitRE)[1] - - circuit_value = escapeHtml(circuit_value); - - var html = "
"; - - return html; - }, - size: function(text) { - return {width: schematic_width + styling_width_delta, height:schematic_height + styling_height_delta}; - }, - callback: function(node, line) { - try { - update_schematics(); - var schmInput = node.firstChild.firstChild; - schmInput.codeMirrorLine = line; - if (schmInput.schematic) { //This is undefined if there was an error making the schematic - schmInput.schematic.canvas.style.display = "block"; //Otherwise, it gets line height and is a weird size - schmInput.schematic.always_draw_grid = true; - schmInput.schematic.redraw_background(); - } - } catch (err) { - console.log("Error in edx_markdown callback: " + err); - } - - } - }; - function blockNormal(stream, state) { var match; - if (stream.sol() && stream.match(circuitRE)) { - stream.skipToEnd(); - return circuit_formatter; - } else if (state.indentationDiff >= 4) { + if (state.indentationDiff >= 4) { state.indentation -= state.indentationDiff; stream.skipToEnd(); return code; diff --git a/lms/djangoapps/course_wiki/plugins/markdownedx/mdx_circuit.py b/lms/djangoapps/course_wiki/plugins/markdownedx/mdx_circuit.py deleted file mode 100755 index f90cb61123..0000000000 --- a/lms/djangoapps/course_wiki/plugins/markdownedx/mdx_circuit.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python -''' -Image Circuit Extension for Python-Markdown -====================================== - - -Any single line beginning with circuit-schematic: and followed by data (which should be json data, but this -is not enforced at this level) will be displayed as a circuit schematic. This is simply an input element with -the value set to the data. It is left to javascript on the page to render that input as a circuit schematic. - -ex: -circuit-schematic:[["r",[128,48,0],{"r":"1","_json_":0},["2","1"]],["view",0,0,2,null,null,null,null,null,null,null],["dc",{"0":0,"1":1,"I(_3)":-1}]] - -(This is a schematic with a single one-ohm resistor. Note that this data is not meant to be user-editable.) - -''' -import markdown -import re - -from django.utils.html import escape - -try: - # Markdown 2.1.0 changed from 2.0.3. We try importing the new version first, - # but import the 2.0.3 version if it fails - from markdown.util import etree -except: - from markdown import etree - - -class CircuitExtension(markdown.Extension): - def __init__(self, configs): - for key, value in configs: - self.setConfig(key, value) - - def extendMarkdown(self, md, md_globals): - ## Because Markdown treats contigous lines as one block of text, it is hard to match - ## a regex that must occupy the whole line (like the circuit regex). This is why we have - ## a preprocessor that inspects the lines and replaces the matched lines with text that is - ## easier to match - md.preprocessors.add('circuit', CircuitPreprocessor(md), "_begin") - - pattern = CircuitLink(r'processed-schematic:(?P.*?)processed-schematic-end') - pattern.md = md - pattern.ext = self - md.inlinePatterns.add('circuit', pattern, "circuit-schematic:
$LaTeX {% trans "Math Expression" %}$