Hi,
I am using following code to insert images with hyperlink into the editor:
// SelectInternalHyperlinkAsObject is method which creates // new TWPOImage descendant class object. So different formats // has different classes - TdoWPSoundImage, TdoWPFlashImage etc...// lImageHyperlink is new object created by the method.lImageHyperlink:=SelectInternalHyperlinkAsObject(WorkWithRichText.Memo.RTFData);if Assigned(lImageHyperlink) thenbegin with lImageHyperlink do begin //... some settings here end; WorkWithRichText.SelectedObject := WorkWithRichText.TextObjects.Insert(lImageHyperlink); lHyperlinkObject := WorkWithRichText.HyperlinkAtCP; // we need to setup also hyperlink for this new object lPomS := CONST_HYPERLINK_GUID + TdoWPImage(lImageHyperlink).GUID; if lHyperlinkObject <> nil then lHyperlinkObject.Source := lPomS else WorkWithRichText.InputHyperlink(lPomS);end;
I need the inserted hyperlink available when showing the text inside the application.
I have also created new HTML writer class, to be able to render our own object for the web browsers as needed.
In the writer I override the method WriteObject and I am calling the appropriate code to render correct HTML for the TdoWPSoundImage and other objects. But here is the problem. Because the Hyperlink text object is always generated as A tag, I always get something like
<a href ....><embed id........></a>
the embed part is our own code. The a href part is from hyperlink object. This makes some problems for us.
I have method which is called before the rich text is generated to html. In this method I need to delete some of the hyperlinks, based on the hyperlink's inner image object class. My idea is:
- Iterate throught all TextObjects inside the richtext. (I know how to do it 🙂
- If the objref for current object is our own class (TdoWPSoundImage) then delete its text hyperlink object (I have no idea how to do this - I can select hyperlink at CP but How can I found the CP for the selected object). Or is there any other way how to solve it?
Can you help me, please?
Petr.