I'm sure I'm no the only person that has struggled for a while wondering why my insert module doesn't work, only to realise it's because I don't have the image tag in my html filter list.

Is it maybe an idea to ask the user whether it should be added, and to which filter?

Or is there a reason this isn't done?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

I don't think this is really a job for Insert module. Insert doesn't have any concept of input/text formats and it doesn't know which tags are allowed on which fields. It only inserts tags into textareas. Considering the customizations available (like Better Formats) which may hide the tag help from the HTML (plus theming that might do the same thing), I don't think Insert has a reliable source of this information (which means we'd need to add one). It's a lot of overhead for something that's only tangentially related.

quicksketch’s picture

Actually I was thinking more about this with a colleague. In reality, no module is going to claim responsibility for identifying this problem, since it's a hard problem to identify 100% of the time. However users of Insert commonly make this mistake, and we could probably solve the problem for 90% fairly easily. If the check fails because filter tips are hidden or there's only one input format, we can just bail on the check and not give an error at all.

So reconsidering I think we can give this a shot, I'll put together a patch and see how difficult this 90% case is.

quicksketch’s picture

Status: Active » Fixed
FileSize
4.8 KB
4.84 KB

I've applied this pair of patches which gives the user an error if they insert an image into a text format that doesn't support it. Overall I think this is a good improvement. The error isn't pretty, but it's extremely helpful that the user is at least warned that their image isn't going to work.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Ankabout’s picture

Only see this message now, but thanks quicksketch, looks like a great solution! Like you said, a small problem/solution, but will help a lot of people. Sometimes the small fixes have the biggest impacts.

Ankabout’s picture

Double-post