- Read only mode remove actions over topic icons

- Fix other JS Injection issues.
This commit is contained in:
Paulo Gustavo Veiga
2012-08-29 20:17:35 -03:00
parent 96de014d52
commit 592886519e
8 changed files with 135 additions and 131 deletions

View File

@@ -17,29 +17,33 @@
*/
mindplot.NoteIcon = new Class({
Extends: mindplot.Icon,
initialize : function(topic, noteModel) {
Extends:mindplot.Icon,
initialize:function (topic, noteModel, readOnly) {
$assert(topic, 'topic can not be null');
this.parent(mindplot.NoteIcon.IMAGE_URL);
this._linksModel = noteModel;
this._topic = topic;
this._readOnly = readOnly;
this._registerEvents();
},
_registerEvents : function() {
_registerEvents:function () {
this._image.setCursor('pointer');
// Add on click event to open the editor ...
this.addEvent('click', function(event) {
this._topic.showNoteEditor();
event.stopPropagation();
}.bind(this));
if (!this._readOnly) {
// Add on click event to open the editor ...
this.addEvent('click', function (event) {
this._topic.showNoteEditor();
event.stopPropagation();
}.bind(this));
}
this._tip = new mindplot.widget.FloatingTip(this.getImage()._peer._native, {
// Content can also be a function of the target element!
content: function() {
content:function () {
var result = new Element('div');
result.setStyles({padding:'5px'});
@@ -48,14 +52,14 @@ mindplot.NoteIcon = new Class({
'font-weight':'bold',
color:'black',
'padding-bottom':'5px',
width: '100px'
width:'100px'
});
title.inject(result);
var text = new Element('div', {text:this._linksModel.getText()});
text.setStyles({
'white-space': 'pre-wrap',
'word-wrap': 'break-word'
'white-space':'pre-wrap',
'word-wrap':'break-word'
}
);
text.inject(result);
@@ -63,17 +67,17 @@ mindplot.NoteIcon = new Class({
return result;
}.bind(this),
html: true,
position: 'bottom',
arrowOffset : 10,
center: true,
arrowSize: 15,
offset : {x:10,y:20},
html:true,
position:'bottom',
arrowOffset:10,
center:true,
arrowSize:15,
offset:{x:10, y:20},
className:'notesTip'
});
},
getModel : function() {
getModel:function () {
return this._linksModel;
}
});