Search in sources :

Example 1 with IncludePlugin

use of org.markdown4j.client.IncludePlugin in project blogwt by billy1380.

the class PostHelper method handlePluginContentReady.

public static HandlerRegistration handlePluginContentReady() {
    return processor().addPluginContentReadyHandler((event, plugin, lines, params, id, content) -> {
        Element el = Document.get().getElementById(id);
        if (plugin instanceof IncludePlugin || plugin instanceof PostsPlugin) {
            if (el != null && content != null) {
                el.setInnerHTML(content);
            }
        } else if (plugin instanceof MapPlugin) {
            if (el != null) {
                MapHelper.showMap(el, lines, params);
            }
        } else if (plugin instanceof FormPlugin) {
            if (el != null && content != null) {
                el.removeAllChildren();
                // FIXME: probably leaking this
                // on unload never seems to get called
                Widget form = FormPlugin.createWidget(lines, params);
                RootPanel.get().add(form);
                el.appendChild(form.getElement());
            }
        }
    });
}
Also used : MapPlugin(com.willshex.blogwt.client.markdown.plugin.MapPlugin) Element(com.google.gwt.dom.client.Element) IncludePlugin(org.markdown4j.client.IncludePlugin) Widget(com.google.gwt.user.client.ui.Widget) PostsPlugin(com.willshex.blogwt.client.markdown.plugin.PostsPlugin) FormPlugin(com.willshex.blogwt.client.markdown.plugin.FormPlugin)

Aggregations

Element (com.google.gwt.dom.client.Element)1 Widget (com.google.gwt.user.client.ui.Widget)1 FormPlugin (com.willshex.blogwt.client.markdown.plugin.FormPlugin)1 MapPlugin (com.willshex.blogwt.client.markdown.plugin.MapPlugin)1 PostsPlugin (com.willshex.blogwt.client.markdown.plugin.PostsPlugin)1 IncludePlugin (org.markdown4j.client.IncludePlugin)1