การจัดแนว
จัดแนวย่อหน้าปัจจุบัน หรือย่อหน้าที่ครอบคลุมช่วงที่เลือก ให้ชิดซ้าย กึ่งกลาง หรือชิดขวา วัตถุที่อยู่ในย่อหน้า เช่น รูปภาพ วิดีโอ และตาราง จะถูกจัดแนวโดยอิงย่อหน้าที่ครอบวัตถุนั้น
การจัดแนวจะบันทึกเป็นคุณสมบัติของย่อหน้า ไม่ใช่รูปแบบอักขระ บล็อกโค้ดจะไม่อยู่ในการจัดแนว เพราะการเยื้องมีความหมายในตัวเอง
ภายในเซลล์ตาราง การจัดแนวใช้กับย่อหน้าหรือรูปภาพภายในที่เคอร์เซอร์อยู่ เมื่อลากเลือกหลายเซลล์ จะใช้กับทุกย่อหน้าและรูปภาพที่จัดแนวได้ในเซลล์เหล่านั้น หากส่วนที่เลือกมีการจัดแนวต่างกัน จะไม่มีปุ่มจัดแนวใดแสดงว่าเลือกอยู่
หากต้องการจัดแนวตัวตาราง ให้กด เลือกทั้งตาราง ในเครื่องมือตามบริบท หรือวางเคอร์เซอร์ก่อนหรือหลังตารางในย่อหน้าที่ครอบตาราง แล้วใช้ปุ่มจัดแนวบนแถบเครื่องมือหลัก ตำแหน่งซ้ายหรือขวาของพื้นที่ลอยต้องเปลี่ยนในเครื่องมือตามบริบทของพื้นที่นั้นแทนปุ่มจัดแนว
npm install nabi-noteimport {
createLocale, createNabiWith, mountSurface, mountToolbar,
mountContextToolbar, mountHints, watchSettle, alignWing, dropCapWing,
mountViewTools,
} from 'nabi-note'
const selected = [
alignWing,
dropCapWing,
]
const locale = createLocale('th')
const { nabi, registry } = createNabiWith(selected, { locale })
const root = document.querySelector('.nabi')!
const content = document.querySelector('.nabi-content')!
// The locale also sets the direction — Arabic and Urdu run right to left
mountSurface({ nabi, registry, root: content, locale })
const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale }
const toolbar = mountToolbar({ ...shared, root: document.querySelector('#toolbar')! })
const context = mountContextToolbar({ ...shared, root: document.querySelector('#context')! })
mountHints({ toolbar, context, root, surface: content })
// The preview and fullscreen buttons — they stand their own box at the end of the row
mountViewTools({ ...shared, root, container: document.querySelector('#toolbar')! })
// on every change — hook up your own code here
// nabi.onChange(() => user_callback(nabi.getHtml()))
// Call from your language selector. Content and editing history stay intact.
// locale.setLocale('ko')const selected = wings().use('align').build()เมื่อต้องการใช้คำสั่งกับส่วนที่เลือกปัจจุบัน ให้ใช้ l สำหรับซ้าย c สำหรับกลาง และ r สำหรับขวา
nabi.applyCommand('setAlign', { value: 'c' })