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

Commit 66a36e9

Browse files
committed
Merge branch '123-fr-control-edition-that-starts-with-but-is-not-finished-inside'
2 parents d3bf45f + 7b28ea8 commit 66a36e9

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

src/cdm/ComponentsModel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type CellComponentProps = {
1313

1414
export type EditorCellComponentProps = {
1515
persistChange: (changedValue: string) => void;
16+
textCell: string;
1617
} & CellComponentProps;
1718

1819
export type DataviewFiltersProps = {

src/components/cellTypes/EditorCell.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import { useState } from "react";
55
import { MarkdownEditor } from "components/cellTypes/Editor/MarkdownEditor";
66

77
const EditorCell = (props: EditorCellComponentProps) => {
8-
const { defaultCell, persistChange } = props;
9-
const { cell, table } = defaultCell;
8+
const { defaultCell, persistChange, textCell } = props;
9+
const { table } = defaultCell;
1010
/** Ref to cell container */
1111
const editableMdRef = useRef<HTMLInputElement>();
1212
/** Columns information */
1313

14-
const [editorValue, setEditorValue] = useState(cell.getValue());
14+
const [editorValue, setEditorValue] = useState(textCell);
1515

1616
// onChange handler
1717
const handleOnChange: ChangeEventHandler<HTMLInputElement> = (event) => {
@@ -28,7 +28,7 @@ const EditorCell = (props: EditorCellComponentProps) => {
2828
* Close editor undoing any changes realised
2929
*/
3030
const handleOnEscape = useCallback(() => {
31-
persistChange(cell.getValue()?.toString());
31+
persistChange(textCell);
3232
}, []);
3333

3434
/**

src/components/cellTypes/TextCell.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const TextCell = (props: CellComponentProps) => {
2424
(state) => state.actions
2525
);
2626

27+
const textCell = textRow[column.id]?.toString();
2728
/** Ref to cell container */
2829
const containerCellRef = useRef<HTMLDivElement>();
2930
const [dirtyCell, setDirtyCell] = useState(false);
@@ -39,12 +40,7 @@ const TextCell = (props: CellComponentProps) => {
3940
if (containerCellRef.current !== undefined) {
4041
containerCellRef.current.innerHTML = "";
4142

42-
renderMarkdown(
43-
defaultCell,
44-
textRow[column.id]?.toString(),
45-
containerCellRef.current,
46-
5
47-
);
43+
renderMarkdown(defaultCell, textCell, containerCellRef.current, 5);
4844
}
4945
}, [dirtyCell, cell.getValue()]);
5046

@@ -64,7 +60,11 @@ const TextCell = (props: CellComponentProps) => {
6460
};
6561

6662
return dirtyCell ? (
67-
<EditorCell defaultCell={defaultCell} persistChange={persistChange} />
63+
<EditorCell
64+
defaultCell={defaultCell}
65+
persistChange={persistChange}
66+
textCell={textCell}
67+
/>
6868
) : (
6969
<span
7070
ref={containerCellRef}

src/helpers/Constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export function getOperatorFilterValue(keyToFind: string): string {
271271
}
272272

273273
export const MarkdownBreakerRules = Object.freeze({
274-
INIT_CHARS: ['`', '"', '[', '{', '*'],
274+
INIT_CHARS: ['`', '"', '[', '{', '*', '!'],
275275
BETWEEN_CHARS: [':'],
276276
UNIQUE_CHARS: ['?'],
277277
})

0 commit comments

Comments
 (0)