mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
chore(editor): adjust min width of edgeless note (#10153)
Close [BS-2499](https://linear.app/affine-design/issue/BS-2499/所有notes最小宽度调整为218px) ### What changes - adjusted min width of edgeless note - placeholder show ellipsis in min edgeless note - refactored somes button of `change-note-button.ts` with `isPageBlock`
This commit is contained in:
@@ -1145,7 +1145,7 @@ export class EdgelessSelectedRectWidget extends WidgetComponent<
|
||||
this._isWidthLimit = bound.w === NOTE_MIN_WIDTH * scale;
|
||||
this._isHeightLimit = bound.h === NOTE_MIN_HEIGHT * scale;
|
||||
|
||||
if (bound.h >= NOTE_MIN_HEIGHT * scale) {
|
||||
if (bound.h > NOTE_MIN_HEIGHT * scale) {
|
||||
this.doc.updateBlock(element, () => {
|
||||
element.edgeless.collapse = true;
|
||||
element.edgeless.collapsedHeight = bound.h / scale;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { changeNoteDisplayMode } from '@blocksuite/affine-block-note';
|
||||
import {
|
||||
changeNoteDisplayMode,
|
||||
isPageBlock,
|
||||
} from '@blocksuite/affine-block-note';
|
||||
import { EdgelessCRUDIdentifier } from '@blocksuite/affine-block-surface';
|
||||
import type {
|
||||
EdgelessColorPickerButton,
|
||||
@@ -24,7 +27,7 @@ import {
|
||||
import {
|
||||
type ColorScheme,
|
||||
DefaultTheme,
|
||||
NoteBlockModel,
|
||||
type NoteBlockModel,
|
||||
NoteDisplayMode,
|
||||
resolveColor,
|
||||
type StrokeStyle,
|
||||
@@ -35,7 +38,6 @@ import {
|
||||
SidebarExtensionIdentifier,
|
||||
ThemeProvider,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import { matchModels } from '@blocksuite/affine-shared/utils';
|
||||
import {
|
||||
Bound,
|
||||
countBy,
|
||||
@@ -154,16 +156,6 @@ export class EdgelessChangeNoteButton extends WithDisposable(LitElement) {
|
||||
return this.edgeless.doc;
|
||||
}
|
||||
|
||||
private get _enableAutoHeight() {
|
||||
return !(
|
||||
this._pageBlockEnabled &&
|
||||
this.notes.length === 1 &&
|
||||
this.notes[0].parent?.children.find(child =>
|
||||
matchModels(child, [NoteBlockModel])
|
||||
) === this.notes[0]
|
||||
);
|
||||
}
|
||||
|
||||
private _getScaleLabel(scale: number) {
|
||||
return Math.round(scale * 100) + '%';
|
||||
}
|
||||
@@ -176,6 +168,7 @@ export class EdgelessChangeNoteButton extends WithDisposable(LitElement) {
|
||||
}
|
||||
|
||||
private _setCollapse() {
|
||||
this.doc.captureSync();
|
||||
this.notes.forEach(note => {
|
||||
const { collapse, collapsedHeight } = note.edgeless;
|
||||
|
||||
@@ -341,11 +334,7 @@ export class EdgelessChangeNoteButton extends WithDisposable(LitElement) {
|
||||
const currentMode = DisplayModeMap[displayMode];
|
||||
const onlyOne = len === 1;
|
||||
const isDocOnly = displayMode === NoteDisplayMode.DocOnly;
|
||||
const isFirstNote =
|
||||
onlyOne &&
|
||||
note.parent?.children.find(child =>
|
||||
matchModels(child, [NoteBlockModel])
|
||||
) === note;
|
||||
|
||||
const theme = this.edgeless.std.get(ThemeProvider).theme;
|
||||
const buttons = [
|
||||
onlyOne && this._advancedVisibilityEnabled
|
||||
@@ -376,7 +365,7 @@ export class EdgelessChangeNoteButton extends WithDisposable(LitElement) {
|
||||
: nothing,
|
||||
|
||||
onlyOne &&
|
||||
!isFirstNote &&
|
||||
!isPageBlock(this.edgeless.std, note) &&
|
||||
this._pageBlockEnabled &&
|
||||
!this._advancedVisibilityEnabled
|
||||
? html`<editor-icon-button
|
||||
@@ -532,7 +521,7 @@ export class EdgelessChangeNoteButton extends WithDisposable(LitElement) {
|
||||
|
||||
onlyOne ? this.quickConnectButton : nothing,
|
||||
|
||||
this._enableAutoHeight
|
||||
!isPageBlock(this.edgeless.std, this.notes[0])
|
||||
? html`<editor-icon-button
|
||||
aria-label="Size"
|
||||
data-testid="edgeless-note-auto-height"
|
||||
|
||||
Reference in New Issue
Block a user