mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 21:06:22 +08:00
refactor(editor): edgeless element toolbar with new pattern (#10511)
This commit is contained in:
@@ -276,7 +276,6 @@ export const builtinToolbarConfig = {
|
||||
icon: CaptionIcon(),
|
||||
run(ctx) {
|
||||
const component = ctx.getCurrentBlockComponentBy(
|
||||
BlockSelection,
|
||||
BookmarkBlockComponent
|
||||
);
|
||||
component?.captionEditor?.show();
|
||||
@@ -296,7 +295,7 @@ export const builtinToolbarConfig = {
|
||||
label: 'Copy',
|
||||
icon: CopyIcon(),
|
||||
run(ctx) {
|
||||
const model = ctx.getCurrentBlockBy(BlockSelection)?.model;
|
||||
const model = ctx.getCurrentModel();
|
||||
if (!model) return;
|
||||
|
||||
const slice = Slice.fromModels(ctx.store, [model]);
|
||||
@@ -311,7 +310,7 @@ export const builtinToolbarConfig = {
|
||||
label: 'Duplicate',
|
||||
icon: DuplicateIcon(),
|
||||
run(ctx) {
|
||||
const model = ctx.getCurrentBlockBy(BlockSelection)?.model;
|
||||
const model = ctx.getCurrentModel();
|
||||
if (!model) return;
|
||||
|
||||
const { flavour, parent } = model;
|
||||
@@ -330,7 +329,6 @@ export const builtinToolbarConfig = {
|
||||
icon: ResetIcon(),
|
||||
run(ctx) {
|
||||
const component = ctx.getCurrentBlockComponentBy(
|
||||
BlockSelection,
|
||||
BookmarkBlockComponent
|
||||
);
|
||||
component?.refreshData();
|
||||
@@ -343,7 +341,7 @@ export const builtinToolbarConfig = {
|
||||
icon: DeleteIcon(),
|
||||
variant: 'destructive',
|
||||
run(ctx) {
|
||||
const model = ctx.getCurrentBlockBy(BlockSelection)?.model;
|
||||
const model = ctx.getCurrentModel();
|
||||
if (!model) return;
|
||||
|
||||
ctx.store.deleteBlock(model);
|
||||
|
||||
Reference in New Issue
Block a user