-
-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(presets): copilot panel with self-provided tokens (#5510)
Co-authored-by: Mirone <Saul-Mirone@outlook.com>
- Loading branch information
1 parent
957031b
commit fde4ce0
Showing
49 changed files
with
1,750 additions
and
466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { css, html, type PropertyValues } from 'lit'; | ||
import { customElement, query } from 'lit/decorators.js'; | ||
|
||
import { EmbedBlockElement } from '../_common/embed-block-helper/index.js'; | ||
import type { EmbedHtmlBlockModel } from './embed-html-model.js'; | ||
|
||
@customElement('affine-embed-html-block') | ||
export class EmbedHtmlBlock extends EmbedBlockElement<EmbedHtmlBlockModel> { | ||
static override styles = css` | ||
//affine-html { | ||
// display: block; | ||
//} | ||
// | ||
.embed-html-block-iframe { | ||
border: none; | ||
width: 100%; | ||
} | ||
`; | ||
@query('.embed-html-block-iframe') | ||
iframe!: HTMLIFrameElement; | ||
|
||
updateWH = () => { | ||
const [, , w, h] = JSON.parse(this.model.xywh); | ||
this.iframe.style.width = `${w}px`; | ||
this.iframe.style.height = `${h}px`; | ||
}; | ||
|
||
public override connectedCallback() { | ||
super.connectedCallback(); | ||
this.disposables.add(this.model.propsUpdated.on(this.updateWH)); | ||
} | ||
|
||
protected override firstUpdated(_changedProperties: PropertyValues) { | ||
super.firstUpdated(_changedProperties); | ||
this.updateWH(); | ||
} | ||
|
||
override render(): unknown { | ||
return this.renderEmbed(() => { | ||
if (!this.model.html) { | ||
return html` <div class="affine-html-empty">Empty</div>`; | ||
} | ||
return html`<iframe | ||
class="embed-html-block-iframe" | ||
sandbox="allow-scripts" | ||
scrolling="false" | ||
.srcdoc="${this.model.html}" | ||
></iframe>`; | ||
}); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'affine-embed-html-block': EmbedHtmlBlock; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { EmbedBlockModel } from '../_common/embed-block-helper/index.js'; | ||
import { EdgelessSelectableMixin } from '../surface-block/elements/selectable.js'; | ||
|
||
export type EmbedHtmlBlockProps = { | ||
html?: string; | ||
design?: string; | ||
}; | ||
|
||
@EdgelessSelectableMixin | ||
export class EmbedHtmlBlockModel extends EmbedBlockModel<EmbedHtmlBlockProps> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { BlockService } from '@blocksuite/block-std'; | ||
|
||
import type { EmbedHtmlBlockModel } from './embed-html-model.js'; | ||
|
||
export class EmbedHtmlService extends BlockService<EmbedHtmlBlockModel> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { literal } from 'lit/static-html.js'; | ||
|
||
import { createEmbedBlock } from '../_common/embed-block-helper/index.js'; | ||
import { EmbedHtmlBlockModel } from './embed-html-model.js'; | ||
|
||
export const EmbedHtmlBlockSpec = createEmbedBlock({ | ||
schema: { | ||
name: 'html', | ||
version: 1, | ||
toModel: () => new EmbedHtmlBlockModel(), | ||
props: () => ({}), | ||
}, | ||
view: { | ||
component: literal`affine-embed-html-block`, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
fde4ce0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
blocksuite – ./packages/playground
try-blocksuite.vercel.app
blocksuite-git-master-toeverything.vercel.app
blocksuite-toeverything.vercel.app
fde4ce0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Size Report
Bundles
Packages