表
ツールバーで行と列を選んで表を作ります。セル内では複数の段落ではなく改行で内容を続けて書き、Tab と Shift+Tab で次または前のセルへ移動します。
行や列の追加・削除、セル結合、見出しセルへの切り替えは、選択したセルを基準に動作します。表をソート可能として保存し、公開画面で列ソートを使うには nabi-note/viewer の attachViewer() を接続してください。結合セルがある表は列ソートの対象になりません。
ウィング
既定の書体高さ
HTMLエディタを読み込んでいます…
JSONnabi-treeエディタを読み込んでいます…
インストール
npm install nabi-noteコード
import {
createNabiWith, mountSurface, mountToolbar, mountContextToolbar,
mountHints, watchSettle, taskListWing, tableWings, imageWing,
mountViewTools,
} from 'nabi-note'
const selected = [
taskListWing,
...tableWings,
imageWing,
]
const { nabi, registry } = createNabiWith(selected)
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: 'ja' })
const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale: 'ja' }
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('table').build()CSS スタイル
表は .nabi-content table、セルは .nabi-content :is(th, td) で装飾します。セルの構造や viewer が挿入するソートボタンは変更しないでください。
css
.article-body table { inline-size: 100%; border-collapse: collapse; }
.article-body :is(th, td) { padding: .6rem .75rem; border: 1px solid var(--nabi-line); }
.article-body th { background: var(--nabi-soft); font-weight: 700; }
.article-body tr:nth-child(even) td { background: color-mix(in srgb, var(--nabi-soft) 45%, transparent); }viewer を接続している場合は .nabi-sort ボタンを残してください。セルの position や右 padding を強制的に上書きすると、ソートボタンと重なることがあります。