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): title linked-doc convert logic #8734

Merged
merged 2 commits into from
Nov 12, 2024
Merged
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
18 changes: 7 additions & 11 deletions packages/blocks/src/database-block/properties/title/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { LinkedPageIcon } from '@blocksuite/icons/lit';
import { computed, effect, signal } from '@preact/signals-core';
import { css, type TemplateResult } from 'lit';
import { property, query } from 'lit/decorators.js';
import { keyed } from 'lit/directives/keyed.js';
import { html } from 'lit/static-html.js';

import type { DatabaseBlockComponent } from '../../database-block.js';
Expand Down Expand Up @@ -93,9 +92,9 @@ abstract class BaseTextCell extends BaseCellRenderer<Text> {

docId$ = signal<string>();

isLinkedDoc$ = computed(() => !!this.docId$.value);
isLinkedDoc$ = computed(() => false);

title$ = computed(() => {
linkedDocTitle$ = computed(() => {
if (!this.docId$.value) {
return this.value;
}
Expand Down Expand Up @@ -153,10 +152,7 @@ abstract class BaseTextCell extends BaseCellRenderer<Text> {
}

protected override render(): unknown {
return html`${this.renderIcon()}${keyed(
this.docId$.value,
this.isLinkedDoc$.value ? this.renderLinkedDoc() : this.renderBlockText()
)}`;
return html`${this.renderIcon()}${this.renderBlockText()}`;
}

abstract renderBlockText(): TemplateResult;
Expand Down Expand Up @@ -191,7 +187,7 @@ abstract class BaseTextCell extends BaseCellRenderer<Text> {
export class HeaderAreaTextCell extends BaseTextCell {
override renderBlockText() {
return html` <rich-text
.yText="${this.title$.value}"
.yText="${this.value}"
.attributesSchema="${this.attributesSchema}"
.attributeRenderer="${this.attributeRenderer}"
.embedChecker="${this.inlineManager?.embedChecker}"
Expand All @@ -203,7 +199,7 @@ export class HeaderAreaTextCell extends BaseTextCell {

override renderLinkedDoc(): TemplateResult {
return html` <rich-text
.yText="${this.title$.value}"
.yText="${this.linkedDocTitle$.value}"
.readonly="${true}"
class="data-view-header-area-rich-text"
></rich-text>`;
Expand Down Expand Up @@ -384,7 +380,7 @@ export class HeaderAreaTextCellEditing extends BaseTextCell {

override renderBlockText() {
return html` <rich-text
.yText="${this.title$.value}"
.yText="${this.value}"
.inlineEventSource="${this.topContenteditableElement}"
.attributesSchema="${this.attributesSchema}"
.attributeRenderer="${this.attributeRenderer}"
Expand All @@ -402,7 +398,7 @@ export class HeaderAreaTextCellEditing extends BaseTextCell {

override renderLinkedDoc(): TemplateResult {
return html` <rich-text
.yText="${this.title$.value}"
.yText="${this.linkedDocTitle$.value}"
.inlineEventSource="${this.topContenteditableElement}"
.readonly="${this.readonly}"
.enableClipboard="${true}"
Expand Down
Loading