refactor(editor): image toolbar config extension (#11329)

Closes: [BS-2378](https://linear.app/affine-design/issue/BS-2378/image-toolbar-迁移)
This commit is contained in:
fundon
2025-04-01 10:04:28 +00:00
parent 032244ae61
commit 7af5e53838
26 changed files with 267 additions and 785 deletions
@@ -192,11 +192,8 @@ abstract class ToolbarContextBase {
};
const getFromMessage = () => {
const msgEle = this.message$.peek()?.element;
if (msgEle instanceof BlockComponent) {
return msgEle;
}
return null;
const block = this.message$.peek()?.element;
return block instanceof BlockComponent ? block : null;
};
return getFromSelection() ?? getFromMessage();
@@ -234,11 +231,8 @@ abstract class ToolbarContextBase {
};
const getFromMessage = () => {
const msgEle = this.message$.peek()?.element;
if (msgEle instanceof BlockComponent) {
return msgEle.model;
}
return null;
const block = this.message$.peek()?.element;
return block instanceof BlockComponent ? block.model : null;
};
return getFromSelection() ?? getFromMessage();