Pre-hooking ChatEdit_InsertLink is a bad idea, as it will cause taint, and your particular hook is especially bad since you completely replicate the original function instead of just calling it -- so any time Blizzard changes the function, you either have to update your addon immediately, or you're breaking default UI functionality for your users.
You should use a secure post-hook instead:
Code:
hooksecurefunc("ChatEdit_InsertLink", function(link)
if MyEditBox:IsVisible() and MyEditBox:HasFocus() then
MyEditBox:Insert(link)
end
end)
On a side note, upvaluing _G and then upvaluing _G.GetSpellInfo confers no benefit over just upvaluing GetSpellInfo directly -- and for code that only runs when the user shift-clicks a link in chat, there's no benefit in upvaluing anything at all. Just get rid of that clutter and make your code more readable.