Skip to content

Commit

Permalink
refined data-contenttype for code editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr. Frank Hoffmann authored and Dr. Frank Hoffmann committed Jul 11, 2018
1 parent 2a8c761 commit 07f472f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/zmi/styles/resources/zmi_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ function show_ace_editor() {
$("textarea#content").hide();
editor = ace.edit("editor");
var value = $("textarea#content").val();
var content_type = $("input#contenttype").val();
if ( $("textarea#content").attr('data-contenttype') ) {
var content_type = $("textarea#content").attr('data-contenttype');
} else {
var content_type = $("input#contenttype").val();
}
if (typeof content_type === "undefined" || ! content_type || content_type === 'text/x-unknown-content-type') {
var absolute_url = $("span#absolute_url").text();
var id = absolute_url.substr(absolute_url.lastIndexOf("/")+1);
Expand All @@ -209,7 +213,7 @@ function show_ace_editor() {
if ( 0 === value.indexOf("<?xml") || value.indexOf("tal:") >= 0) {
content_type = "text/xml";
}
if ( 0 === value.indexOf("#!/usr/bin/python") || 0 === value.indexOf("## Script (Python)") || $('.zmi-pythonscript').length > 0 ) {
if ( 0 === value.indexOf("#!/usr/bin/python") || 0 === value.indexOf("## Script (Python)") ) {
content_type = "python";
}
var mode = "text";
Expand Down

0 comments on commit 07f472f

Please sign in to comment.