-
Notifications
You must be signed in to change notification settings - Fork 5
/
FileEditor.aspx
77 lines (55 loc) · 2.87 KB
/
FileEditor.aspx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FileEditor.aspx.cs" Inherits="Optimus.Umbraco.Pages.FileEditor" MasterPageFile="../../../umbraco/masterpages/umbracoPage.Master" validateRequest="false"%>
<%@ Register TagPrefix="umb" Namespace="umbraco.uicontrols" Assembly="controls" %>
<asp:content ID="Content1" contentplaceholderid="body" runat="server">
<script type="text/javascript">
function highlightLine(lineNumber) {
//Line number is zero based index
var actualLineNumber = lineNumber - 1;
//Select editor loaded in the DOM
var myEditor = $("#body_EditorSource .CodeMirror");
console.log(myEditor);
console.log(myEditor[0].CodeMirror);
var codeMirrorEditor = myEditor[0].CodeMirror;
//Set line css class
codeMirrorEditor.setLineClass(actualLineNumber, 'background', 'line-error');
}
function disableEditor() {
//Wait until DOM loaded - hopefully CodeMirror loaded as well
$(document).ready(function () {
if (typeof CodeMirror != 'undefined') {
console.log("Found CodeMirror");
//Select editor loaded in the DOM
var myEditor = $("#body_EditorSource .CodeMirror");
console.log(myEditor);
console.log(myEditor[0].CodeMirror);
var codeMirrorEditor = myEditor[0].CodeMirror;
//Set editor to readonly (nocursor - can't even select)
codeMirrorEditor.setOption("readOnly", "nocursor");
//codeMirrorEditor.readOnly = "nocursor";
} else {
console.log("Can't find CodeMirror");
}
});
}
</script>
<style>
.line-error {
background: #FBC2C4 !important;
color: #8a1f11 !important;
}
</style>
<umb:UmbracoPanel runat="server" ID="UmbracoPanel" Text="File Editor" hasMenu="true">
<umb:Pane runat="server" ID="EditPane" Text="Edit File">
<umb:Feedback runat="server" ID="Feedback" Visible="false" />
<umb:PropertyPanel runat="server" ID="NamePanel" Text="Name">
<asp:TextBox ID="TxtName" Width="350px" runat="server" />
</umb:PropertyPanel>
<umb:PropertyPanel runat="server" id="PathPanel" Text="Path">
<asp:Literal ID="LtrlPath" runat="server" />
</umb:PropertyPanel>
<umb:PropertyPanel runat="server" ID="EditorPanel">
<umb:CodeArea runat="server" ID="EditorSource" EditorMimeType="text/x-sass" AutoResize="true" OffSetX="47" OffSetY="47" />
</umb:PropertyPanel>
</umb:Pane>
</umb:UmbracoPanel>
</asp:content>