جزئیات
یک خلاصهٔ کوتاه و بدنه را در یک بلوک گروهبندی کنید. هنگام ساختن آن از نوارابزار، ابتدا خلاصه را وارد میکنید و سپس نوشتن را در زیر آن ادامه میدهید.
وضعیت باز بودن که با مثلث تعیین میشود در سند ذخیره شده و وضعیت اولیهٔ نمای منتشرشده میشود. هنگام ویرایش نیز میتوانید با کلیک روی مثلث بلوک را باز و بسته کنید.
داخل سلول جدول یا بلوکی دیگر، فقط همان بلوک جمعشونده باز و بسته میشود. اگر مکاننما یا انتخاب در محتوایی باشد که بسته میشود، به بیرون منتقل میشود؛ انتخاب در جای دیگر حفظ میشود.
بالها
قلم پایهفاصله
HTMLویرایشگر در حال بارگیری است…
JSONnabi-treeویرایشگر در حال بارگیری است…
نصب
npm install nabi-noteکد
import {
createLocale, createNabiWith, mountSurface, mountToolbar,
mountContextToolbar, mountHints, watchSettle, quoteWing, detailsWing,
codeWing, mountViewTools,
} from 'nabi-note'
const selected = [
quoteWing,
detailsWing,
codeWing,
]
const locale = createLocale('fa')
const { nabi, registry } = createNabiWith(selected, { locale })
// 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 })
const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale }
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()))
// Call from your language selector. Content and editing history stay intact.
// locale.setLocale('ko')ts
const selected = wings().use('details').build()سبکهای CSS
بلوک جزئیات را با .nabi-content details و عنوان را با .nabi-content details > summary سبکدهی کنید.
css
.article-body details {
padding: .75rem 1rem;
border: 1px solid var(--nabi-line);
border-radius: var(--nabi-radius);
background: var(--nabi-soft);
}
.article-body details > summary { cursor: pointer; font-weight: 700; }
.article-body details[open] > summary { margin-block-end: .75rem; }ویژگی open وضعیت باز بودن آغازینی است که نویسنده ذخیره کرده است. CSS میتواند این وضعیت را سبکدهی کند، اما بهتر است خودِ وضعیت را اجبار نکنید.