یوتیوب
نشانی یا شناسهٔ ویدیوی یوتیوب را بپذیرید و آن را به بلوک جاسازیشده تبدیل کنید. سند فقط شناسهٔ ۱۱ کاراکتری ویدیو و عرض را ذخیره میکند، نه نشانی کامل را؛ ویدیوی تازه با عرض ۷۰٪ در مرکز آغاز میشود.
عرض از گامهای ثابت انتخاب میشود و همترازی روی پاراگرافِ دربرگیرندهٔ ویدیو ذخیره میشود. در ویرایشگر، نخستین کلیک ویدیو را انتخاب میکند؛ پس از انتخاب، کلیک دوباره میتواند آن را پخش کند. برای تغییر نشانی، ویدیو را حذف و یک ویدیوی تازه وارد کنید.
بالها
قلم پایهفاصله
HTMLویرایشگر در حال بارگیری است…
JSONnabi-treeویرایشگر در حال بارگیری است…
نصب
npm install nabi-noteکد
import {
createNabiWith, mountSurface, mountToolbar, mountContextToolbar,
mountHints, watchSettle, codeWing, imageWing, youtubeWing,
mountViewTools,
} from 'nabi-note'
const selected = [
codeWing,
imageWing,
youtubeWing,
]
const { nabi, registry } = createNabiWith(selected)
// Bring your own highlighter (Prism, highlight.js, Shiki, …) — the wing stays as it is
// and only the attach is swapped (`makeCodeAttach` ships from the same door)
// { ...codeWing, attach: makeCodeAttach({ highlight: (source, lang) => [{ text: source }] }) }
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: 'fa' })
const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale: 'fa' }
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('youtube').build()سبکهای CSS
برای تغییر کادر یا گوشههای ویدیو از .nabi-content iframe استفاده کنید. عرض یا همترازی ذخیرهشده را تغییر ندهید.
css
.article-body iframe {
border-radius: 14px;
box-shadow: 0 10px 28px rgb(0 0 0 / 16%);
}بسته برای نگهداشتن اندازهٔ درست ویدیو از aspect-ratio، عرض و marginهای همترازی استفاده میکند؛ پس آنها را بازنویسی نکنید.