Now.js Framework Documentation

Now.js Framework Documentation

RichTextElementFactory

TH 04 Sep 2026 01:40

RichTextElementFactory

RichTextElementFactory - Integrates RichTextEditor with ElementManager Usage: Options (via data-* attributes): data-rte-profile="basic|full|minimal|comment" - editor profile (default: basic) data-rte-height="400" - editor height in px data-rte-min-height="200" - min height in px data-rte-placeholder="..." - placeholder text data-rte-sticky="true" - sticky toolbar data-rte-allow-style="true" - allow

หน้านี้สร้างจากซอร์สโดยตรงเมื่อ 2026-08-21 คำอธิบายมาจาก JSDoc ในไฟล์
รันซ้ำได้ด้วย docs_scaffold เมื่อโค้ดเปลี่ยน อย่าแก้ด้วยมือถ้าตั้งใจให้ generate ต่อ

ที่มา

  • ไฟล์: Now/js/RichTextElementFactory.js (429 บรรทัด)
  • รูปแบบ: ES class

เมธอดสาธารณะ (3)

static cleanup(instance)

Destroy the editor attached to this element and release the reference. Safe to call when no editor was created, and errors thrown by the editor's own destroy are swallowed so teardown of the surrounding form still finishes.

static extractCustomConfig(element, def, dataset)

Read the editor options a single element declares through its data-rte-* attributes. Anything not declared falls back to the value in def, and placeholder also falls back to the element's own placeholder attribute.

static setupElement(instance)

Attach a RichTextEditor to the element and keep it in sync with the form. The editor bundle is loaded separately, so this retries every 100 ms until window.RichTextEditor exists rather than failing when it is not ready yet.

Data attribute ที่ใช้

data-read-only · data-rte-allow-iframe · data-rte-allow-interactive-tags · data-rte-allow-script · data-rte-allow-style · data-rte-fallback-bound · data-rte-fallback-loaded · data-rte-height · data-rte-max-height · data-rte-media-fallback · data-rte-min-height · data-rte-placeholder · data-rte-profile · data-rte-sticky

พึ่งพาคลาสอื่น

ElementFactory · ElementManager