123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
- MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
- MWF.xApplication.process.FormDesigner.Module.Html = MWF.FCHtml = new Class({
- Extends: MWF.FC$Element,
- Implements: [Options, Events],
- options: {
- "style": "default",
- "propertyPath": "../x_component_process_FormDesigner/Module/Html/html.html"
- },
-
- initialize: function(form, options){
- this.setOptions(options);
-
- this.path = "../x_component_process_FormDesigner/Module/Html/";
- this.cssPath = "../x_component_process_FormDesigner/Module/Html/"+this.options.style+"/css.wcss";
- this._loadCss();
- this.moduleType = "element";
- this.moduleName = "html";
- this.form = form;
- this.container = null;
- this.containerNode = null;
- },
-
- _createMoveNode: function(){
- this.moveNode = new Element("div", {
- "MWFType": "html",
- "id": this.json.id,
- "styles": this.css.moduleNodeMove,
- "text": ""
- }).inject(this.form.container);
-
- this.textarea = new Element("textarea", {
- "styles":{
- "background": "transparent",
- "border": "0px",
- "width": "100%",
- "overflow": "hidden",
- "cursor": "pointer",
- "webkit-user-select": "text",
- "moz-user-select": "text",
- "font-size": "12px",
- "color": "#193ee1",
- "height": "18px",
- "line-height": "18px"
- }
- }).inject(this.moveNode);
- },
- _loadNodeStyles: function(){
- this.textarea = this.node.getFirst("textarea");
- this.textarea.setStyles({
- "background": "transparent",
- "border": "0px",
- "width": "100%",
- "overflow": "hidden",
- "cursor": "pointer",
- "webkit-user-select": "text",
- "moz-user-select": "text",
- "font-size": "12px",
- "color": "#193ee1",
- "height": "18px",
- "line-height": "18px"
- });
- this.textarea.set("value", this.json.text);
- },
- _setNodeProperty: function(){
- if (this.form.moduleList.indexOf(this)==-1) this.form.moduleList.push(this);
- if (this.form.moduleNodeList.indexOf(this.node)==-1) this.form.moduleNodeList.push(this.node);
- if (this.form.moduleElementNodeList.indexOf(this.node)==-1) this.form.moduleElementNodeList.push(this.node);
- this.textarea.set("value", this.json.text);
- this.textarea.removeAttribute('disabled');
- if (this.property){
- var editNode = this.property.propertyNode.getElement(".MWF_editHtmlText");
- if (editNode) editNode.set("value", this.textarea.get("value"));
- }
- this._setTextareaHeight();
- },
- _createNode: function(){
- this.node = this.moveNode.clone(true, true);
- this.node.store("module", this);
- this.node.setStyles(this.css.moduleNode);
- this.textarea = this.node.getFirst("textarea");
- this.textarea.set("value", this.json.text);
- },
- _setTextareaHeight: function(){
- this.textarea.setStyle("height", "18px");
- var scroll = this.textarea.getScrollSize();
- var size = this.textarea.getSize();
-
- if (scroll.y>size.y){
- this.textarea.setStyle("height", ""+scroll.y+"px");
- }
- },
- _setOtherNodeEvent: function(){
- // this.textarea.focus();
-
- this.textarea.addEvents({
- "keydown": function(e){
- this._setTextareaHeight();
- e.stopPropagation();
- }.bind(this),
- "keyup": function(e){
- if (e.code==8 || e.code==46 || (e.control && e.code==88)){
- this._setTextareaHeight();
- }
- if (this.property){
- var editNode = this.property.propertyNode.getElement(".MWF_editHtmlText");
- if (editNode) editNode.set("value", this.textarea.get("value"));
- }
- // var editNode = $("editHtmlText");
- // if (editNode) editNode.set("value", this.textarea.get("value"));
- }.bind(this),
- "change": function(){
- this.checkPropertyHistory("text", this.json.text, this.textarea.get("value"));
- this.json.text = this.textarea.get("value");
- }.bind(this),
- "blur": function(){
- this.checkPropertyHistory("text", this.json.text, this.textarea.get("value"));
- this.json.text = this.textarea.get("value");
- }.bind(this)
- });
- // this.node.addEvents({
- // "mouseenter": function () {
- // this.textarea.disabled = false;
- // }.bind(this),
- // "mouseleave": function () {
- // this.textarea.disabled = true;
- // }.bind(this)
- // })
- },
- _setEditStyle_custom: function(name){
- if (name=="text"){
- this.textarea.set("value", this.json.text);
- this._setTextareaHeight();
- }
- }
- });
|