본문으로 건너뛰기

import

설명

메뉴바의 "Import" 옵션을 누르거나 Event Bus 메서드를 통해 호출된 후 발생합니다

사용법

"import": ({ html?: string }) => boolean | void;

매개변수

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

  • html - HTML 형식의 텍스트 값
정보

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

예제

// RichText 초기화
const editor = new richtext.Richtext("#root", {
// 구성 속성
});
// "import" 이벤트 구독
editor.api.on("import", (obj) => {
console.log(obj.html);
console.log("The new value was imported");
});
// 새 값 가져오기
editor.api.exec("import", {
html: "<h2>some value</h2>" // 단순히 setValue를 호출합니다
});

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