[Phpwm] CSS highlighting

Phil Beynon phil at infolinkelectronics.co.uk
Thu May 10 23:36:27 BST 2007


> > another question......
> >
> > Is there a way to use CSS & or javascript to highlight a text
> sub string, in
> > a similar way as setting the background colour via tags?
> >
> > Obviously just in a bit of text printed on the screen its just
> a matter (as
> > a minimum effort) of wrapping it in a font tag background =
> whatever, but
> > I'm aiming to higlight pattern matched bits into and editable
> Iframe / text
> > editor GUI bit, so I don't want scatered remains of tags etc
> lurking in the
> > text should the user delete the highlighted bit.
> > Since the user could edit all or anything anything around the
> highlighted
> > bit it might be tricky to maintain exactly where any
> highlighting bits were
> > initially once the edited text is returned back to the server.
> >
> > Something like a client side preg_replace() where the highlighting was
> > actually at a level where it was untouchable during editing really.
>
> I presume what you're asking for cannot be any different to how e.g.
> tinymce (or other js editors) handle text that may be
> formatted/highlighted etc. ?
>
> In which case, why not just use something like TinyMCE?
>
> David.

Hi David,
No, thats not what I'm trying to do. I use the TTW editor interface, which
whilst it isn't quite as complex is, I find to be a lot nearer what my
customers seem to like! It does stuff like highlighting formatting.
What I'm trying to do is nearer to this
http://javascript.about.com/library/blhilite.htm where the highlighting is
done within the actual browser via css - i.e. there is no difference between
the content on the page before or after the highlighting has occured (as
looking atthe page source).
It seems to do this via .innerHTML and a <span>
I can pretty much see how it works, or should work, but I want it to use
just the text content of the iframe, and have no access to the main page
body at all.
Plus it needs the ability to highlight a pseudo tag which is used to embed
inclusion objects - like locations of .pdf files, images, media etc based
upon an incoming URL variable.

Essentially it gets triggered as part of the deletion impact protocol,
showing a user who is about to delete an inclusion object where it occurs
within the page's content.

All good fun! :-)

Phil




More information about the Phpwm mailing list