mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-19 07:17:00 +08:00
feat(editor): add experimental feature adapter panel to AFFiNE canary (#12489)
Closes: [BS-2539](https://linear.app/affine-design/issue/BS-2539/为-affine-添加-ef,并且支持在-affine-预览对应的功能) > [!warning] > This feature is only available in the canary build and is intended for debugging purposes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced an "Adapter Panel" feature with a new sidebar tab for previewing document content in multiple formats (Markdown, PlainText, HTML, Snapshot), controllable via a feature flag. - Added a fully integrated adapter panel component with reactive UI elements for selecting adapters, toggling HTML preview modes, and updating content. - Provided a customizable adapter panel for both main app and playground environments, supporting content transformation pipelines and export previews. - Enabled seamless toggling and live updating of adapter panel content through intuitive menus and controls. - **Localization** - Added English translations and descriptive settings for the Adapter Panel feature. - **Chores** - Added new package and workspace dependencies along with TypeScript project references to support the Adapter Panel modules and components. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -70,7 +70,7 @@ import type { Pane } from 'tweakpane';
|
||||
import type { CommentPanel } from '../../comment/index.js';
|
||||
import { createTestEditor } from '../../starter/utils/extensions.js';
|
||||
import { mockEdgelessTheme } from '../mock-services.js';
|
||||
import { AdaptersPanel } from './adapters-panel.js';
|
||||
import type { CustomAdapterPanel } from './custom-adapter-panel.js';
|
||||
import type { CustomFramePanel } from './custom-frame-panel.js';
|
||||
import type { CustomOutlinePanel } from './custom-outline-panel.js';
|
||||
import type { CustomOutlineViewer } from './custom-outline-viewer.js';
|
||||
@@ -612,26 +612,6 @@ export class StarterDebugMenu extends ShadowlessElement {
|
||||
this._hasOffset = !this._hasOffset;
|
||||
}
|
||||
|
||||
private _toggleAdaptersPanel() {
|
||||
const app = document.querySelector('#app');
|
||||
if (!app) return;
|
||||
|
||||
const currentAdaptersPanel = app.querySelector('adapters-panel');
|
||||
if (currentAdaptersPanel) {
|
||||
currentAdaptersPanel.remove();
|
||||
(app as HTMLElement).style.display = 'block';
|
||||
this.editor.style.width = '100%';
|
||||
this.editor.style.flex = '';
|
||||
return;
|
||||
}
|
||||
|
||||
const adaptersPanel = new AdaptersPanel();
|
||||
adaptersPanel.editor = this.editor;
|
||||
app.append(adaptersPanel);
|
||||
this.editor.style.flex = '1';
|
||||
(app as HTMLElement).style.display = 'flex';
|
||||
}
|
||||
|
||||
private _toggleCommentPanel() {
|
||||
document.body.append(this.commentPanel);
|
||||
}
|
||||
@@ -649,6 +629,10 @@ export class StarterDebugMenu extends ShadowlessElement {
|
||||
this.framePanel.toggleDisplay();
|
||||
}
|
||||
|
||||
private _toggleAdapterPanel() {
|
||||
this.adapterPanel.toggleDisplay();
|
||||
}
|
||||
|
||||
private _toggleMultipleEditors() {
|
||||
const app = document.querySelector('#app');
|
||||
if (app) {
|
||||
@@ -926,8 +910,8 @@ export class StarterDebugMenu extends ShadowlessElement {
|
||||
<sl-menu-item @click="${this._toggleMultipleEditors}">
|
||||
Toggle Multiple Editors
|
||||
</sl-menu-item>
|
||||
<sl-menu-item @click="${this._toggleAdaptersPanel}">
|
||||
Toggle Adapters Panel
|
||||
<sl-menu-item @click="${this._toggleAdapterPanel}">
|
||||
Toggle Adapter Panel
|
||||
</sl-menu-item>
|
||||
</sl-menu>
|
||||
</sl-dropdown>
|
||||
@@ -1032,6 +1016,9 @@ export class StarterDebugMenu extends ShadowlessElement {
|
||||
@property({ attribute: false })
|
||||
accessor framePanel!: CustomFramePanel;
|
||||
|
||||
@property({ attribute: false })
|
||||
accessor adapterPanel!: CustomAdapterPanel;
|
||||
|
||||
@property({ attribute: false })
|
||||
accessor leftSidePanel!: LeftSidePanel;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user