@paperbits/core
Version:
Paperbits core components.
31 lines (26 loc) • 876 B
text/typescript
import * as ko from "knockout";
import template from "./textStyleSelector.html";
import { Component, Param, Event, OnMounted } from "@paperbits/common/ko/decorators";
import { StyleService } from "@paperbits/styles";
({
selector: "text-style-selector",
template: template
})
export class TextStyleSelector {
constructor(private readonly styleService: StyleService) {
this.styles = ko.observableArray();
}
public styles: ko.ObservableArray;
()
public onSelect: (style: any) => void;
()
public async initialize(): Promise<void> {
const textVariarions = await this.styleService.getTextVariations();
this.styles(textVariarions);
}
public setTextStyle(style: any): void {
if (this.onSelect) {
this.onSelect(style);
}
}
}