รูปภาพ

ใส่ที่อยู่รูปภาพและปรับความกว้างกับการจัดแนว โดยค่าเริ่มต้นอนุญาตเฉพาะ http:, https: หรือพาธของไซต์เดียวกัน และรูปภาพใหม่จะเริ่มด้วยการจัดกึ่งกลางและความกว้าง 60%

ความกว้างจะถูกเก็บได้เฉพาะตามขั้นที่กำหนด และการจัดแนวจะเก็บในย่อหน้าที่ห่อรูปภาพ หากต้องการใช้ตัวอย่าง blob: และ data:image/... ต้องอนุญาต URL ภายในเครื่องอย่างชัดเจนทั้งที่ image wing และการประกอบเอดิเตอร์ ไม่อนุญาต URL ข้อมูล SVG

ปีก
แบบอักษรหลักระยะเยื้อง
HTMLกำลังโหลดโปรแกรมแก้ไข…
JSONnabi-treeกำลังโหลดโปรแกรมแก้ไข…
ติดตั้ง
npm install nabi-note
โค้ด
import {
  createNabiWith, mountSurface, mountToolbar, mountContextToolbar,
  mountHints, watchSettle, tableWings, imageWing, youtubeWing,
  mountViewTools,
} from 'nabi-note'

const selected = [
  ...tableWings,
  imageWing,
  youtubeWing,
]
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('img', {
  allowLocalUrls: false,
}).build()

wing นี้ใส่ที่อยู่ลงในเอกสารเท่านั้น ไม่ได้ส่งไฟล์ หากต้องการส่งไฟล์ไปยังเซิร์ฟเวอร์ ให้เชื่อมต่อ wing อัปโหลด

รูปแบบ CSS

จัดรูปแบบรูปภาพด้วย .nabi-content img รักษาความกว้างและการจัดแนวที่บันทึกไว้ แล้วเปลี่ยนเฉพาะรูปลักษณ์ เช่น เส้นขอบหรือเงา

css
.article-body img {
  border-radius: 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 12%);
}

.dark .article-body img { box-shadow: 0 8px 24px rgb(0 0 0 / 35%); }

ให้คงกฎพื้นฐานของ max-inline-size, block-size, ความกว้าง และการจัดแนวไว้ ขนาดรูปภาพเป็นค่าที่เก็บในเอกสาร ดังนั้นการกำหนดตายตัวด้วย CSS อาจขัดกับความกว้างที่ผู้เขียนเลือก