【问题标题】:django codemirror get code from editordjango codemirror 从编辑器获取代码
【发布时间】:2023-04-02 22:54:01
【问题描述】:

下面是我在模板中的代码编辑器代码

{% load static %}
<script src="{% static 'codemirror.js' %}"></script>
<link rel="stylesheet" href="{% static 'codemirror.css' %}">
<script src="{% static 'clike.js' %}"></script>

<script>

var myCodeMirror = CodeMirror(document.getElementById('text_area'), {
  value: "int main()",
  mode: "text/x-c++src",
  lineNumbers: true,
  indentUnit: 4,
});
</script>

使用 div 标签

<div id="text_area" name="text_area" style="margin-top: 0px;" ></div>

如何从 post 方法中获取提交按钮后的代码?

注意: 我正在使用来自github的 CodeMirror 库

【问题讨论】:

    标签: python django codemirror


    【解决方案1】:

    你应该可以得到代码

    myCodeMirror.getValue()
    

    【讨论】:

      猜你喜欢
      • 2017-05-22
      • 2022-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-21
      • 2015-02-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多