emoticon.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. (function() {
  2. /**
  3. * @fileoverview
  4. * emoticon을 입력 할 수 있는 메뉴를 포함하는 tool인 'Emoticon' Icon을 위한 source로
  5. * 필요한 configuration과 Class Trex.Tool.Emoticon을/를 포함
  6. *
  7. */
  8. var _DOC = document,
  9. _WIN = window,
  10. _DOC_EL = _DOC.documentElement,
  11. _FALSE = false,
  12. _TRUE = true,
  13. _NULL = null,
  14. _UNDEFINED;
  15. Trex.Class.overwrite(Trex.Tool.Emoticon, {
  16. oninitialized: function(/*config*/) {
  17. var _canvas = this.canvas;
  18. var _toolHandler = this.handler = function(value) {
  19. if(!value || value.trim().length == 0) {
  20. return;
  21. }
  22. _canvas.execute(function(processor) {
  23. var _node = processor.win.img({ 'src': value, 'border': "0", 'className' : 'txc-emo' });
  24. processor.pasteNode(_node, _FALSE);
  25. });
  26. };
  27. /* button & menu weave */
  28. this.resetWeave();
  29. this.weave.bind(this)(
  30. /* button */
  31. new Trex.Button(this.buttonCfg),
  32. /* menu */
  33. new Trex.Menu.Matrix(this.menuCfg),
  34. /* handler */
  35. _toolHandler
  36. );
  37. }
  38. });
  39. var thisToolName = 'emoticon';
  40. Editor.forEachEditor(function (editor) {
  41. editor.getTool()[thisToolName].oninitialized();
  42. });
  43. Editor.editorForAsyncLoad.getTool()[thisToolName].forceActivate();
  44. })();