embedentry.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Trex.EmbedEntry
  3. * 삽입된 embed들을 wrapping하는 class
  4. * @class
  5. * @extends Trex.Entry
  6. *
  7. * @param {Object} actor
  8. * @param {Object} data
  9. *
  10. * 1.5 되면서 IE에서는 변환하지 않음
  11. */
  12. Trex.EmbedEntry = Trex.Class.create({
  13. $extend: Trex.Entry,
  14. attrs: {
  15. align: "left"
  16. },
  17. initialize: function(actor, data) {
  18. this.actor = actor;
  19. this.canvas = actor.canvas;
  20. this.entryBox = actor.entryBox;
  21. this.setProperties(data);
  22. },
  23. register: function() {
  24. if(this.canvas.isWYSIWYG()) {
  25. var _style = this.actor.config.defaultstyle;
  26. if(_style){
  27. this.canvas.pasteContent(this.dispHtml, _TRUE, {
  28. 'style': _style
  29. });
  30. }else{
  31. this.canvas.pasteContent(this.dispHtml, _TRUE);
  32. }
  33. } else {
  34. this.canvas.getProcessor().insertTag('', this.dispText);
  35. }
  36. },
  37. setProperties: function(data) {
  38. this.type = this.constructor.__Identity;
  39. var _data = this.data = data;
  40. this.key = _data.key;
  41. this.dispHtml = this.getDispHtml(_data);
  42. this.saveHtml = this.dispText = this.getDispText(_data); //NOTE: embeder들은 dispText와 saveHtml가 같다.
  43. this.regHtml = this.getRegHtml(_data);
  44. this.regLoad = this.regText = this.getRegText(_data); //NOTE: embeder들은 dispText와 saveHtml가 같다.
  45. }
  46. });