Widgets should be able to specify that they can handle certain media types. This allows advanced drag n' drop handling in the editor, such as automatically creating a ww-figure widget out of an image dragged into the editor.
Specification by developers
A static property mediaTypes on the widget's constructor is used to specify which media types the widget can handle. This is an array of valid MIME type strings.
// Imports are omitted
@customElement("my-widget")
class MyWidget extends LitElementWw {
static mediaTypes = ["image/png", "image/svg"]
}
Editing by teachers
When something is dropped or pasted into the editor, the media type should be checked. If the media type has no registered handler, a warning should be shown. If the media type has exactly one registered handler, a new handler element is created at the drop location and a drop or paste event is triggered synthetically on the newly created element. If the media type has two or more registered handlers, a dialog should be shown where the user can pick a handler.
Widgets should be able to specify that they can handle certain media types. This allows advanced drag n' drop handling in the editor, such as automatically creating a
ww-figure
widget out of an image dragged into the editor.Specification by developers A static property
mediaTypes
on the widget's constructor is used to specify which media types the widget can handle. This is an array of valid MIME type strings.Editing by teachers When something is dropped or pasted into the editor, the media type should be checked. If the media type has no registered handler, a warning should be shown. If the media type has exactly one registered handler, a new handler element is created at the drop location and a
drop
orpaste
event is triggered synthetically on the newly created element. If the media type has two or more registered handlers, a dialog should be shown where the user can pick a handler.Usage by students None