mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-04 19:11:57 +08:00
feat(editor): add edgeless crud extension (#9335)
This commit is contained in:
@@ -508,7 +508,7 @@ const CREATE_AS_LINKED_DOC = {
|
||||
y = viewportCenter.y - height / 2;
|
||||
}
|
||||
|
||||
service.addBlock(
|
||||
service.crud.addBlock(
|
||||
'affine:embed-linked-doc',
|
||||
{
|
||||
xywh: `[${x}, ${y}, ${width}, ${height}]`,
|
||||
|
||||
@@ -174,7 +174,7 @@ export class AIChatBlockPeekView extends LitElement {
|
||||
|
||||
const edgelessService = this._rootService as EdgelessRootService;
|
||||
const bound = calcChildBound(this.parentModel, edgelessService);
|
||||
const aiChatBlockId = edgelessService.addBlock(
|
||||
const aiChatBlockId = edgelessService.crud.addBlock(
|
||||
'affine:embed-ai-chat' as keyof BlockSuite.BlockModels,
|
||||
{
|
||||
xywh: bound.serialize(),
|
||||
@@ -193,7 +193,7 @@ export class AIChatBlockPeekView extends LitElement {
|
||||
this.updateContext({ currentChatBlockId: aiChatBlockId });
|
||||
|
||||
// Connect the parent chat block to the AI chat block
|
||||
edgelessService.addElement(CanvasElementType.CONNECTOR, {
|
||||
edgelessService.crud.addElement(CanvasElementType.CONNECTOR, {
|
||||
mode: ConnectorMode.Curve,
|
||||
controllers: [],
|
||||
source: { id: this.parentChatBlockId },
|
||||
|
||||
+1
-1
@@ -530,7 +530,7 @@ export function patchEdgelessClipboard() {
|
||||
rootDocId,
|
||||
rootWorkspaceId,
|
||||
} = block.props;
|
||||
const blockId = component.service.addBlock(
|
||||
const blockId = component.service.crud.addBlock(
|
||||
AIChatBlockFlavour,
|
||||
{
|
||||
xywh,
|
||||
|
||||
+1
-1
@@ -361,7 +361,7 @@ export const ShapeSettings = () => {
|
||||
const { shapeType, radius } = shape;
|
||||
const shapeName = getShapeName(shapeType, radius);
|
||||
const props = editorSetting.get(`shape:${shapeName}`);
|
||||
edgelessService.updateElement(shape.id, props);
|
||||
edgelessService.crud.updateElement(shape.id, props);
|
||||
});
|
||||
doc.awarenessStore.setReadonly(doc.blockCollection, true);
|
||||
},
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ export const EdgelessSnapshot = (props: Props) => {
|
||||
const props = editorSetting.get(keyName) as any;
|
||||
doc.awarenessStore.setReadonly(doc.blockCollection, false);
|
||||
elements.forEach(element => {
|
||||
edgelessService.updateElement(element.id, props);
|
||||
edgelessService.crud.updateElement(element.id, props);
|
||||
});
|
||||
doc.awarenessStore.setReadonly(doc.blockCollection, true);
|
||||
}, [editorSetting, getElements, keyName]);
|
||||
|
||||
Reference in New Issue
Block a user