import Renderables from '../Renderables';
import node from "../../support/node";
import { Specification } from "../../support/Specification";
/**
 * Implementation of the 'link' markup element. An
 * a HTML element is created and the given attributes
 * for href and target are taken over from the markup. The
 * class lto-link is added to allow CSS manipulations.
 *
 * @see {@link IRenderable}
 */
var Link = /** @class */ (function () {
    function Link(spec) {
        this.spec = spec;
    }
    /**
     * @inheritDoc
     */
    Link.prototype.render = function (renderer, isNested) {
        var link = node("a");
        link.addAttributes({
            href: Link.decode(this.spec.value || ""),
            target: '_blank'
        });
        new Specification(this.spec).initNode(link, "lto-link");
        return link.unwrap();
    };
    Link.decode = function (input) {
        var txt = document.createElement("textarea");
        txt.innerHTML = input;
        return txt.value;
    };
    return Link;
}());
export { Link };
Renderables.register("link", Link);
//# sourceMappingURL=index.js.map