Hi all
I'm new here - and I might be posting this "problem" in the wrong place!
I'm haveing some trouble inserting images from my own custom imagegallery into the editor, this is what I have done.
A custom button
$editor->CustomAddons = "<img title=\"Indsæt billede\" class=\"CuteEditorButton\" onmouseover=\"CuteEditor_ButtonCommandOver(this)\" onmouseout=\"CuteEditor_ButtonCommandOut(this)\" onmousedown=\"CuteEditor_ButtonCommandDown(this)\" onmouseup=\"CuteEditor_ButtonCommandUp(this)\" ondragstart=\"CuteEditor_CancelEvent()\" Command=\"billedarkiv\" src=\"../gfx/edit-gfx1.gif\" />";
With the following javascript after
<script language="JavaScript" type="text/javascript" >
var editor1=document.getElementById("ClientID");
function CuteEditor_OnCommand(editor1,command,ui,value) {
//handle the command by yourself
if(command=="billedarkiv") {
var newwin=editor1.ShowDialog(null,"../common/popup-billedarkiv_v2.0.php",editor1,"dialogWidth:800px;dialogHeight:600px");
return true;
}
}
</script>
When the user clicks the button, the dialog window loads perfectly, and I can select and add pictures to the gallery without problems.
My script creates an html img tag, and I want to return this to the editor.
My script looks like this
echo "<script language='JavaScript' type='text/javascript'>\n";
echo "<!--\n";
echo " var imagename = '" . $imagename . "';\n";
echo " var imagestring = ('<img border=0 src=" . $billedarkivpath . "' + imagename + '\>');\n";
echo "editor1.PasteHTML(imagestring);";
echo " window.close();\n";
echo "// -->\n";
echo "</script>\n";
I think the problem has something to do with eidtor1.PasteHTML(imagestring) - and also I'm not sure how to close the window :)
all/any help is appreaciated :)
Best regards
Bee (DK)