Search in sources :

Example 1 with FormPlugin

use of com.willshex.blogwt.client.markdown.plugin.FormPlugin 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)

Example 2 with FormPlugin

use of com.willshex.blogwt.client.markdown.plugin.FormPlugin in project blogwt by billy1380.

the class Processor method registerPlugins.

/* (non-Javadoc)
	 * 
	 * @see org.markdown4j.client.MarkdownProcessor#registerPlugins() */
@Override
protected void registerPlugins() {
    CachedIncludePlugin includePlugin = new CachedIncludePlugin(ensureManager());
    includePlugin.setProcessor(this);
    String mapsApiKey = PropertyController.get().stringProperty(PropertyHelper.MARKDOWN_MAPS_API_KEY);
    if (mapsApiKey != null && mapsApiKey.trim().length() == 0) {
        mapsApiKey = null;
    }
    registerPlugins(new WebSequencePlugin(ensureManager()), includePlugin, new GalleryPlugin(ensureManager()), mapsApiKey == null ? null : new MapPlugin(mapsApiKey, ensureManager()), new YoutubePlugin(), new FormPlugin(ensureManager()), new PostsPlugin(ensureManager()));
}
Also used : MapPlugin(com.willshex.blogwt.client.markdown.plugin.MapPlugin) GalleryPlugin(com.willshex.blogwt.client.markdown.plugin.GalleryPlugin) CachedIncludePlugin(com.willshex.blogwt.client.markdown.plugin.CachedIncludePlugin) PostsPlugin(com.willshex.blogwt.client.markdown.plugin.PostsPlugin) YoutubePlugin(com.willshex.blogwt.client.markdown.plugin.YoutubePlugin) FormPlugin(com.willshex.blogwt.client.markdown.plugin.FormPlugin) WebSequencePlugin(org.markdown4j.client.WebSequencePlugin)

Aggregations

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