본문으로 건너뛰기

set-font-family

설명

글꼴 패밀리를 설정할 때 발생합니다

사용법

"set-font-family": ({ fontFamily: string }) => boolean | void;

매개변수

set-font-family 이벤트의 callback은 다음 매개변수를 포함하는 객체를 받을 수 있습니다:

  • fontFamily - 적용할 글꼴 패밀리입니다. 사용 가능한 글꼴은 다음과 같습니다: "Roboto" | "Arial" | "Georgia" | "Tahoma" | "Times New Roman" | "Verdana"
정보

내부 이벤트를 처리하려면 Event Bus 메서드를 사용할 수 있습니다

예제

// RichText 초기화
const editor = new richtext.Richtext("#root", {
// 구성 속성
});
// "set-font-family" 이벤트 구독
editor.api.on("set-font-family", (obj) => {
console.log(obj.fontFamily);
console.log("The font family was changed");
});
// 새 글꼴 패밀리 적용
editor.api.exec("set-font-family", {
fontFamily: "Roboto"
});

변경 이력: 이 이벤트는 v2.0에서 추가되었습니다