Skip to content

Commit da7d8f0

Browse files
committed
'Read Only' mode for view source popups
1 parent c56d600 commit da7d8f0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lua/blobsprofiler/client/cl_blobsprofiler.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ blobsProfiler.viewPropertiesPopup = function(title, data, width, height)
108108
return propertiesFrame
109109
end
110110

111-
blobsProfiler.generateAceEditorPanel = function(parentPanel, content, editorMode)
111+
blobsProfiler.generateAceEditorPanel = function(parentPanel, content, editorMode, readOnly)
112112
local dhtmlPanel = vgui.Create("DHTML", parentPanel)
113113
content = content or [[print("Hello world!")]]
114114
editorMode = editorMode or "Lua"
@@ -141,8 +141,9 @@ blobsProfiler.generateAceEditorPanel = function(parentPanel, content, editorMode
141141
var editor = ace.edit("editor");
142142
editor.session.setMode("]].. useMode ..[[");
143143
editor.setOptions({
144-
showLineNumbers: true,
145-
tabSize: 2
144+
showLineNumbers: true,
145+
tabSize: 2,
146+
readOnly: ]].. tostring(tobool(readOnly)) --[[ really? ]] ..[[
146147
});
147148
148149
function getEditorValue() {
@@ -174,7 +175,7 @@ local function popupSourceView(sourceContent, frameTitle)
174175
sourceFrame:Center()
175176
sourceFrame:MakePopup()
176177

177-
local sourcePanel = blobsProfiler.generateAceEditorPanel(sourceFrame, sourceContent)
178+
local sourcePanel = blobsProfiler.generateAceEditorPanel(sourceFrame, sourceContent, "Lua", true)
178179
sourcePanel:Dock(FILL)
179180

180181
sourcePanel.OnRemove = function()

0 commit comments

Comments
 (0)