change the way text suggestions are rendered + option to disable syntactic sugar
This commit is contained in:
parent
ea8c015eff
commit
2d81e42447
12 changed files with 357 additions and 291 deletions
12
src/App.tsx
12
src/App.tsx
|
|
@ -48,6 +48,8 @@ export function App() {
|
|||
// load from localStorage
|
||||
const [appState, setAppState] = useState(loadFromLocalStorage());
|
||||
|
||||
const [syntacticSugar, setSyntacticSugar] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
// persist accross reloads
|
||||
localStorage["appState"] = JSON.stringify(appState);
|
||||
|
|
@ -146,15 +148,21 @@ export function App() {
|
|||
<button className="factoryReset" onClick={factoryReset}>
|
||||
FACTORY RESET
|
||||
</button>
|
||||
<label>
|
||||
<input type="checkbox"
|
||||
checked={syntacticSugar}
|
||||
onChange={e => setSyntacticSugar(e.target.checked)}/>
|
||||
syntactic sugar
|
||||
</label>
|
||||
</header>
|
||||
|
||||
<main onKeyDown={onKeyDown}>
|
||||
<CommandContext value={{undo: onUndo, redo: onRedo, doHighlight}}>
|
||||
<CommandContext value={{undo: onUndo, redo: onRedo, doHighlight, syntacticSugar}}>
|
||||
<Editor
|
||||
state={appState.history.at(-1)!}
|
||||
setState={pushHistory}
|
||||
onCancel={() => {}}
|
||||
suggestionPriority={() => 0}
|
||||
suggestionPriority={() => 1}
|
||||
/>
|
||||
</CommandContext>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue