配置 ​

現在の段落、または選択範囲に含まれる段落を左、中央、右に配置します。画像、動画、表のように段落内に入るオブジェクトも、そのオブジェクトを包む段落を基準に配置されます。

配置は文字書式ではなく段落属性として保存されます。コードブロックはインデントそのものに意味があるため、配置の対象から除外されます。

表のセル内では、カーソルがある内部の段落や画像を配置します。複数のセルをドラッグして選択すると、選択したセル内の配置可能なすべての段落と画像に適用します。異なる配置が混在する選択では、どの配置ボタンも選択状態にしません。

表自体を配置するには、表のコンテキストツールで 表全体を選択 を押すか、表を囲む段落内で表の前後にカーソルを置き、メインツールバーの配置ボタンを使います。フロート領域の左右の配置は、配置ボタンではなく、その領域のコンテキストツールで変更します。

ウィング
既定の書体高さ
HTMLエディタを読み込んでいます…
JSONnabi-treeエディタを読み込んでいます…
インストール
npm install nabi-note
コード
import {
  createLocale, createNabiWith, mountSurface, mountToolbar,
  mountContextToolbar, mountHints, watchSettle, alignWing, dropCapWing,
  mountViewTools,
} from 'nabi-note'

const selected = [
  alignWing,
  dropCapWing,
]
const locale = createLocale('ja')
const { nabi, registry } = createNabiWith(selected, { locale })

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('align').build()

現在の選択にコマンドで適用する場合は、左に l、中央に c、右に r を使います。

ts
nabi.applyCommand('setAlign', { value: 'c' })