Bug 169384 - [DnD] Dragging image file to editor should insert corresponding tag
Summary: [DnD] Dragging image file to editor should insert corresponding tag
Status: NEW
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: Future   Edit
Assignee: wst.sse CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-01-02 18:32 EST by Benjamin Muskalla CLA
Modified: 2013-07-18 14:17 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Muskalla CLA 2007-01-02 18:32:11 EST
When dragging an image file from the navigator view to an active wst editor, it should insert the corresponding image tag for it:

example:
drag foo.jpg to the editor of bar.xhtml, should insert <img src="relative/path" alt="" title="" />

As this not needs to be the default behavior, we could implement a additional modifer key for that. Like Ctrl+DnD.

Another thing could be implemented for the css editor where something like this could be inserted:
url('path/to/image')


To make this a little overkill, we could implement some new settings like templates. Let's say, we have a preferences page where you can assign a dnd-insert-template for specific file extensions:

*.jpg ->  <img src="%FILEPATH%" width="%IMAGEWIDTH%" height="%IMAGEHEIGHT%" alt="" title="" />

*.html -> %FILECONTENT%

*.css -> <link href="%FILEPATH%" rel="stylesheet" type="text/css" media="screen,print" />

With this way, there could be done many quick inserts without having a full WYSIWYG functionality (which i personally don't like).

Maybe there should also a project-wide setting for a base-directory from which the relative pathes to the files are calculated. Imagine a project structure like this:

- pub (DocRoot)
  - images
  - css
- templates

This way, we need to set pub as base-dir when editing template files...

I hope this is something interesting for other devs. I'm very open for comments.
If there is enough interest, i would be happy to contribute such an extension.