Find file: URLs when searching for embedded elements -- bug 10134

This commit is contained in:
akkana%netscape.com 1999-07-20 20:38:04 +00:00
Родитель 731a41f274
Коммит 3e2c2dce23
2 изменённых файлов: 26 добавлений и 28 удалений

Просмотреть файл

@ -471,10 +471,6 @@ NS_IMETHODIMP nsHTMLEditor::Copy()
NS_IMETHODIMP nsHTMLEditor::Paste() NS_IMETHODIMP nsHTMLEditor::Paste()
{ {
#ifdef DEBUG_akkana
printf("nsHTMLEditor::Paste()\n");
#endif
#ifdef ENABLE_JS_EDITOR_LOG #ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog); nsAutoJSEditorLogLock logLock(mJSEditorLog);
@ -502,7 +498,8 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
// Get the nsITransferable interface for getting the data from the clipboard // Get the nsITransferable interface for getting the data from the clipboard
if (trans) if (trans)
{ {
// Create the desired DataFlavor for the type of data we want to get out of the transferable // Create the desired DataFlavor for the type of data
// we want to get out of the transferable
nsAutoString htmlFlavor(kHTMLMime); nsAutoString htmlFlavor(kHTMLMime);
nsAutoString textFlavor(kTextMime); nsAutoString textFlavor(kTextMime);
nsAutoString imageFlavor(kJPEGImageMime); nsAutoString imageFlavor(kJPEGImageMime);
@ -540,9 +537,10 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
} }
else if (flavor.Equals(imageFlavor)) else if (flavor.Equals(imageFlavor))
{ {
image = (nsIImage *)data;
// Insert Image code here // Insert Image code here
NS_RELEASE(image); printf("Don't know how to insert an image yet!\n");
//image = (nsIImage *)data;
//NS_RELEASE(image);
rv = NS_ERROR_FAILURE; // for now give error code rv = NS_ERROR_FAILURE; // for now give error code
} }
} }
@ -552,9 +550,6 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
} }
nsServiceManager::ReleaseService(kCClipboardCID, clipboard); nsServiceManager::ReleaseService(kCClipboardCID, clipboard);
//printf("Trying to insert '%s'\n", stuffToPaste.ToNewCString());
// Now let InsertText handle the hard stuff:
return rv; return rv;
} }
@ -2699,9 +2694,6 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
if (!aNodeList) if (!aNodeList)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
#if 0
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsresult res; nsresult res;
res = NS_NewISupportsArray(aNodeList); res = NS_NewISupportsArray(aNodeList);
@ -2751,6 +2743,14 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
else if (tagName == "a") else if (tagName == "a")
{ {
// XXX Only include links if they're links to file: URLs // XXX Only include links if they're links to file: URLs
nsCOMPtr<nsIDOMHTMLAnchorElement> anchor (do_QueryInterface(content));
if (anchor)
{
nsAutoString href;
if (NS_SUCCEEDED(anchor->GetHref(href)))
if (href.Compare("file:", PR_TRUE, 5) == 0)
(*aNodeList)->AppendElement(node);
}
} }
} }
iter->Next(); iter->Next();
@ -2758,7 +2758,6 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
} }
return res; return res;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP

Просмотреть файл

@ -471,10 +471,6 @@ NS_IMETHODIMP nsHTMLEditor::Copy()
NS_IMETHODIMP nsHTMLEditor::Paste() NS_IMETHODIMP nsHTMLEditor::Paste()
{ {
#ifdef DEBUG_akkana
printf("nsHTMLEditor::Paste()\n");
#endif
#ifdef ENABLE_JS_EDITOR_LOG #ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog); nsAutoJSEditorLogLock logLock(mJSEditorLog);
@ -502,7 +498,8 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
// Get the nsITransferable interface for getting the data from the clipboard // Get the nsITransferable interface for getting the data from the clipboard
if (trans) if (trans)
{ {
// Create the desired DataFlavor for the type of data we want to get out of the transferable // Create the desired DataFlavor for the type of data
// we want to get out of the transferable
nsAutoString htmlFlavor(kHTMLMime); nsAutoString htmlFlavor(kHTMLMime);
nsAutoString textFlavor(kTextMime); nsAutoString textFlavor(kTextMime);
nsAutoString imageFlavor(kJPEGImageMime); nsAutoString imageFlavor(kJPEGImageMime);
@ -540,9 +537,10 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
} }
else if (flavor.Equals(imageFlavor)) else if (flavor.Equals(imageFlavor))
{ {
image = (nsIImage *)data;
// Insert Image code here // Insert Image code here
NS_RELEASE(image); printf("Don't know how to insert an image yet!\n");
//image = (nsIImage *)data;
//NS_RELEASE(image);
rv = NS_ERROR_FAILURE; // for now give error code rv = NS_ERROR_FAILURE; // for now give error code
} }
} }
@ -552,9 +550,6 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
} }
nsServiceManager::ReleaseService(kCClipboardCID, clipboard); nsServiceManager::ReleaseService(kCClipboardCID, clipboard);
//printf("Trying to insert '%s'\n", stuffToPaste.ToNewCString());
// Now let InsertText handle the hard stuff:
return rv; return rv;
} }
@ -2699,9 +2694,6 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
if (!aNodeList) if (!aNodeList)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
#if 0
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsresult res; nsresult res;
res = NS_NewISupportsArray(aNodeList); res = NS_NewISupportsArray(aNodeList);
@ -2751,6 +2743,14 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
else if (tagName == "a") else if (tagName == "a")
{ {
// XXX Only include links if they're links to file: URLs // XXX Only include links if they're links to file: URLs
nsCOMPtr<nsIDOMHTMLAnchorElement> anchor (do_QueryInterface(content));
if (anchor)
{
nsAutoString href;
if (NS_SUCCEEDED(anchor->GetHref(href)))
if (href.Compare("file:", PR_TRUE, 5) == 0)
(*aNodeList)->AppendElement(node);
}
} }
} }
iter->Next(); iter->Next();
@ -2758,7 +2758,6 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
} }
return res; return res;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP