Skip to content

Commit

Permalink
chore(blocks): adjust and remove some actions from keyboard-toolbar (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Sun committed Nov 20, 2024
1 parent bdc3caa commit 90459c1
Showing 1 changed file with 2 additions and 40 deletions.
42 changes: 2 additions & 40 deletions packages/blocks/src/root-block/widgets/keyboard-toolbar/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import {
import { viewPresets } from '@blocksuite/data-view/view-presets';
import { assertType } from '@blocksuite/global/utils';
import {
ArrowDownBigIcon,
ArrowUpBigIcon,
AttachmentIcon,
BoldIcon,
BulletedListIcon,
Expand Down Expand Up @@ -884,8 +882,6 @@ export const defaultKeyboardToolbarConfig: KeyboardToolbarConfig = {
// TODO(@L-Sun): add ai function in AFFiNE side
// { icon: AiIcon(iconStyle) },
textSubToolbarConfig,
...listToolActionItems,
...textToolActionItems.filter(({ name }) => name === 'Divider'),
{
name: 'Undo',
icon: UndoIcon(),
Expand Down Expand Up @@ -922,6 +918,8 @@ export const defaultKeyboardToolbarConfig: KeyboardToolbarConfig = {
.run();
},
},
...listToolActionItems,
...textToolActionItems.filter(({ name }) => name === 'Divider'),
{
name: 'CollapseTab',
icon: CollapseTabIcon(),
Expand Down Expand Up @@ -971,42 +969,6 @@ export const defaultKeyboardToolbarConfig: KeyboardToolbarConfig = {
.run();
},
},
...databaseToolGroup.items.filter(({ name }) => name === 'Table view'),
...pageToolGroup.items.filter(({ name }) => name === 'LinkedPage'),
{
name: 'Move Up',
icon: ArrowUpBigIcon(),
action: ({ std }) => {
const { selectedModels } = std.command.exec('getSelectedModels');
const model = selectedModels?.[0];
if (!model) return;

const previousSiblingModel = std.doc.getPrev(model);
if (!previousSiblingModel) return;

const parentModel = std.doc.getParent(previousSiblingModel);
if (!parentModel) return;

std.doc.moveBlocks([model], parentModel, previousSiblingModel, true);
},
},
{
name: 'Move Down',
icon: ArrowDownBigIcon(),
action: ({ std }) => {
const { selectedModels } = std.command.exec('getSelectedModels');
const model = selectedModels?.[0];
if (!model) return;

const nextSiblingModel = std.doc.getNext(model);
if (!nextSiblingModel) return;

const parentModel = std.doc.getParent(nextSiblingModel);
if (!parentModel) return;

std.doc.moveBlocks([model], parentModel, nextSiblingModel, true);
},
},
{
name: 'Delete',
icon: DeleteIcon(),
Expand Down

0 comments on commit 90459c1

Please sign in to comment.