Back to index
|void||notifyOfInsertion (in AString mimeType, in nsIURL contentSourceURL, in nsIDOMDocument sourceDocument, in PRBool willDeleteSelection, inout nsIDOMNode docFragment, inout nsIDOMNode contentStartNode, inout long contentStartOffset, inout nsIDOMNode contentEndNode, inout long contentEndOffset, inout nsIDOMNode insertionPointNode, inout long insertionPointOffset, out boolean continueWithInsertion)|
|This notification occurs in an editor during these events: |
|void nsIContentFilter::notifyOfInsertion||(||in AString||mimeType,|
This notification occurs in an editor during these events:
The willDeleteSelection parameter is offered for filters who want to handle the insertion themselves and need to handle drag/drop correctly. The flag is true when the editor intends to delete the selection.
Callers who want to cancel all insertion can simply set continueWithInsertion to PR_FALSE and return. Note: If cancellation occurs during the "open" event, the editor will still be available but will be empty.
Callers who want to allow insertion of the data with no changes can simply set continueWithInsertion to PR_TRUE and return.
Callers who want to modify the content (docFragment) being inserted are responsible for updating contentStartNode, contentStartOffset, contentEndNode, and contentEndOffset (if necessary). Callers are responsible for freeing and addref'ing if they want to completely replace any of the DOM nodes passed in.
The location where insertion will occur should be considered an approximation since the editor may need to adjust it if it deletes the selection as part of the event and later determines that insertion point is an empty container which should also be removed (or in other scenarios such as -moz-user-select:none).
In some scenarios the selection will be deleted. If callers choose to adjust the insertion point, they should be careful that the insertion point is not in the current selection.
The contentStartNode and contentEndNode are not necessarily immediate children of the docFragment. Any nodes outside of the range set by contentStartNode and contentEndNode are for context from the source document.
|mimeType||the mimetype used for retrieving data|
|contentSourceURL||location where docFragment came from|
|sourceDocument||document where content came from (can be null)|
|willDeleteSelection||tells hook if selection will/should be deleted|
|docFragment||fragment of node to be inserted|
|contentStartNode||node under which content to be inserted begins|
|contentStartOffset||start offset within contentStartNode|
|contentEndNode||node under which content to be inserted ends|
|contentEndOffset||ending offset withing contentEndNode|
|insertionPointNode||location where insertion will occur|
|insertionPointOffset||offset within node where insertion occurs|
|continueWithInsertion||flag to cancel insertion (if desired)|