I'm trying to insert some divs around Images inserted by the ImageManager. I tried adding FCK.InsertHTML('<div></div>') code inside the manager.js file under the function onOK(). However, can't get access to FCK object.
My problem seems to be getting access to the editor. I tried to get the editor object by adding this code to manager.js:
var oEditor = window.parent.InnerDialogLoaded();
var FCK = oEditor.FCK;
var sven = FCK.GetXHTML( true );
However, I get JavaScript errors saying FCKeditorAPI is not defined. How do I get access to the editor text, so I can add some div tags around a inserted image.
Thanks.
My problem seems to be getting access to the editor. I tried to get the editor object by adding this code to manager.js:
var oEditor = window.parent.InnerDialogLoaded();
var FCK = oEditor.FCK;
var sven = FCK.GetXHTML( true );
However, I get JavaScript errors saying FCKeditorAPI is not defined. How do I get access to the editor text, so I can add some div tags around a inserted image.
Thanks.
RE: Adding Divs around Images in ImageManager
Hey Rick,
We settled this per e-mail, but for others I'll also reply your question here:
The code of the ImageManager that does the actual inserting of images can be found on the lines 139-163 of 'ImageManager/fckplugin.js'. I expect it is there where you can add code to wrap tags around images when inserted. (You'll have to check if there isn't already a div wrapping it too)
If that doesn't work:
For accessing the editor, try my 'HOWTO - Reach the API from out of a dialog': https://sourceforge.net/forum/forum.php ... _id=257180
Other HOWTO's I wrote are listed here: http://wiki.fckeditor.net/Developer%27s ... 692a53f762
Good luck,
Paul
FCKPlugins by saulmade: http://fckplugins.saulmade.nl/ (alias for http://www.saulmade.nl/FCKeditor/FCKPlugins.php)
FCKSkins by saulmade: http://fckskins.saulmade.nl/ (alias for http://www.saulmade.nl/FCKeditor/FCKSkins.php)
FCKSnippets by saulmade: http://fcksnippets.saulmade.nl/ (alias for http://www.saulmade.nl/FCKeditor/FCKSnippets.php)
RE: Adding Divs around Images in ImageManager
My code, For example:
FCK.InsertHTML('<div class="thumb tright"><div style="width:106px;">');
im = FCK.CreateElement('IMG');
FCK.InsertHTML('</div></div>');
FCKEditor HTML Output:
<div class="thumb tright"><div style="width:106px;"></div>
</div>
<img alt="" src="/_userfiles/image/1.jpg" />
<div></div>
<div></div>
Therefore, the 2 </div> tags should not be added until after the image code and the two begin <div> tags should not be created.
Any one know how to turn off "auto-complete" HTML tags for InsertHTML()?
It would be greatly appreciated!
Thanks.
RE: Adding Divs around Images in ImageManager
The easiest way is to create the div after the image has been created, put it in the same place and then move the image inside the div.