caption : '',
caption_display : 'block',
width : '100%',
+ cls : '',
+ href: '',
+ video_url : '',
// margin: '2%', not used
xns : rooui.Toolbar //Boostrap?
},
{
- xtype : 'TextField',
- allowBlank : false,
- width : 150,
- name : 'image_src',
+ xtype : 'Button',
+ text: 'Change Image URL',
+
listeners : {
- keyup : function (combo, e)
- {
- toolbar.editorcore.selectNode(toolbar.tb.selectedNode);
- var b = block();
- b.image_src = this.getValue();
- b.updateElement();
- syncValue();
- toolbar.editorcore.onEditorEvent();
+ click: function (btn, state)
+ {
+
+
+ Roo.MessageBox.show({
+ title : "Image Source URL",
+ msg : "Enter the url for the image",
+ buttons: Roo.MessageBox.OKCANCEL,
+ fn: function(val){
+ block().image_src = val;
+ block().updateElement();
+ syncValue();
+ toolbar.editorcore.onEditorEvent();
+ },
+ minWidth:250,
+ prompt:true,
+ //multiline: multiline,
+ modal : true,
+ value : block().image_src
+ });
}
},
- xns : rooui.form
-
+ xns : rooui.Toolbar
+ },
+
+ {
+ xtype : 'Button',
+ text: 'Change Link URL',
+
+ listeners : {
+ click: function (btn, state)
+ {
+
+
+ Roo.MessageBox.show({
+ title : "Link URL",
+ msg : "Enter the url for the link - leave blank to have no link",
+ buttons: Roo.MessageBox.OKCANCEL,
+ fn: function(val){
+ block().href = val;
+ block().updateElement();
+ syncValue();
+ toolbar.editorcore.onEditorEvent();
+ },
+ minWidth:250,
+ prompt:true,
+ //multiline: multiline,
+ modal : true,
+ value : block().href
+ });
+ }
+ },
+ xns : rooui.Toolbar
},
+ {
+ xtype : 'Button',
+ text: 'Show Video URL',
+
+ listeners : {
+ click: function (btn, state)
+ {
+ Roo.MessageBox.alert("Video URL",
+ block().video_url == '' ? 'This image is not linked ot a video' :
+ 'The image is linked to: <a target="_new" href="' + block().video_url + '">' + block().video_url + '</a>');
+ }
+ },
+ xns : rooui.Toolbar
+ },
+
+
{
xtype : 'TextItem',
text : "Width: ",
var img = {
tag : 'img',
+ contenteditable : 'false',
src : this.image_src,
- alt : d.innerText.replace(/\n/g, " "), // removeHTML..
+ alt : d.innerText.replace(/\n/g, " ").replace(/\s+/g, ' ').trim(), // removeHTML and reduce spaces..
style: {
width : 'auto',
'max-width': '100%',
'</div>',
*/
- if (this.href) {
+ if (this.href.length > 0) {
img = {
tag : 'a',
href: this.href,
+ contenteditable : 'true',
cn : [
img
]
}
- if (this.video_url) {
+ if (this.video_url.length > 0) {
img = {
tag : 'div',
cls : this.cls,
allowfullscreen : true,
width : 420, // these are for video tricks - that we replace the outer
height : 315,
- src : this.video_src,
+ src : this.video_url,
cn : [
img
]
'font-style': 'italic',
display : this.caption_display
},
- cls : this.cls + '-thumbnail',
+ cls : this.cls.length > 0 ? (this.cls + '-thumbnail' ) : '',
html : this.caption
}
readElement : function(node)
{
// this should not really come from the link...
- this.video_src = this.getVal(node, 'div', 'src');
+ this.video_url = this.getVal(node, 'div', 'src');
this.cls = this.getVal(node, 'div', 'class');
this.href = this.getVal(node, 'a', 'href');