Skip to content

Commit 3a3929d

Browse files
committed
feat(json-crdt-peritext-ui): 🎸 scaffold generic configurator
1 parent d6321b0 commit 3a3929d

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// biome-ignore lint: lint/style/useImportType
22
import * as React from 'react';
3+
import {FormattingNewGeneric} from './FormattingNewGeneric';
34
import type {EditProps} from '../../../types';
45

56
export interface FormattingNewProps extends EditProps {}
67

78
export const FormattingNew: React.FC<FormattingNewProps> = (props) => {
89
const Edit = props.formatting.behavior.data().Edit;
910

10-
return Edit ? <Edit isNew {...props} /> : <div>new renderer not provided</div>;
11+
return Edit ? <Edit isNew {...props} /> : <FormattingNewGeneric {...props} />;
1112
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// biome-ignore lint: lint/style/useImportType
2+
import * as React from 'react';
3+
import type {EditProps} from '../../../types';
4+
5+
export interface FormattingNewGenericProps extends EditProps {}
6+
7+
export const FormattingNewGeneric: React.FC<FormattingNewGenericProps> = ({formatting}) => {
8+
9+
return (
10+
<div>Generic configurator</div>
11+
);
12+
};

src/json-crdt-peritext-ui/plugins/toolbar/state/ToolbarState.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,15 @@ export class ToolbarState implements UiLifeCycles {
7373
// }
7474

7575
public startSliceConfig(tag: SliceTypeCon | string | number, menu?: MenuItem): NewFormatting | undefined {
76-
console.log(1);
7776
const editor = this.txt.editor;
7877
const behavior = editor.getRegistry().get(tag);
79-
console.log(2);
8078
const range = editor.mainCursor()?.range();
8179
if (!range) return;
82-
console.log(3);
8380
const newSlice = this.newSlice;
8481
if (!behavior) {
85-
console.log(4);
8682
newSlice.next(void 0);
8783
return;
8884
}
89-
console.log(5);
9085
const formatting = new NewFormatting(behavior, range, this);
9186
newSlice.next(formatting);
9287
return formatting;

0 commit comments

Comments
 (0)