feat(editor): audio block (#10947)
AudioMedia entity for loading & controlling a single audio media AudioMediaManagerService: Global audio state synchronization across tabs AudioAttachmentService + AudioAttachmentBlock for manipulating AttachmentBlock in affine - e.g., filling transcription (using mock endpoint for now) Added AudioBlock + AudioPlayer for rendering audio block in affine (new transcription block whose renderer is provided in affine) fix AF-2292 fix AF-2337
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { notify } from '@affine/component';
|
||||
import { I18n } from '@affine/i18n';
|
||||
import { OnEvent, Service } from '@toeverything/infra';
|
||||
import type { To } from 'history';
|
||||
import { debounce } from 'lodash-es';
|
||||
|
||||
import { AuthService, DefaultServerService, ServersService } from '../../cloud';
|
||||
@@ -32,6 +33,25 @@ export class DesktopApiService extends Service {
|
||||
return this.api.sharedStorage;
|
||||
}
|
||||
|
||||
async showTab(tabId: string, to?: To) {
|
||||
if (to) {
|
||||
const url = new URL(to.toString());
|
||||
const tabs = await this.api.handler.ui.getTabViewsMeta();
|
||||
const tab = tabs.workbenches.find(t => t.id === tabId);
|
||||
if (tab) {
|
||||
const basename = tab.basename;
|
||||
if (url.pathname.startsWith(basename)) {
|
||||
const pathname = url.pathname.slice(basename.length);
|
||||
await this.api.handler.ui.tabGoTo(
|
||||
tabId,
|
||||
pathname + url.search + url.hash
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.api.handler.ui.showTab(tabId);
|
||||
}
|
||||
|
||||
private setupStartListener() {
|
||||
this.setupCommonUIEvents();
|
||||
this.setupAuthRequestEvent();
|
||||
|
||||
Reference in New Issue
Block a user