Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(database): group as Database cannot keep inbound link #6564

Merged
merged 2 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,13 @@ export class RichTextCell extends BaseCellRenderer<Y.Text> {
}

get inlineManager() {
assertExists(this.service);
return this.service.inlineManager;
return this.service?.inlineManager;
}
get attributesSchema() {
return this.inlineManager.getSchema();
return this.inlineManager?.getSchema();
}
get attributeRenderer() {
return this.inlineManager.getRenderer();
return this.inlineManager?.getRenderer();
}

@query('rich-text')
Expand Down Expand Up @@ -153,7 +152,8 @@ export class RichTextCell extends BaseCellRenderer<Y.Text> {
.inlineEventSource=${this.topContenteditableElement}
.attributesSchema=${this.attributesSchema}
.attributeRenderer=${this.attributeRenderer}
.markdownShortcutHandler=${this.inlineManager.markdownShortcutHandler}
.embedChecker=${this.inlineManager?.embedChecker}
.markdownShortcutHandler=${this.inlineManager?.markdownShortcutHandler}
.readonly=${true}
class="affine-database-rich-text inline-editor"
></rich-text>`;
Expand Down Expand Up @@ -198,14 +198,13 @@ export class RichTextCellEditing extends BaseCellRenderer<Text> {
}

get inlineManager() {
assertExists(this.service);
return this.service.inlineManager;
return this.service?.inlineManager;
}
get attributesSchema() {
return this.inlineManager.getSchema();
return this.inlineManager?.getSchema();
}
get attributeRenderer() {
return this.inlineManager.getRenderer();
return this.inlineManager?.getRenderer();
}

@query('rich-text')
Expand Down Expand Up @@ -340,7 +339,8 @@ export class RichTextCellEditing extends BaseCellRenderer<Text> {
.inlineEventSource=${this.topContenteditableElement}
.attributesSchema=${this.attributesSchema}
.attributeRenderer=${this.attributeRenderer}
.markdownShortcutHandler=${this.inlineManager.markdownShortcutHandler}
.embedChecker=${this.inlineManager?.embedChecker}
.markdownShortcutHandler=${this.inlineManager?.markdownShortcutHandler}
class="affine-database-rich-text inline-editor"
></rich-text>`;
}
Expand Down
23 changes: 21 additions & 2 deletions packages/blocks/src/database-block/common/header-area/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,20 @@ abstract class BaseTextCell extends BaseCellRenderer<unknown> {
static override styles = styles;
@property({ attribute: false })
showIcon = false;
get service() {
const database = this.closest<DatabaseBlockComponent>('affine-database');
return database?.service;
}

get inlineManager() {
return this.service?.inlineManager;
}
get attributesSchema() {
return this.inlineManager?.getSchema();
}
get attributeRenderer() {
return this.inlineManager?.getRenderer();
}
get topContenteditableElement() {
const databaseBlock =
this.closest<DatabaseBlockComponent>('affine-database');
Expand Down Expand Up @@ -150,11 +163,14 @@ export class HeaderAreaTextCell extends BaseTextCell {
const yText = this.getYText(
this.titleColumn.getValue(this.rowId) as Y.Text | string | undefined
);

return html`${this.renderIcon()}
<rich-text
.yText=${yText}
.inlineEventSource=${this.topContenteditableElement}
.attributesSchema=${this.attributesSchema}
.attributeRenderer=${this.attributeRenderer}
.embedChecker=${this.inlineManager?.embedChecker}
.markdownShortcutHandler=${this.inlineManager?.markdownShortcutHandler}
.readonly=${true}
class="data-view-header-area-rich-text"
></rich-text>`;
Expand Down Expand Up @@ -191,11 +207,14 @@ export class HeaderAreaTextCellEditing extends BaseTextCell {
const yText = this.getYText(
this.titleColumn.getValue(this.rowId) as Y.Text | string | undefined
);

return html`${this.renderIcon()}
<rich-text
.yText=${yText}
.inlineEventSource=${this.topContenteditableElement}
.attributesSchema=${this.attributesSchema}
.attributeRenderer=${this.attributeRenderer}
.embedChecker=${this.inlineManager?.embedChecker}
.markdownShortcutHandler=${this.inlineManager?.markdownShortcutHandler}
.readonly=${this.readonly}
class="data-view-header-area-rich-text"
></rich-text>`;
Expand Down
Loading