mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-01 01:29:31 +08:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user