*/
public class TestModule implements EntryPoint {
@Override
public void onModuleLoad() {
final EditorHarness harness = new EditorHarness() {
@Override
public void extend(Registries registries) {
MyDoodad.register(registries.getElementHandlerRegistry());
}
@Override
public String[] extendSampleContent() {
return new String[] {
"<mydoodad ref='pics/wave.gif'/>",
"<mydoodad ref='pics/yosemite-sm.jpg'/>",
"<mydoodad ref='pics/hills-sm.jpg'><mycaption>Howdy</mycaption></mydoodad>",
};
}
/**
* Extend the schema with our experimental new doodad.
*
* Note that this is only necessary for new element types that are not
* already in the main document schema.
*/
@Override
public DocumentSchema getSchema() {
return new DefaultDocumentSchema() {
{
// Permit our doodad to appear inside a <body> element
addChildren("body", MyDoodad.TAGNAME);
// Permit a 'ref' attribute on the <mydoodad> element.
// e.g. permit content like <mydoodad ref='pics/wave.gif'/>
addAttrs(MyDoodad.TAGNAME, MyDoodad.REF_ATTR);
// Permit our caption element to appear inside our doodad's main
// element, e.g.
// <mydoodad>
// <mycaption>text permitted here</mycaption>
// </mydoodad>
addChildren(MyDoodad.TAGNAME, MyDoodad.CAPTION_TAGNAME);
containsBlipText(MyDoodad.CAPTION_TAGNAME);
}
};
}
};
harness.run();
}