跳转到内容
Pivotick
Main Navigation 首页
快速入门
配置
API 参考
示例库项目在线体验

简体中文

English
Français
Deutsch
Português

简体中文

English
Français
Deutsch
Português

外观

Sidebar Navigation

快速入门

使用 Pivotick 的项目

配置

回调

边图层

简化

布局

渲染

模拟

自定义界面

侧栏

提示框

上下文菜单

筛选

图例

数据表格

界面样式

翻译界面

插件

Pivotick API

拓展与数据增强

保存拓展结果

撤销与历史记录

安全

API 文档

示例库

基础

节点样式

边样式

布局

事件与回调

界面自定义

编辑与创建

备注与注释

筛选、搜索与层级

编程控制

主题与性能

拓展与数据增强

综合示例

撤消和历史记录 ​

顶部栏中的两个按钮是拆分按钮:图标步进一次,插入符号打开整个历史记录。这是一条时间线,有一条 now 线穿过 — 上面的行已被撤消,下面的行仍然可以撤消 — 单击一行即可前往那里。

创建一些历史记录,然后打开它:

  • 隐藏节点或从节点右键菜单中删除节点
  • 创建 ▸ 在左侧轨道上添加节点,然后单击画布
  • 运行一个拓展表(如果有的话)——摄取是一个像任何其他条目一样的条目

将鼠标悬停在一行上,它会标记单击将反转的跨度,在页脚中说明最终效果,并在画布上进行预测:什么会从它所在的位置排出,什么会返回,并概述它会落在哪里。 Ctrl + Z退后一步,没有菜单。

撤消是连续的:向下瞄准三行会反转这三行,作为一批。

js
// Nothing here switches the history on: `graph.history` records the four kinds of
// composition change on its own, and the two split buttons in the header are wired to
// it. `mode: 'full'` is what brings the header the buttons live in, and the left rail's
// Create tool.
const options = {
    UI: {
        mode: 'full',
        // Off: this card is about the top bar, and `full` mode's minimap and data dock
        // are neither (see the Minimap and Data table cards for those).
        minimap: false,
        table: false
    },
    render: { nodeTypeAccessor: (node) => node.getData().kind }
}
js
// A consumer that writes a change through to its own backend says so. Undo makes no
// compensating write, so it follows the direction of yours: a creation still reverses
// and the row is chipped `saved`, while a deletion is sealed — undoing it would put
// back a node your backend no longer has.
const writeThrough = {
    callbacks: {
        onBeforeNodeCreate: async (ctx) => {
            const values = await ctx.promptData({
                fields: [{ key: 'label', label: 'Name', type: 'text' }]
            })
            if (!values) return false
            const saved = await myBackend.create(values)
            return { accept: true, id: saved.uuid, data: values, persisted: true }
        },
        onBeforeDelete: async (ctx) => {
            await myBackend.remove(ctx.nodes.map((node) => node.id))
            return { accept: true, persisted: true }
        }
    }
}
js
const data = {
    nodes: [
        { id: 'gw', data: { label: 'gateway-01', kind: 'Host' } },
        { id: 'db', data: { label: 'orders-db', kind: 'Database' } },
        { id: 'api', data: { label: 'orders-api', kind: 'Service' } },
        { id: 'cache', data: { label: 'session-cache', kind: 'Service' } },
        { id: 'job', data: { label: 'nightly-export', kind: 'Job' } },
        { id: 'sftp', data: { label: 'partner-sftp', kind: 'Host' } }
    ],
    edges: [
        { from: 'gw', to: 'api', data: { label: 'routes' } },
        { from: 'api', to: 'db', data: { label: 'reads' } },
        { from: 'api', to: 'cache', data: { label: 'reads' } },
        { from: 'job', to: 'db', data: { label: 'reads' } },
        { from: 'job', to: 'sftp', data: { label: 'writes' } }
    ]
}

撤消永远不会写入您的后端,因此您写入的更改会遵循它的方向。 creation仍然会反转——画布会丢失后端保留的内容,页脚会对其进行计数(Undoes 2 steps · 1 item saved upstream)。 删除是密封:列出,永不反转,并且包含一个的跨度会越过它(Undoes 2 of 3 · 1 saved item kept)。

请参阅撤消和历史记录了解四种条目、故意不记录的内容以及撤消摄取如何将其候选项放回到分类窗格中。

Pager
下一页快速入门