mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-08-20 04:30:42 +02:00
Bug message: uncaught exception: text can not be null, line:0, : fixed.
This commit is contained in:
parent
00829bfcc4
commit
c4f4756e4a
@ -17,17 +17,18 @@
|
||||
*/
|
||||
|
||||
mindplot.model.NoteModel = new Class({
|
||||
Extends: mindplot.model.FeatureModel,
|
||||
initialize : function(attributes) {
|
||||
Extends:mindplot.model.FeatureModel,
|
||||
initialize:function (attributes) {
|
||||
this.parent(mindplot.model.NoteModel.FEATURE_TYPE);
|
||||
this.setText(attributes.text);
|
||||
if (attributes.text)
|
||||
this.setText(attributes.text);
|
||||
},
|
||||
|
||||
getText:function() {
|
||||
getText:function () {
|
||||
return this.getAttribute('text');
|
||||
},
|
||||
|
||||
setText : function(text) {
|
||||
setText:function (text) {
|
||||
$assert(text, 'text can not be null');
|
||||
this.setAttribute('text', text);
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
},
|
||||
|
||||
_noteTextToXML:function (document, elem, text) {
|
||||
if (text.indexOf('\n') == -1) {
|
||||
if (text.indexOf('\n') == -1 && text.indexOf("&") == -1 && text.indexOf("<") == -1 && text.indexOf("\"") == -1) {
|
||||
elem.setAttribute('text', text);
|
||||
} else {
|
||||
var textDom = document.createElement("text");
|
||||
@ -256,7 +256,7 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
|
||||
var topic = mindmap.createNode(type, id);
|
||||
var text = domElem.getAttribute('text');
|
||||
if ($defined(text)) {
|
||||
if ($defined(text) && text) {
|
||||
topic.setText(text);
|
||||
}
|
||||
|
||||
|
@ -18,42 +18,42 @@
|
||||
|
||||
mindplot.widget.NoteEditor = new Class({
|
||||
Extends:MooDialog,
|
||||
initialize : function(model) {
|
||||
initialize:function (model) {
|
||||
$assert(model, "model can not be null");
|
||||
var panel = this._buildPanel(model);
|
||||
this.parent({
|
||||
closeButton:true,
|
||||
destroyOnClose:true,
|
||||
title:'Note',
|
||||
onInitialize: function(wrapper) {
|
||||
onInitialize:function (wrapper) {
|
||||
wrapper.setStyle('opacity', 0);
|
||||
this.fx = new Fx.Morph(wrapper, {
|
||||
duration: 600,
|
||||
transition: Fx.Transitions.Bounce.easeOut
|
||||
duration:600,
|
||||
transition:Fx.Transitions.Bounce.easeOut
|
||||
});
|
||||
},
|
||||
|
||||
onBeforeOpen: function() {
|
||||
onBeforeOpen:function () {
|
||||
this.overlay = new Overlay(this.options.inject, {
|
||||
duration: this.options.duration
|
||||
duration:this.options.duration
|
||||
});
|
||||
if (this.options.closeOnOverlayClick)
|
||||
this.overlay.addEvent('click', this.close.bind(this));
|
||||
this.overlay.open();
|
||||
|
||||
this.fx.start({
|
||||
'margin-top': [-200, -100],
|
||||
opacity: [0, 1]
|
||||
}).chain(function() {
|
||||
'margin-top':[-200, -100],
|
||||
opacity:[0, 1]
|
||||
}).chain(function () {
|
||||
this.fireEvent('show');
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
onBeforeClose: function() {
|
||||
onBeforeClose:function () {
|
||||
this.fx.start({
|
||||
'margin-top': [-100, 0],
|
||||
opacity: 0
|
||||
}).chain(function() {
|
||||
'margin-top':[-100, 0],
|
||||
opacity:0
|
||||
}).chain(function () {
|
||||
this.fireEvent('hide');
|
||||
}.bind(this));
|
||||
this.overlay.destroy();
|
||||
@ -62,13 +62,13 @@ mindplot.widget.NoteEditor = new Class({
|
||||
this.setContent(panel);
|
||||
},
|
||||
|
||||
_buildPanel : function (model) {
|
||||
_buildPanel:function (model) {
|
||||
var result = new Element('div');
|
||||
var form = new Element('form', {'action': 'none', 'id':'noteFormId'});
|
||||
var form = new Element('form', {'action':'none', 'id':'noteFormId'});
|
||||
|
||||
// Add textarea ...
|
||||
var textArea = new Element('textarea',
|
||||
{placeholder: 'Write your note here ...',
|
||||
{placeholder:'Write your note here ...',
|
||||
required:true,
|
||||
autofocus:'autofocus'
|
||||
});
|
||||
@ -77,17 +77,17 @@ mindplot.widget.NoteEditor = new Class({
|
||||
|
||||
textArea.setStyles({
|
||||
'width':'100%',
|
||||
'height':80
|
||||
,resize: 'none'
|
||||
'height':80, resize:'none'
|
||||
});
|
||||
textArea.inject(form);
|
||||
|
||||
// Register submit event ...
|
||||
form.addEvent('submit', function(event) {
|
||||
form.addEvent('submit', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
model.setValue(textArea.value);
|
||||
if (textArea.value ) {
|
||||
model.setValue(textArea.value);
|
||||
}
|
||||
this.close();
|
||||
|
||||
}.bind(this));
|
||||
@ -96,17 +96,17 @@ mindplot.widget.NoteEditor = new Class({
|
||||
var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'right'});
|
||||
|
||||
// Create accept button ...
|
||||
var okButton = new Element('input', {type:'submit', value:'Accept','class':'btn-primary'});
|
||||
var okButton = new Element('input', {type:'submit', value:'Accept', 'class':'btn-primary'});
|
||||
okButton.addClass('button');
|
||||
okButton.inject(buttonContainer);
|
||||
|
||||
// Create remove button ...
|
||||
if ($defined(model.getValue())) {
|
||||
var rmButton = new Element('input', {type:'button', value:'Remove','class':'btn-primary'});
|
||||
var rmButton = new Element('input', {type:'button', value:'Remove', 'class':'btn-primary'});
|
||||
rmButton.setStyle('margin', '5px');
|
||||
rmButton.addClass('button');
|
||||
rmButton.inject(buttonContainer);
|
||||
rmButton.addEvent('click', function() {
|
||||
rmButton.addEvent('click', function () {
|
||||
model.setValue(null);
|
||||
this.close();
|
||||
}.bind(this));
|
||||
@ -114,16 +114,16 @@ mindplot.widget.NoteEditor = new Class({
|
||||
}
|
||||
|
||||
// Create cancel button ...
|
||||
var cButton = new Element('input', {type:'button', value:'Cancel','class':'btn-secondary'});
|
||||
var cButton = new Element('input', {type:'button', value:'Cancel', 'class':'btn-secondary'});
|
||||
cButton.setStyle('margin', '5px');
|
||||
cButton.addClass('button');
|
||||
cButton.inject(buttonContainer);
|
||||
cButton.addEvent('click', function() {
|
||||
cButton.addEvent('click', function () {
|
||||
this.close();
|
||||
}.bind(this));
|
||||
buttonContainer.inject(form);
|
||||
|
||||
result.addEvent('keydown', function(event) {
|
||||
result.addEvent('keydown', function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
@ -131,7 +131,7 @@ mindplot.widget.NoteEditor = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
show : function() {
|
||||
show:function () {
|
||||
this.open();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user