trichview.support
Re: HTML WYSIWYG and images |
Author |
Message |
James Crosswell |
Posted: 02/16/2005 14:04:16 James Crosswell wrote: > // TODO: work out the original url that was used > // for the image when it was imported... if I'm > // lucky the importers will have stored this in a > // tag or a filename or something and I can get at > // it using a GetTag(ItemNo) or something... but I'm > // a bit stuck here Hm - I think I see my problem. I'm currently trying: procedure TfrmHTMLEditor.txtEditorSaveItemToFile(Sender: TCustomRichView; const Path: String; RVData: TCustomRVData; ItemNo: Integer; SaveFormat: TRVSaveFormat; Unicode: Boolean; var OutStr: String; var DoDefault: Boolean); var S: string; // statements i: Integer; item: TRVGraphicItemInfo; begin inherited; // Just to see what we can do with these images if ( RVData.GetItemStyle(ItemNo) = rvsPicture ) then if SaveFormat = rvsfHTML then begin item := TRVGraphicItemInfo( Sender.GetItem( ItemNo ) ); OutStr := GetTagStr( txtEditor, item.Tag ); DoDefault := False; end; end; However, lines 2136 through 2155 of the rvhtmlimport.LoadHtml method read as follows: (**************************< snip >**************************) TmpStyle := rvsPicture; Link := 0; if (CurrLink <> '') then begin RemoveLineBreaks(CurrLink); if rvhtmloBasePathLinks in Options then CurrLink := GetFullFileName(CurrLink); if (rvhtmloAutoHyperlinks in Options) and (rvoTagsArePChars in RichView.Options) then begin Link := integer(StrNew(PChar(CurrLink))); TmpStyle := rvsHotPicture; end else begin RVData.ReadHyperlink(CurrLink, '', rvlfHTML, TmpStyle, Link, ts2); end; end; GraphicItem := CreateRichViewItem(TmpStyle, RVData) as TRVGraphicItemInfo; GraphicItem.Tag := Link; GraphicItem.Image := gr; GraphicItem.ParaNo := GetCurParaNo; RVData.AddItem(ts2, GraphicItem); (**************************< snip >**************************) So the way I read this is that the Tag value of a GraphicItem will ONLY have a value if the image is surrounded by a Link and in that case the tag will contain the value of the hyperlink - not of the image location itself... As such, the original image location is currently not being stored and there is currently no way to retrieve this during the SaveItemToFile event handler of the RichView component... I could replace the Tag for the GraphicItem with the location of the image, but that means that hyperlinks for images would be broken in HTML documents that I opened/saved using the RichView component. Is that a fairly accurate analysis of the situation and is there anything that I can do about this? I'd really appreciate your in put on this Sergey - this is sort of an emergency: (see http://microforge.net/kb/108 for details). Thanks in advance. Best Regards James Crosswell Software Engineer Microforge.net Limited http://www.microforge.net |
Powered by ABC Amber Outlook Express Converter