All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vaadin.polymer.marked.widget.MarkedElement Maven / Gradle / Ivy

There is a newer version: 1.9.3.1
Show newest version
/*
 * This code was generated with Vaadin Web Component GWT API Generator, 
 * from marked-element project by The Polymer Project Authors (https://polymer.github.io/AUTHORS.txt)
 * that is licensed with https://polymer.github.io/LICENSE.txt license.
 */
package com.vaadin.polymer.marked.widget;

import com.vaadin.polymer.marked.element.*;

import com.vaadin.polymer.PolymerWidget;
import com.vaadin.polymer.elemental.*;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.core.client.JavaScriptObject;

/**
 * 

Element wrapper for the marked library.

*

<marked-element> accepts Markdown source either via its markdown attribute:

*
<marked-element markdown="`Markdown` is _awesome_!"></marked-element>
 * 
 * 
 * 

Or, you can provide it via a <script type="text/markdown"> element child:

*
<marked-element>
 *   <script type="text/markdown">
 *     Check out my markdown!
 * 
 *     We can even embed elements without fear of the HTML parser mucking up their
 *     textual representation:
 * 
 *     ```html
 *     <awesome-sauce>
 *       <div>Oops, I'm about to forget to close this div.
 *     </awesome-sauce>
 *     ```
 *   </script>
 * </marked-element>
 * 
 * 
 * 

Note that the <script type="text/markdown"> approach is static. Changes to
the script content will not update the rendered markdown!

*/ public class MarkedElement extends PolymerWidget { /** * Default Constructor. */ public MarkedElement() { this(""); } /** * Constructor used by UIBinder to create widgets with content. */ public MarkedElement(String html) { super(MarkedElementElement.TAG, MarkedElementElement.SRC, html); } /** * Gets a handle to the Polymer object's underlying DOM element. */ public MarkedElementElement getPolymerElement() { return (MarkedElementElement) getElement(); } /** *

The markdown source that should be rendered by this element.

* * JavaScript Info: * @property markdown * @type String * */ public String getMarkdown(){ return getPolymerElement().getMarkdown(); } /** *

The markdown source that should be rendered by this element.

* * JavaScript Info: * @property markdown * @type String * */ public void setMarkdown(String value) { getPolymerElement().setMarkdown(value); } /** *

Renders markdown into this element’s DOM.

*

This is automatically called whenever the markdown property is changed.

*

The only case where you should be calling this is if you are providing
markdown via <script type="text/markdown"> after this element has been
constructed (or updating that markdown).

* * JavaScript Info: * @method render * */ public void render() { getPolymerElement().render(); } /** *

Renders markdown to HTML when the element is attached.

*

This serves a dual purpose:

*
    *
  • Prevents unnecessary work (no need to render when not visible).

    *
  • *
  • attached fires top-down, so we can give ancestors a chance to
    register listeners for the syntax-highlight event before we render
    any markdown.

    *
  • *
* * JavaScript Info: * @method attached * */ public void attached() { getPolymerElement().attached(); } /** * * * JavaScript Info: * @method detached * */ public void detached() { getPolymerElement().detached(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy