Project:Annotation
Version:master
Component:Code
Category:task
Priority:normal
Assigned:Jody Lynn
Status:needs work

Issue Summary

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.

Comments

#1

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

Status:active» closed (duplicate)

http://drupal.org/node/368409

#3

Status:closed (duplicate)» active

#4

Hello,

I am using this module, and I extended it in order to support cck fields. Unfortunately the only way i managed to do it was by hacking cck, adding a function call in content.module before the sanitize operation of each fields.

Does anyone have an idea how can we correctly allow the filter to understand to which field is it being applied?

Thanks

Hernani

#5

Assigned to:rwohleb» Anonymous

I haven't touched the annotation code in a while so I'm changing the assignment on this ticket.

#6

Assigned to:Anonymous» Jody Lynn

#7

Status:active» needs review

This patch switches from abuse of the filter system to use of straight node_load. Seems to work fine and lets annotations survive node editing, but needs more thorough testing.

AttachmentSize
386190.patch 14.36 KB

#8

This one also carries annotations across editing including new revisions.

AttachmentSize
annotations-through-revisions.patch 17.07 KB

#9

Minor improvement since last patch, to ensure only the spans added by annotation are removed from node bodies after edit.

AttachmentSize
386190-9.patch 17.07 KB

#10

Status:needs review» fixed

Committed.

#11

Status:fixed» needs work

As a cleanup for upgrading sites, we also should remove the old HTML comments (they can break teaser handling). We need an update function to truly clean that up, but as a quick fix this works:

/**
* Add the annotations to the text.
*/
function annotation_text_add_markup($text, $node, $teaser = FALSE) {
// Remove any old annotations html comments that are lingering from older
// version of annotations.
$text = str_replace('', '', $text);