Right final answer, hopefully useful for someone.
I've made another dialogCommand and then used that to execute so heres the code and hope that people can use it.
In the ckeditor plugins div add.
var d = new CKEDITOR.dialogCommand( 'editdiv_main', { requiredContent: 'div' });
d.exec = function( editor,data ) {
d._element = data;
editor.openDialog( d.dialogName,function(dialog ) {
dialog._element = data;
dialog.setupContent(data);
});
}
editor.addCommand( 'editdiv_main', d);
around
editor.addCommand
commands.
change getsurrounddiv to.
CKEDITOR.plugins.div = {
getSurroundDiv: function( editor, start ) {
var path = editor.elementPath(start);
for(i=0;i<path.elements.length;i++) {
if(path.elements[i].is('div') && !path.elements[i].isReadOnly() ) {
return path.elements[i];
}
}
//may cause trouble with
/*return editor.elementPath( path.blockLimit ).contains( function( node ) {
// Avoid read-only (i.e. contenteditable="false") divs (#11083).
return node.is( 'div' ) && !node.isReadOnly();
}, 1 );*/
}
};
In div dialog.js. add
else if(command == 'editdiv_main'){
this.setupContent( this._element );
}
below the
if(command == 'editdiv') {
}
snippet
within the elementspath you need a new function for double click, I called mine onDClick
which looks like
function onDClick( elementIndex,t ) {
editor.focus();
var element = elementsPath.list[ elementIndex ];
var o = {};
o.editor = editor;
o.elementIndex = elementIndex;
o.element = element;
o.elementsPath = editor.elementsPath;
if(t.title.indexOf('div') >= 0) {
editor.execCommand('editdiv_main', element);
}
}
Essentially you have finally a way of launching the div editor with the element that you have chosen.
Simples.
here are the links to the files.
Elements Path Plugin
Div Plugin File
div dialog plugin file