对齐
将当前段落或选中范围内的段落设为左对齐、居中或右对齐。图片、视频、表格等位于段落内部的对象,会通过包裹它们的段落来对齐。
对齐是段落属性,不是文字格式。代码块会从对齐中排除,因为缩进本身在代码中有意义。
在单元格内,对齐作用于光标所在的内部段落或图片。拖动选中多个单元格后,会应用到其中所有可对齐的段落和图片。如果选区包含不同的对齐方式,则不会将任何对齐按钮显示为选中状态。
要对齐表格本身,请在表格的上下文工具中点击 选择整个表格,或在包裹表格的段落内将光标放到表格前后,再使用主工具栏的对齐按钮。浮动区域的左右位置通过该区域的上下文工具修改,而不是对齐按钮。
翅膀
默认字体高度
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('zh')
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' })