ลิงก์
เลือกข้อความแล้วเชื่อมต่อที่อยู่ หากป้อนที่อยู่โดยไม่เลือกข้อความ ที่อยู่นั้นจะถูกใส่เป็นข้อความลิงก์เอง การป้อนที่อยู่ http:// หรือ https:// แล้วกด Space หรือ Enter ก็เปลี่ยนเป็นลิงก์ได้เช่นกัน
ลิงก์เก็บได้เฉพาะ http:, https: และพาธไซต์เดียวกันที่เริ่มด้วย . หรือ / ที่อยู่ซึ่งระบุแหล่งที่มาไม่ได้ชัดเจน เช่น javascript: หรือ //example.com จะถูกปฏิเสธ ลิงก์ไฟล์แนบที่สร้างจากการอัปโหลดยังเก็บข้อมูลไฟล์ไว้ด้วย และไม่สามารถสร้างเองแบบลิงก์ทั่วไปได้
ปีก
แบบอักษรหลักระยะเยื้อง
HTMLกำลังโหลดโปรแกรมแก้ไข…
JSONnabi-treeกำลังโหลดโปรแกรมแก้ไข…
ติดตั้ง
npm install nabi-noteโค้ด
import {
createNabiWith, mountSurface, mountToolbar, mountContextToolbar,
mountHints, watchSettle, subscriptWing, highlightWing, linkWing,
mountViewTools,
} from 'nabi-note'
const selected = [
subscriptWing,
highlightWing,
linkWing,
]
const { nabi, registry } = createNabiWith(selected)
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: 'th' })
const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale: 'th' }
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()))ts
const selected = wings().use('a').build()รูปแบบ CSS
จัดรูปแบบลิงก์ทั่วไปด้วย .nabi-content a และลิงก์ไฟล์แนบแยกต่างหากด้วย .nabi-content a[data-nabi-file]
css
.article-body a:not([data-nabi-file]) {
color: var(--nabi-accent);
text-decoration-thickness: .08em;
text-underline-offset: .16em;
}
.article-body a[data-nabi-file] {
display: inline-flex;
gap: .35em;
padding: .25em .55em;
background: var(--nabi-soft);
}ส่วน ::before และ ::after ของลิงก์ไฟล์แนบใช้แสดงไอคอนไฟล์และนามสกุล จึงไม่ควรเปลี่ยนหรือลบ content