This commit is contained in:
Bunny67
2020-11-15 23:43:10 +03:00
parent ca4a2660ec
commit 7cbc40c959
70 changed files with 7175 additions and 3055 deletions
+14 -6
View File
@@ -559,7 +559,7 @@ local function ConstructTextEditor(frame)
end
)
function group.Open(self, data, path, enclose, multipath, reloadOptions, setOnParent, url)
function group.Open(self, data, path, enclose, multipath, reloadOptions, setOnParent, url, validator)
self.data = data
self.path = path
self.multipath = multipath
@@ -602,14 +602,17 @@ local function ConstructTextEditor(frame)
"OnTextChanged",
function(...)
local str = editor.editBox:GetText()
if not (str) or editor.combinedText == true then
if not str or str:trim() == "" or editor.combinedText == true then
editorError:SetText("")
else
local _, errorString
local func, errorString
if (enclose) then
_, errorString = loadstring("return function() " .. str .. "\n end")
func, errorString = loadstring("return function() " .. str .. "\n end")
else
_, errorString = loadstring("return " .. str)
func, errorString = loadstring("return " .. str)
end
if not errorString and validator then
errorString = validator(func())
end
if errorString then
urlText:Hide()
@@ -632,7 +635,12 @@ local function ConstructTextEditor(frame)
local combinedText = ""
for index, childId in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
local text = OptionsPrivate.Private.ValueFromPath(childData, multipath and path[childId] or path)
local text
if multipath then
text = path[childId] and OptionsPrivate.Private.ValueFromPath(childData, path[childId])
else
text = OptionsPrivate.Private.ValueFromPath(childData, path)
end
if text then
if not (singleText) then
singleText = text