feat(editor): not sync selection from awareness (#11420)
This commit is contained in:
@@ -59,15 +59,6 @@ export class StoreSelectionExtension extends StoreExtension {
|
|||||||
const all = change.updated.concat(change.added).concat(change.removed);
|
const all = change.updated.concat(change.added).concat(change.removed);
|
||||||
const localClientID = this.store.awarenessStore.awareness.clientID;
|
const localClientID = this.store.awarenessStore.awareness.clientID;
|
||||||
const exceptLocal = all.filter(id => id !== localClientID);
|
const exceptLocal = all.filter(id => id !== localClientID);
|
||||||
const hasLocal = all.includes(localClientID);
|
|
||||||
if (hasLocal) {
|
|
||||||
const localSelectionJson =
|
|
||||||
this.store.awarenessStore.getLocalSelection(this._id);
|
|
||||||
const localSelection = localSelectionJson.map(json => {
|
|
||||||
return this._jsonToSelection(json);
|
|
||||||
});
|
|
||||||
this._selections.value = localSelection;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only consider remote selections from other clients
|
// Only consider remote selections from other clients
|
||||||
if (exceptLocal.length > 0) {
|
if (exceptLocal.length > 0) {
|
||||||
@@ -162,6 +153,7 @@ export class StoreSelectionExtension extends StoreExtension {
|
|||||||
this._id,
|
this._id,
|
||||||
selections.map(s => s.toJSON())
|
selections.map(s => s.toJSON())
|
||||||
);
|
);
|
||||||
|
this._selections.value = selections;
|
||||||
this.slots.changed.next(selections);
|
this.slots.changed.next(selections);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ test('can open peek view for embedded frames', async ({ page }) => {
|
|||||||
const peekView = page.locator('[data-testid="peek-view-modal"]');
|
const peekView = page.locator('[data-testid="peek-view-modal"]');
|
||||||
|
|
||||||
await expect(surfaceRef).toBeVisible();
|
await expect(surfaceRef).toBeVisible();
|
||||||
|
await surfaceRef.click();
|
||||||
await surfaceRef.hover();
|
await surfaceRef.hover();
|
||||||
await page
|
await page
|
||||||
.locator('affine-toolbar-widget editor-menu-button[aria-label="Open"]')
|
.locator('affine-toolbar-widget editor-menu-button[aria-label="Open"]')
|
||||||
|
|||||||
Reference in New Issue
Block a user