|
@@ -4,15 +4,15 @@
|
|
* Description:
|
|
* Description:
|
|
*/
|
|
*/
|
|
var boxContent = function(style) {
|
|
var boxContent = function(style) {
|
|
- this.top = style.top || '10px';
|
|
|
|
- this.left = style.left || '10px';
|
|
|
|
- this.width = style.width || '310px';
|
|
|
|
- this.height = style.height || '50px';
|
|
|
|
- this.isEditor = style.isEditor || false;
|
|
|
|
-
|
|
|
|
|
|
+ this.top = (style && style.top) || '10px';
|
|
|
|
+ this.left = (style && style.left) || '10px';
|
|
|
|
+ this.width = (style && style.width) || '310px';
|
|
|
|
+ this.height = (style && style.height) || '50px';
|
|
|
|
+ this.isEditor = (style && style.isEditor) || false;
|
|
|
|
|
|
//组件id名称
|
|
//组件id名称
|
|
this.domId = ('syq_box_' + Math.random()).replace('.','_');
|
|
this.domId = ('syq_box_' + Math.random()).replace('.','_');
|
|
|
|
+
|
|
//一个实例化的dom
|
|
//一个实例化的dom
|
|
this.vdom = null;
|
|
this.vdom = null;
|
|
|
|
|
|
@@ -23,30 +23,27 @@ var boxContent = function(style) {
|
|
|
|
|
|
boxContent.prototype.boxTpl = '<div class="line-n line resizable"><div class="circle"></div></div><div class="line-e line resizable"><div class="circle"></div></div><div class="line-s line resizable"><div class="circle"></div></div><div class="line-w line resizable"><div class="circle"></div></div><div class="circle-nw circle resizable"></div><div class="circle-ne circle resizable"></div><div class="circle-se circle resizable"></div><div class="circle-sw circle resizable"></div>';
|
|
boxContent.prototype.boxTpl = '<div class="line-n line resizable"><div class="circle"></div></div><div class="line-e line resizable"><div class="circle"></div></div><div class="line-s line resizable"><div class="circle"></div></div><div class="line-w line resizable"><div class="circle"></div></div><div class="circle-nw circle resizable"></div><div class="circle-ne circle resizable"></div><div class="circle-se circle resizable"></div><div class="circle-sw circle resizable"></div>';
|
|
|
|
|
|
-boxContent.prototype.addContent = function () {
|
|
|
|
- // 实例化主件
|
|
|
|
-
|
|
|
|
- return outDom.context();
|
|
|
|
-};
|
|
|
|
|
|
|
|
//由数据渲染层dom
|
|
//由数据渲染层dom
|
|
boxContent.prototype.renderToDom = function() {
|
|
boxContent.prototype.renderToDom = function() {
|
|
this.vdom = $('<div class="outer-box" id="' + this.domId +'"></div>');
|
|
this.vdom = $('<div class="outer-box" id="' + this.domId +'"></div>');
|
|
- this.vdom.css({ width: this.width, height: this.height,top: this.top, left: this.left }).append(elementBoxDom.context());
|
|
|
|
|
|
+ this.vdom.css({ width: this.width, height: this.height,top: this.top, left: this.left });
|
|
this.renderBoxDom();
|
|
this.renderBoxDom();
|
|
};
|
|
};
|
|
|
|
|
|
//组件渲染
|
|
//组件渲染
|
|
-boxContent.prototype._renderBodyDom = function() {
|
|
|
|
|
|
+boxContent.prototype.renderBoxDom = function() {
|
|
let elementBoxDom = $('<div class="element-box-contents"></div>');
|
|
let elementBoxDom = $('<div class="element-box-contents"></div>');
|
|
let editorDom = $('<div class="element comp_paragraph editable-text"></div>');
|
|
let editorDom = $('<div class="element comp_paragraph editable-text"></div>');
|
|
let circleDom = $('<div class="eqc-select"></div>');
|
|
let circleDom = $('<div class="eqc-select"></div>');
|
|
editorDom.text('双击此处进行编辑');
|
|
editorDom.text('双击此处进行编辑');
|
|
- if(!this.editorContent)editorDom.html(this.editorContent);
|
|
|
|
|
|
+ if(this.editorContent)editorDom.html(this.editorContent);
|
|
editorDom.css({ width: this.width, height: this.height, 'pointer-events': this.isEditor ? 'all' : 'none' });
|
|
editorDom.css({ width: this.width, height: this.height, 'pointer-events': this.isEditor ? 'all' : 'none' });
|
|
elementBoxDom.append(editorDom);
|
|
elementBoxDom.append(editorDom);
|
|
circleDom.append(this.boxTpl);
|
|
circleDom.append(this.boxTpl);
|
|
|
|
|
|
this.vdom.append(elementBoxDom);
|
|
this.vdom.append(elementBoxDom);
|
|
this.vdom.append(circleDom);
|
|
this.vdom.append(circleDom);
|
|
-};
|
|
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+export default boxContent;
|