YouTube
Cole um endereço do YouTube ou use o botão do YouTube para inserir um vídeo. O documento guarda apenas o ID de 11 caracteres do vídeo e a largura, não a URL completa, e um novo vídeo começa centralizado com 70% de largura.
A largura é escolhida em passos fixos, e o alinhamento é salvo no parágrafo que envolve o vídeo. No editor, o primeiro clique seleciona o vídeo; depois de selecionado, outro clique pode reproduzi-lo. Para mudar o endereço, apague o vídeo e insira um novo.
Asas
Tipo de letra padrãoAltura
HTMLCarregando o editor…
JSONnabi-treeCarregando o editor…
Instalação
npm install nabi-noteCódigo
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: 'pt' })
const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale: 'pt' }
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()Estilos CSS
Use .nabi-content iframe para alterar borda ou cantos do vídeo. Não altere a largura nem o alinhamento salvos.
css
.article-body iframe {
border-radius: 14px;
box-shadow: 0 10px 28px rgb(0 0 0 / 16%);
}O pacote usa aspect-ratio, largura e margens de alinhamento para manter o vídeo no tamanho correto, portanto não os sobrescreva.