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): can't use horizontal scrollbar #8576

Merged
merged 1 commit into from
Oct 22, 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 @@ -42,7 +42,7 @@ export class CaptionedBlockComponent<
${this.showBlockSelection
? html`<affine-block-selection .block=${this}></affine-block-selection>`
: nothing}
${this.useZeroWidth
${this.useZeroWidth && !this.doc.readonly
? html`<block-zero-width .block=${this}></block-zero-width>`
: nothing}
</div>`;
Expand Down
13 changes: 7 additions & 6 deletions packages/blocks/src/_common/components/block-zero-width.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import type { BlockComponent } from '@blocksuite/block-std';

import { focusTextModel } from '@blocksuite/affine-components/rich-text';
import { stopPropagation } from '@blocksuite/affine-shared/utils';
import { ZERO_WIDTH_SPACE } from '@blocksuite/inline/consts';
import { css, html, LitElement } from 'lit';
import { property } from 'lit/decorators.js';

export class BlockZeroWidth extends LitElement {
static override styles = css`
.block-zero-width {
position: absolute;
bottom: -10px;
bottom: -15px;
height: 10px;
width: 100%;
cursor: text;
z-index: 1;
Expand All @@ -24,7 +24,7 @@ export class BlockZeroWidth extends LitElement {
handleClick(e: MouseEvent) {
stopPropagation(e);
if (this.block.doc.readonly) return;
const nextBlock = this.block.model.doc.getNext(this.block.model);
const nextBlock = this.block.doc.getNext(this.block.model);
if (nextBlock?.flavour !== 'affine:paragraph') {
const [paragraphId] = this.block.doc.addSiblingBlocks(this.block.model, [
{ flavour: 'affine:paragraph' },
Expand All @@ -34,9 +34,10 @@ export class BlockZeroWidth extends LitElement {
}

override render() {
return html`<div class="block-zero-width" @click=${this.handleClick}>
<span>${ZERO_WIDTH_SPACE}</span>
</div>`;
return html`<div
class="block-zero-width"
@click=${this.handleClick}
></div>`;
}

@property({ attribute: false })
Expand Down
Loading