Textarea.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Input", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.Textarea = MWF.FCTextarea = new Class({
  4. Extends: MWF.FC$Input,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "type": "textarea",
  9. "path": "../x_component_process_FormDesigner/Module/Textarea/",
  10. "propertyPath": "../x_component_process_FormDesigner/Module/Textarea/textarea.html"
  11. },
  12. _preprocessingModuleData: function(){
  13. this.node.clearStyles();
  14. this.recoveryIconNode = this.node.getFirst();
  15. this.recoveryIconNode.dispose();
  16. this.recoveryTextNode = this.node.getFirst();
  17. this.recoveryTextNode.dispose();
  18. var inputNode = new Element("textarea", {
  19. "styles": {
  20. "background": "transparent",
  21. "width": "100%",
  22. "border": "0px"
  23. }
  24. }).inject(this.node);
  25. this.node.setStyles({
  26. "ovwrflow": "hidden",
  27. "position": "relative",
  28. "padding-right": "2px"
  29. });
  30. if (this.json.styles){
  31. this.json.recoveryStyles = Object.clone(this.json.styles);
  32. if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
  33. if ((value.indexOf("x_processplatform_assemble_surface")==-1 && value.indexOf("x_portal_assemble_surface")==-1)){
  34. this.node.setStyle(key, value);
  35. delete this.json.styles[key];
  36. }
  37. }.bind(this));
  38. }
  39. if (this.json.inputStyles){
  40. this.json.recoveryInputStyles = Object.clone(this.json.inputStyles);
  41. var inputNode = this.node.getFirst();
  42. if (inputNode){
  43. if (this.json.recoveryInputStyles) Object.each(this.json.recoveryInputStyles, function(value, key){
  44. if ((value.indexOf("x_processplatform_assemble_surface")==-1 && value.indexOf("x_portal_assemble_surface")==-1)){
  45. inputNode.setStyle(key, value);
  46. delete this.json.inputStyles[key];
  47. }
  48. }.bind(this));
  49. }
  50. }
  51. this.json.preprocessing = "y";
  52. },
  53. _recoveryModuleData: function(){
  54. if (this.json.recoveryStyles) this.json.styles = this.json.recoveryStyles;
  55. if (this.json.recoveryInputStyles) this.json.inputStyles = this.json.recoveryInputStyles;
  56. if (this.recoveryTextNode) {
  57. this.node.empty();
  58. this.recoveryTextNode.inject(this.node, "top");
  59. }
  60. if (this.recoveryIconNode) {
  61. this.recoveryIconNode.inject(this.node, "top");
  62. }
  63. this.json.recoveryStyles = null;
  64. this.json.recoveryInputStyles = null;
  65. this.recoveryIconNode = null;
  66. this.recoveryTextNode = null;
  67. }
  68. });