Hi.
I want to create a plugin that insert the following code at cursor position.
<br clear="all" />
I need the tag to be represented by a placeholder (gif image) in FCKedtior so the editor (writer) see where those special BR tags are inserted.
Have looked at how the anchor are implemented... but I'm not able to do this myself....
I need it to work allmost as the Anchor works today, except I do not need the dialog where you give the object an name.
Anyone out there that could help???
I want to create a plugin that insert the following code at cursor position.
<br clear="all" />
I need the tag to be represented by a placeholder (gif image) in FCKedtior so the editor (writer) see where those special BR tags are inserted.
Have looked at how the anchor are implemented... but I'm not able to do this myself....
I need it to work allmost as the Anchor works today, except I do not need the dialog where you give the object an name.
Anyone out there that could help???
RE: Help need placeholder plugin <BR clear="a
I found out how to insert the needed tag:
<br clear="all" /> with a placeholder image by using the function below (functin is placed in page that the editor is within):
function insertClear(){
var oFCK;
if (navigator.appName=="Netscape")
oFCK = MyTextarea___Frame.contentWindow;
else
oFCK = MyTextarea___Frame;
oAnchor = oFCK.FCK.EditorDocument.createElement( 'DIV' ) ;
oAnchor.innerHTML = '<br clear="all">' ;
oAnchor = oAnchor.firstChild ;
oFakeImage = oFCK.FCKDocumentProcessors_CreateFakeImage( 'FCK__Clear', oAnchor ) ;
oFakeImage.setAttribute( '_fckanchor', 'true', 0 ) ;
oFakeImage = oFCK.FCK.InsertElementAndGetIt( oFakeImage ) ;
}
I also changed the file "/css/fck_internal.css" and added:
.FCK__Clear
{
background-position: center center;
background-image: url(images/fck_clear.gif);
background-repeat: no-repeat;
width: 14px ;
height: 14px ;
}
and created the image fck_clear.gif and put in same folder as the fck_anchor.gif image.
So far so good. I'm now able to create the new tag by clicking a button in my page ( I know how to create a plugin for this... laiter)
Now a new challenge:
My guess is that if I enter some of these new TAGS:
<br clear="all" />
into the editor with some text and submit to database for saving .... and then fetch the data from the database and display it again .....
then the placeholder image will not be displayed...
What do I have to do for FCKeditor to recognise the new tag and create/insert placeholder stuff when editor initializes?
Look forward to see a solution on that?
RE: placeholder plugin <BR clear="all" />
Ref. my prev. post.
The tag was inserted and the placeholder displayed.
But the placeholder does not show up in the right place.
Why is that and how do I fix that?
RE: Help need placeholder plugin <BR clear="a
Yes I know I can use the following code:
oFCK.FCK.InsertHtml("<br clear=\"all\" />");
It works. But without any placeholder.
A small annoying thing in FF with this solution is that the text before the newly inserted BR is selected (highlighted) and this highlight does not get away when I start typing...
A small annoying thing in IE is that when I insert the TAG then the cursor does not move to new position immediately..... only when I start typing the cursor moves down to right position.
Is there a way to make highlight be removed in FF right after the insertion of the tag, as well as move cursor to right position in IE?
Tested on XP and IE 6.0 and FF 1.0.6