본문으로 건너뛰기

set-text-format

설명

텍스트 형식을 설정할 때 발생합니다

사용법

"set-text-format": (ITextFormat) => boolean | void;

interface ITextFormat {
bold?: boolean;
italic?: boolean;
strike?: boolean;
underline?: boolean;
}
정보

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

파라미터

set-text-format 이벤트의 callback은 다음 파라미터를 포함하는 객체를 받을 수 있습니다:

  • bold - 굵게 텍스트 형식
  • italic - 기울임꼴 텍스트 형식
  • strike - 취소선 텍스트 형식
  • underline - 밑줄 텍스트 형식

예제

// RichText 초기화
const editor = new richtext.Richtext("#root", {
// 구성 속성
});
// "set-text-format" 이벤트 구독
editor.api.on("set-text-format", (obj) => {
console.log(obj);
console.log("The text format was changed");
});
// "italic" 및 bold 텍스트 형식 적용
editor.api.exec("set-text-format", {
italic: true,
bold: true
});

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