-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #761 from streamich/peritext-stacked-inline-commands
Peritext formatting when selection is collapsed
- Loading branch information
Showing
18 changed files
with
298 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/json-crdt-peritext-ui/components/ButtonGroup/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// biome-ignore lint: React is used for JSX | ||
import * as React from 'react'; | ||
import {rule} from 'nano-theme'; | ||
|
||
const blockClass = rule({ | ||
d: 'flex', | ||
flw: 'wrap', | ||
columnGap: '4px', | ||
rowGap: '4px', | ||
w: '100%', | ||
maxW: '100%', | ||
bxz: 'border-box', | ||
ff: 'Inter, ui-sans-serif, system-ui, -apple-system, "system-ui", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"', | ||
lh: '24px', | ||
mr: 0, | ||
}); | ||
|
||
export interface ButtonGroup { | ||
children?: React.ReactNode; | ||
} | ||
|
||
export const ButtonGroup: React.FC<ButtonGroup> = ({children}) => { | ||
return <div className={blockClass}>{children}</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// biome-ignore lint: React is used for JSX | ||
import * as React from 'react'; | ||
import {rule} from 'nano-theme'; | ||
import {useDebugCtx} from '../context'; | ||
import {ButtonGroup} from '../../../components/ButtonGroup'; | ||
import {Button} from '../../../components/Button'; | ||
import {useSyncStore} from '../../../react/hooks'; | ||
|
||
const consoleClass = rule({ | ||
bxz: 'border-box', | ||
bg: '#fafafa', | ||
fz: '8px', | ||
mr: '8px 0', | ||
pd: '8px 16px', | ||
bdrad: '8px', | ||
}); | ||
|
||
// biome-ignore lint: empty interface | ||
export type ConsoleProps = {}; | ||
|
||
export const Console: React.FC<ConsoleProps> = () => { | ||
const {ctx, flags} = useDebugCtx(); | ||
const dom = useSyncStore(flags.dom); | ||
const editor = useSyncStore(flags.editor); | ||
const peritext = useSyncStore(flags.peritext); | ||
const model = useSyncStore(flags.model); | ||
|
||
if (!ctx) return null; | ||
|
||
return ( | ||
<div className={consoleClass}> | ||
<ButtonGroup> | ||
<Button small active={dom} onClick={() => flags.dom.next(!dom)}> | ||
DOM | ||
</Button> | ||
<Button small active={editor} onClick={() => flags.editor.next(!editor)}> | ||
Editor | ||
</Button> | ||
<Button small active={peritext} onClick={() => flags.peritext.next(!peritext)}> | ||
Peritext | ||
</Button> | ||
<Button small active={model} onClick={() => flags.model.next(!model)}> | ||
Model | ||
</Button> | ||
</ButtonGroup> | ||
{!!dom && <pre>{ctx.dom + ''}</pre>} | ||
{!!editor && <pre>{ctx.peritext.editor + ''}</pre>} | ||
{!!peritext && <pre>{ctx.peritext + ''}</pre>} | ||
{!!model && <pre>{ctx.peritext.model + ''}</pre>} | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.