Skip to content

Commit

Permalink
droptarget, drop text/html format
Browse files Browse the repository at this point in the history
Firefox send utf16 while Chrome send utf8, and there is no way to
identify which one is correct.
It seems HTML Format always in utf8 or ansi, so we will use it.
  • Loading branch information
riderkick committed Jul 30, 2015
1 parent 8a5fca2 commit 0ecae42
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions mangadownloader/forms/frmDropTarget.pas
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ implementation

var
CF_HTML: TCLIPFORMAT;
CF_TEXTHTML: TCLIPFORMAT;

{$R *.lfm}

Expand Down Expand Up @@ -218,9 +217,7 @@ function TFormDropTarget.CursorEffect(const AllowedEffects: Cardinal;

function TFormDropTarget.CanDrop(const DataObj: IDataObject): Boolean;
begin
Result := DataObj.QueryGetData(MakeFormatEtc(CF_TEXTHTML)) = S_OK;
if not Result then
Result := DataObj.QueryGetData(MakeFormatEtc(CF_HTML)) = S_OK;
Result := DataObj.QueryGetData(MakeFormatEtc(CF_HTML)) = S_OK;
if not Result then
Result := DataObj.QueryGetData(MakeFormatEtc(CF_UNICODETEXT)) = S_OK;
if not Result then
Expand Down Expand Up @@ -314,9 +311,6 @@ function TFormDropTarget.GetURLsFromHTML(const S: String): String;
function TFormDropTarget.ParseDataObj(const DataObj: IDataObject;
const Fmt: TClipboardFormat): String;
begin
if Fmt = CF_TEXTHTML then
Result := GetURLsFromHTML(GetWideTextFromObj(DataObj, Fmt))
else
if Fmt = CF_HTML then
Result := GetURLsFromHTML(GetTextFromObj(DataObj, Fmt))
else
Expand Down Expand Up @@ -390,7 +384,6 @@ function TFormDropTarget.Drop(const dataObj: IDataObject; grfKeyState: DWORD;
OleCheck(DataObj.EnumFormatEtc(DATADIR_GET, Enum));
if Assigned(OnDropChekout) then
if GetDataObjectFormats([
CF_TEXTHTML,
CF_HTML,
CF_UNICODETEXT,
CF_TEXT
Expand All @@ -408,6 +401,5 @@ procedure TFormDropTarget.CreateParams(var Params: TCreateParams);

initialization
CF_HTML := RegisterClipboardFormat('HTML Format');
CF_TEXTHTML := RegisterClipboardFormat('text/html');

end.

0 comments on commit 0ecae42

Please sign in to comment.