Closed Bug 203062 Opened 23 years ago Closed 23 years ago

missing drop hook and move to utility methods

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: Brade, Assigned: Brade)

References

Details

(Keywords: topembed)

Attachments

(2 files)

We are missing a callback to drophook in DragOver. Also, we should move all of this hook stuff to nsEditorUtils.cpp.
Attached patch missing hook v1Splinter Review
Comment on attachment 121434 [details] [diff] [review] missing hook v1 >Index: libeditor/base/nsEditorUtils.cpp >=================================================================== >+/****************************************************************************** >+ * utility methods for drag/drop/copy/paste hooks >+ *****************************************************************************/ >+ >+nsresult >+nsEditorHookUtils::GetHookEnumeratorFromDocument(nsIDOMDocument *aDoc, >+ nsISimpleEnumerator **aResult) >+{ >+ nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc); >+ if (!doc) return NS_ERROR_FAILURE; >+ >+ nsCOMPtr<nsISupports> isupp; >+ doc->GetContainer(getter_AddRefs(isupp)); >+ nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(isupp); >+ nsCOMPtr<nsIClipboardDragDropHookList> hookObj = do_GetInterface(docShell); >+ if (!hookObj) return NS_ERROR_FAILURE; >+ >+ nsCOMPtr<nsISimpleEnumerator> enumerator; >+ hookObj->GetHookEnumerator(getter_AddRefs(enumerator)); >+ if (!enumerator) return NS_ERROR_FAILURE; >+ >+ *aResult = enumerator; >+ NS_ADDREF(*aResult); >+ return NS_OK; >+} You could just return hookObj->GetHookEnumerator(aResult); here. Otherwise it looks good!
Attachment #121434 - Flags: superreview+
Comment on attachment 121434 [details] [diff] [review] missing hook v1 r=kin@netscape.com with sfraser's issue addressed. My one concern is that this change will prevent embedders from ever extending the types of data that can be dropped into the editor, for example if they had the ability to convert RTF to HTML, since the editor will deny the drop and never give the hooks a crack at saying yes. I guess we can file another bug to track that issue? PRBool canDrop = CanDrop(aDragEvent); + if (canDrop) + { + nsCOMPtr<nsIDOMDocument> domdoc; + mEditor->GetDocument(getter_AddRefs(domdoc)); + canDrop = nsEditorHookUtils::DoAllowDropHook(domdoc, aDragEvent, dragSession); + } +
Attachment #121434 - Flags: review+
Attached patch updated patchSplinter Review
FYI, I filed bug 203105 to track the CanDrop()/DoAllowDropHook() issue I mentioned above.
Attachment #121469 - Flags: superreview?(sfraser)
Attachment #121469 - Flags: superreview?(sfraser) → superreview+
Comment on attachment 121469 [details] [diff] [review] updated patch r=kaie on the differences between this patch and the previous version - carrying forward the other review
Attachment #121469 - Flags: review+
I would like to land this patch for 1.4beta. It cleans up the editor code (better factoring) for dealing with the hooks that initially landed as part of bug 197121. I'd like this to land for 1.4beta for editor embedding.
Blocks: 197121
Status: NEW → ASSIGNED
Flags: blocking1.4b?
Comment on attachment 121469 [details] [diff] [review] updated patch a=asa (on behalf of drivers) for checkin to 1.4b
Attachment #121469 - Flags: approval1.4b+
patch checked in
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
fixed, so clearing blocker request.
Flags: blocking1.4b?
i did some simple d'n'd btwn editor windows, mail compose and a browser window, and this looks fine. let me know if there's a particular scenario[s] i should check out --but otherwise this looks fine with 2003.05.13 builds.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: