I don't understand how inserting a image is different from inserting an image? If you get the html from an dialog, you can feed it into insertHtml, I suppose...
No matter what I try, anything I select using the DHTML menu I have configured is entered on the top line because the editing area loses focus when I click the menu.
I'm am now trying to use something like FCKSelection.GetSelection().createRange().text with editorInstance.Events.AttachEvent( 'OnSelectionChange', updateSelection ) or ..OnBlur and ...OnFocus but I'm having trouble figuring out if there is a value like SelectionStart, SelectionEnd, or something along those lines with the GetSelection() function. I want to throw the position into a hidden field and then have the html inserted into that spot.
If I insert some hidden html code such as <!--thisisthecursorposition--> when OnBlur is triggered, maybe I can search and replace <!--thisisthecursorposition--> with the html code I am trying to insert once OnFocus is triggered.
The problem you mentioned should has been fixed in 2.6.1. Fck 2.6.2 might have a regression bug.... This is the current IE-code:
FCK.InsertHtml = function( html )
{
html = FCKConfig.ProtectedSource.Protect( html ) ;
html = FCK.ProtectEvents( html ) ;
html = FCK.ProtectUrls( html ) ;
html = FCK.ProtectTags( html ) ;
// FCK.Focus() ;
FCKSelection.Restore() ;
FCK.EditorWindow.focus() ;
FCKUndo.SaveUndoStep() ;
// Gets the actual selection.
var oSel = FCKSelection.GetSelection() ;
// Deletes the actual selection contents.
if ( oSel.type.toLowerCase() == 'control' )
oSel.clear() ;
// Using the following trick, any comment in the beginning of the HTML will
// be preserved.
html = '<span id="__fakeFCKRemove__" style="display:none;">fakeFCKRemove</span>' + html ;
// Insert the HTML.
oSel.createRange().pasteHTML( html ) ;
// Remove the fake node
FCK.EditorDocument.getElementById('__fakeFCKRemove__').removeNode( true ) ;
FCKDocumentProcessor.Process( FCK.EditorDocument ) ;
// For some strange reason the SaveUndoStep() call doesn't activate the undo button at the first InsertHtml() call.
this.Events.FireEvent( "OnSelectionChange" ) ;
}
FCK.SetInnerHtml = function( html ) // IE Only
{
var oDoc = FCK.EditorDocument ;
// Using the following trick, any comment in the beginning of the HTML will
// be preserved.
oDoc.body.innerHTML = '<div id="__fakeFCKRemove__"> </div>' + html ;
oDoc.getElementById('__fakeFCKRemove__').removeNode( true ) ;
}
martinkou wrote:I've posted a new workaround for the generic case in https://dev.fckeditor.net/ticket/2376. Note that you'll have to download the SVN code and apply the patch to see the effect, applying the patch to the released code package has no effect.
martinkou wrote:I've posted a new workaround for the generic case in https://dev.fckeditor.net/ticket/2376. Note that you'll have to download the SVN code and apply the patch to see the effect, applying the patch to the released code package has no effect.
So I tried patching fckeditorcode_ie.js with the workaround and it didn't work. Is that what martinkou means when he says that applying the patch to the released code package has no effect? I don't see how else I would apply the patch.
Re: Javascript API Insert Issue
Re: Javascript API Insert Issue
Re: Javascript API Insert Issue
Re: Javascript API Insert Issue
I'm am now trying to use something like FCKSelection.GetSelection().createRange().text with editorInstance.Events.AttachEvent( 'OnSelectionChange', updateSelection ) or ..OnBlur and ...OnFocus but I'm having trouble figuring out if there is a value like SelectionStart, SelectionEnd, or something along those lines with the GetSelection() function. I want to throw the position into a hidden field and then have the html inserted into that spot.
Any ideas?
Re: Javascript API Insert Issue
But
var ed = FCKeditorAPI.GetInstance('FCKeditor1') ; // ed.Selection contains following functions // "GetParentBlock", "ApplyStyle", "GetType", "GetSelectedElement", "GetParentElement", "GetBoundaryParentElement", "SelectNode", "Collapse", "HasAncestorNode", "MoveToAncestorNode", "Delete", "GetSelection", "Save", "Restore", "Release"for example, if I have selected image and then you can refer to its src in this way
oh, wait you need to insert at cursor position.
Well, InsertHtml works perfectly in ff3. When I have a text input in a webpage with
<input type="text" onClick = "f()"> // and.. function f() { var ed = FCKeditorAPI.GetInstance('FCKeditor1') ; ed.InsertHtml('<b>boe</b>'); }it works. So their is something wrong with you browser or code.
Re: Javascript API Insert Issue
Re: Javascript API Insert Issue
If I insert some hidden html code such as <!--thisisthecursorposition--> when OnBlur is triggered, maybe I can search and replace <!--thisisthecursorposition--> with the html code I am trying to insert once OnFocus is triggered.
hmmmm
Re: Javascript API Insert Issue
viewtopic.php?f=6&t=8814
Re: Javascript API Insert Issue
This is the current IE-code:
FCK.InsertHtml = function( html ) { html = FCKConfig.ProtectedSource.Protect( html ) ; html = FCK.ProtectEvents( html ) ; html = FCK.ProtectUrls( html ) ; html = FCK.ProtectTags( html ) ; // FCK.Focus() ; FCKSelection.Restore() ; FCK.EditorWindow.focus() ; FCKUndo.SaveUndoStep() ; // Gets the actual selection. var oSel = FCKSelection.GetSelection() ; // Deletes the actual selection contents. if ( oSel.type.toLowerCase() == 'control' ) oSel.clear() ; // Using the following trick, any comment in the beginning of the HTML will // be preserved. html = '<span id="__fakeFCKRemove__" style="display:none;">fakeFCKRemove</span>' + html ; // Insert the HTML. oSel.createRange().pasteHTML( html ) ; // Remove the fake node FCK.EditorDocument.getElementById('__fakeFCKRemove__').removeNode( true ) ; FCKDocumentProcessor.Process( FCK.EditorDocument ) ; // For some strange reason the SaveUndoStep() call doesn't activate the undo button at the first InsertHtml() call. this.Events.FireEvent( "OnSelectionChange" ) ; } FCK.SetInnerHtml = function( html ) // IE Only { var oDoc = FCK.EditorDocument ; // Using the following trick, any comment in the beginning of the HTML will // be preserved. oDoc.body.innerHTML = '<div id="__fakeFCKRemove__"> </div>' + html ; oDoc.getElementById('__fakeFCKRemove__').removeNode( true ) ; }Re: Javascript API Insert Issue
Can I use some code from 2.6.1?
I am using version 2.6.2 Build 19417.
Re: Javascript API Insert Issue
http://sourceforge.net/project/showfile ... e_id=75845
Re: Javascript API Insert Issue
https://dev.fckeditor.net/ticket/2376
Re: Javascript API Insert Issue
applyed the patch to version 2.6.1 and it didn't resolve the problem
Re: Javascript API Insert Issue
Re: Javascript API Insert Issue
Re: Javascript API Insert Issue
Re: Javascript API Insert Issue
http://svn.fckeditor.net/MediaWiki/trunk
http://sourceforge.net/project/showfile ... e_id=75845
https://dev.fckeditor.net/ticket/2376
http://www.fckeditor.net/nightly/FCKeditor_N.tar.gz