How to disable 'Exit Full Screen' with escape on Yosemite
Now, you could go ahead and brute-force disable the Escape key in
  Safari. But that'd defeat the purpose of still allowing Escape to work
  as a shortcut in the aforementioned places, which I'd rather avoid.




http://patricklenz.co/blog/2014/9/1/dont-escape-full-screen-mode-in-safari

Btw I think that your question is a duplicate : Disable Escape key in Safari for getting out of full screen mode