YouTube

Yana karɓar adireshin bidiyon YouTube ko ID na bidiyo ya mai da shi tubalin sakawa. A cikin daftari ba a adana cikakken adireshi ba sai ID na bidiyo mai haruffa 11 da faɗi; sabon bidiyo yana farawa a tsakiya da faɗin 70%.

Ana zaɓar faɗi daga matakan da aka ƙayyade, kuma ana adana daidaitawa a sakin layin da ya kewaye bidiyon. A editan, dannawa na farko yana zaɓar bidiyo, sannan idan an sake dannawa bayan zaɓarsa za a iya kunna shi. Maimakon canza adireshin, share bidiyon ka saka sabo.

Fuka-fukai
Nau’in rubutu na asaliTazara
HTMLAna loda edita…
JSONnabi-treeAna loda edita…
Sanya
npm install nabi-note
Lamba
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: 'ha' })

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

Tsarin CSS

Za ka iya canza iyaka da sasanninta na bidiyo da .nabi-content iframe. Kada ka canza faɗi da daidaitawar da aka adana.

css
.article-body iframe {
  border-radius: 14px;
  box-shadow: 0 10px 28px rgb(0 0 0 / 16%);
}

aspect-ratio, faɗi, da margin na daidaitawa su ne fakitin ke amfani da su wajen kiyaye girman bidiyo, saboda haka kada ka sake rubuta su.