com.vaadin.polymer.prism.widget.PrismHighlighter Maven / Gradle / Ivy
/*
* This code was generated with Vaadin Web Component GWT API Generator,
* from prism-element project by The Polymer Project Authors (https://polymer.github.io/AUTHORS.txt)
* that is licensed with http://polymer.github.io/LICENSE.txt license.
*/
package com.vaadin.polymer.prism.widget;
import com.vaadin.polymer.prism.*;
import com.vaadin.polymer.*;
import com.vaadin.polymer.elemental.*;
import com.vaadin.polymer.PolymerWidget;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.core.client.JavaScriptObject;
/**
* Syntax highlighting via Prism.
* Place a <prism-highlighter>
in your document, preferably as a direct child of
<body>
. It will listen for syntax-highlight
events on its parent element,
and annotate the code being provided via that event.
* The syntax-highlight
event’s detail is expected to have a code
property
containing the source to highlight. The event detail can optionally contain a
lang
property, containing a string like "html"
, "js"
, etc.
* This flow is supported by <marked-element>
.
*/
public class PrismHighlighter extends PolymerWidget {
/**
* Default Constructor.
*/
public PrismHighlighter() {
this("");
}
/**
* Constructor used by UIBinder to create widgets with content.
*/
public PrismHighlighter(String html) {
super(PrismHighlighterElement.TAG, PrismHighlighterElement.SRC, html);
}
/**
* Gets a handle to the Polymer object's underlying DOM element.
*/
public PrismHighlighterElement getPolymerElement() {
return (PrismHighlighterElement) getElement();
}
/**
* Adds languages outside of the core Prism languages.
* Prism includes a few languages in the core library:
*
* - JavaScript
* - Markup
* - CSS
* - C-Like
Use this property to extend the core set with other Prism
components and custom languages.
*
* Example:
* <!-- with languages = {'custom': myCustomPrismLang}; -->
* <!-- or languages = Prism.languages; -->
* <prism-highlighter languages="[[languages]]"></prism-highlighter>
*
*
* JavaScript Info:
* @property languages
* @type !Object
*
*/
public JavaScriptObject getLanguages() {
return getPolymerElement().getLanguages();
}
/**
* Adds languages outside of the core Prism languages.
* Prism includes a few languages in the core library:
*
* - JavaScript
* - Markup
* - CSS
* - C-Like
Use this property to extend the core set with other Prism
components and custom languages.
*
* Example:
* <!-- with languages = {'custom': myCustomPrismLang}; -->
* <!-- or languages = Prism.languages; -->
* <prism-highlighter languages="[[languages]]"></prism-highlighter>
*
*
* JavaScript Info:
* @property languages
* @type !Object
*
*/
public void setLanguages(JavaScriptObject value) {
getPolymerElement().setLanguages(value);
}
// Needed in UIBinder
/**
* Adds languages outside of the core Prism languages.
* Prism includes a few languages in the core library:
*
* - JavaScript
* - Markup
* - CSS
* - C-Like
Use this property to extend the core set with other Prism
components and custom languages.
*
* Example:
* <!-- with languages = {'custom': myCustomPrismLang}; -->
* <!-- or languages = Prism.languages; -->
* <prism-highlighter languages="[[languages]]"></prism-highlighter>
*
*
* JavaScript Info:
* @attribute languages
*
*/
public void setLanguages(String value) {
Polymer.property(this.getPolymerElement(), "languages", value);
}
}