Textarea.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. MWF.xApplication.cms.FormDesigner.Module = MWF.xApplication.cms.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("cms.FormDesigner", "Module.$Element", null, false);
  3. MWF.xApplication.cms.FormDesigner.Module.Textarea = MWF.CMSFCTextarea = new Class({
  4. Extends: MWF.CMSFC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "/x_component_cms_FormDesigner/Module/Textarea/textarea.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "/x_component_cms_FormDesigner/Module/Textarea/";
  13. this.cssPath = "/x_component_cms_FormDesigner/Module/Textarea/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "element";
  16. this.moduleName = "textarea";
  17. this.form = form;
  18. this.container = null;
  19. this.containerNode = null;
  20. },
  21. _createMoveNode: function(){
  22. this.moveNode = new Element("div", {
  23. "MWFType": "textarea",
  24. "styles": this.css.moduleNodeMove,
  25. "id": this.json.id,
  26. "readonly": true,
  27. "events": {
  28. "selectstart": function(){
  29. return false;
  30. }
  31. }
  32. }).inject(this.form.container);
  33. var icon = new Element("div", {
  34. "styles": this.css.textareaIcon
  35. }).inject(this.moveNode);
  36. var text = new Element("div", {
  37. "styles": this.css.moduleText,
  38. "text": this.json.id
  39. }).inject(this.moveNode);
  40. },
  41. _loadNodeStyles: function(){
  42. var icon = this.node.getFirst("div");
  43. var text = this.node.getLast("div");
  44. icon.setStyles(this.css.textareaIcon);
  45. text.setStyles(this.css.moduleText);
  46. },
  47. _getCopyNode: function(){
  48. if (!this.copyNode) this._createCopyNode();
  49. this.copyNode.setStyle("display", "inline-block");
  50. return this.copyNode;
  51. },
  52. _setEditStyle_custom: function(name){
  53. if (name=="id"){
  54. this.node.getLast().set("text", this.json.id);
  55. }
  56. }
  57. });