YouTube

YouTube वीडियो का पता या ID लेकर embed block बनाता है। दस्तावेज़ में पूरा पता नहीं, केवल 11-अक्षर video ID और चौड़ाई सहेजी जाती है; नया वीडियो बीच में 70% चौड़ाई से शुरू होता है।

चौड़ाई तय चरणों से चुनी जाती है और संरेखण वीडियो को समेटने वाले अनुच्छेद में सहेजा जाता है। संपादक में पहली click वीडियो चुनती है और चुने जाने के बाद अगली click उसे चलाती है। पता बदलने के बजाय वीडियो हटाकर नया डालें।

पंख
डिफ़ॉल्ट फ़ॉन्टऊँचाई
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: 'hi' })

const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale: 'hi' }
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%);
}

package वीडियो का आकार बनाए रखने के लिए aspect-ratio, चौड़ाई और alignment margin उपयोग करती है, इसलिए इन्हें override न करें।