/// <reference path="../Say.ts" />
class SayLink extends Say {
    private linkedAction : Action;

    public setAction (action : Action) {
        this.linkedAction = action;
    }

    public async getPureElements () : Promise<Array<Element | Text>> {
        let paragraphs = await this.getParagraphs();

        let elements = paragraphs.length == 1 ? paragraphs[0] : Array.prototype.concat.apply([], paragraphs);

        let b = document.createElement("b");
        b.classList.add("textLink");
        elements.forEach((element) => {
            b.appendChild(element);
        });

        Controls.Links.makeLink(b, this.linkedAction);

        return [b];
    }
}