Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit cfb959b

Browse files
committed
wrap content is optional now
1 parent 1e5fde8 commit cfb959b

File tree

12 files changed

+68
-37
lines changed

12 files changed

+68
-37
lines changed

src/cdm/FolderModel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export interface ConfigColumn {
4040
media_height: number;
4141
isInline: boolean;
4242
content_alignment?: string;
43+
wrap_content?: boolean;
4344
task_hide_completed?: boolean;
4445
formula_query?: string;
4546
persist_formula?: boolean;

src/components/cellTypes/FormulaCell.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ const FormulaCell = (mdProps: CellComponentProps) => {
4646
return (
4747
<span
4848
ref={formulaRef}
49-
className={`${c(
50-
"md_cell " + getAlignmentClassname(tableColumn.config.content_alignment)
51-
)}`}
49+
className={`${c("md_cell " + getAlignmentClassname(tableColumn.config))}`}
5250
key={`formula_${cell.id}`}
5351
/>
5452
);

src/components/cellTypes/NumberCell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ const NumberCell = (props: CellComponentProps) => {
7070
onChange={handleOnChange}
7171
onKeyDown={handleKeyDown}
7272
onBlur={handleOnBlur}
73-
className={c(getAlignmentClassname(tableColumn.config.content_alignment))}
73+
className={c(getAlignmentClassname(tableColumn.config))}
7474
/>
7575
) : (
7676
<span
77-
className={c(getAlignmentClassname(tableColumn.config.content_alignment))}
77+
className={c(getAlignmentClassname(tableColumn.config))}
7878
onClick={handleEditableOnclick}
7979
style={{ width: column.getSize() }}
8080
>

src/components/cellTypes/TextCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const TextCell = (props: CellComponentProps) => {
7373
ref={containerCellRef}
7474
onClick={handleEditableOnclick}
7575
style={{ width: column.getSize() }}
76-
className={c(getAlignmentClassname(tableColumn.config.content_alignment))}
76+
className={c(getAlignmentClassname(tableColumn.config))}
7777
/>
7878
);
7979
};

src/components/modals/columnSettings/ColumnSections.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { SelectedColumnOptionsHandler } from "components/modals/columnSettings/h
77
import { HideCompletedTaskToggleHandler } from "components/modals/columnSettings/handlers/tasks/HideCompletedTaskToggleHandler";
88
import { LinkAliasToggleHandler } from "components/modals/columnSettings/handlers/media/LinkAliasToggleHandler";
99
import { FormulaInputHandler } from "components/modals/columnSettings/handlers/automations/FormulaInputHandler";
10-
import { AlignmentSelectorHandler } from "components/modals/columnSettings/handlers/AlignmentSelectorHandler";
10+
import { AlignmentSelectorHandler } from "components/modals/columnSettings/handlers/styles/AlignmentSelectorHandler";
11+
import { ToggleWrapContentHandler } from "components/modals/columnSettings/handlers/styles/ToggleWrapContentHandler";
1112
import { InputType } from "helpers/Constants";
1213
import { AbstractChain } from "patterns/AbstractFactoryChain";
1314
import { AbstractHandler } from "patterns/AbstractHandler";
@@ -31,6 +32,7 @@ class StyleSetttingsSection extends AbstractChain<ColumnSettingsHandlerResponse>
3132
case InputType.NUMBER:
3233
case InputType.FORMULA:
3334
particularHandlers.push(new AlignmentSelectorHandler());
35+
particularHandlers.push(new ToggleWrapContentHandler());
3436
break;
3537
default:
3638
// do nothing

src/components/modals/columnSettings/handlers/AlignmentSelectorHandler.tsx renamed to src/components/modals/columnSettings/handlers/styles/AlignmentSelectorHandler.tsx

File renamed without changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { add_toggle } from "settings/SettingsComponents";
2+
import { ColumnSettingsHandlerResponse } from "cdm/ModalsModel";
3+
import { AbstractHandlerClass } from "patterns/AbstractHandler";
4+
export class ToggleWrapContentHandler extends AbstractHandlerClass<ColumnSettingsHandlerResponse> {
5+
settingTitle: string = "Wrap content";
6+
handle(
7+
columnHandlerResponse: ColumnSettingsHandlerResponse
8+
): ColumnSettingsHandlerResponse {
9+
const { column, containerEl, columnSettingsManager } =
10+
columnHandlerResponse;
11+
const { view } = columnSettingsManager.modal;
12+
const wrap_content_togle_promise = async (value: boolean): Promise<void> => {
13+
// Persist value
14+
await view.diskConfig.updateColumnConfig(column.key, {
15+
wrap_content: value,
16+
});
17+
columnSettingsManager.modal.enableReset = true;
18+
};
19+
add_toggle(
20+
containerEl,
21+
this.settingTitle,
22+
"Wrap content of the cells in the column",
23+
column.config.wrap_content,
24+
wrap_content_togle_promise
25+
);
26+
return this.goNext(columnHandlerResponse);
27+
}
28+
}

src/components/portals/SelectPortal.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ const SelectPortal = (popperProps: CellComponentProps) => {
9494
menuPortalTarget={activeDocument.body}
9595
menuPlacement="auto"
9696
menuShouldBlockScroll={true}
97-
className={c("text-align-center")}
97+
className={`react-select-container ${c(
98+
"tags-container text-align-center"
99+
)}`}
100+
classNamePrefix="react-select"
98101
key={`${tableColumn.key}-select-open`}
99102
/>
100103
</div>
@@ -108,7 +111,7 @@ const SelectPortal = (popperProps: CellComponentProps) => {
108111
) : (
109112
/* Current value of the select */
110113
<div
111-
className={`cell-padding d-flex ${c("text-align-center")}`}
114+
className={`${c("text-align-center")}`}
112115
onClick={() => setShowSelect(true)}
113116
style={{ width: column.getSize() }}
114117
>

src/components/portals/TagsPortal.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ const TagsPortal = (tagsProps: CellComponentProps) => {
107107
onBlur={() => setShowSelectTags(false)}
108108
onChange={handleOnChange}
109109
menuPortalTarget={activeDocument.body}
110-
className={c("tags-container text-align-center")}
110+
className={`react-select-container ${c(
111+
"tags-container text-align-center"
112+
)}`}
113+
classNamePrefix="react-select"
111114
menuPlacement="auto"
112115
menuShouldBlockScroll={true}
113116
/>

src/helpers/Constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ export const COLUMN_ALIGNMENT_OPTIONS = Object.freeze({
7575
CENTER: 'text-align-center',
7676
RIGHT: 'text-align-right',
7777
JUSTIFY: 'text-align-justify',
78+
NOWRAP: 'text-nowrap',
79+
WRAP: 'text-wrap',
7880
});
7981

8082
export const DEFAULT_COLUMN_CONFIG: ConfigColumn = Object.freeze({

0 commit comments

Comments
 (0)