Stop abusing the filter API

rwohleb - February 27, 2009 - 21:07
Project:Annotation
Version:HEAD
Component:Code
Category:task
Priority:normal
Assigned:rwohleb
Status:active
Description

The filter system doesn't support passing contexts. I've hacked away to do this, but it's not ideal. Investigate if we can just do something with nodeapi.

#1

drumm - March 13, 2009 - 23:55
Title:Investigate ways to move away from filters» Stop abusing the filter API

Is this sane?

  1. On selection, get each selected region's text, HTML removed, from jquery.wrapSelection.js. For example, Lorem ipsum dolor sit amet.</p><p>Consectetur <em>adipisicing</em> elit. is two regions.
  2. Stripping all HTML tags, get the instance number of the selection's text, in case the same text occurs multiple times.

  3. Add annotation span tags to the original body text. Strip HTML, keeping track of how many characters are stripped. Find the selected text and calculate the annotation span location in the original text. Add those spans and save the body field.

This makes text editable and handles filter reconfigurations. It does break if filters insert non-HTML text or if the HTML filter takes out the span tags, but I think those are problems anyway. It requires no PHP processing on output. The spans may get a bit stacked, but all that needs to be done is go through clicked span's parents and find the associated comments.

#2

drumm - March 13, 2009 - 23:58
Status:active» duplicate

http://drupal.org/node/368409

#3

drumm - March 14, 2009 - 00:21
Status:duplicate» active
 
 

Drupal is a registered trademark of Dries Buytaert.