✨ (commented out for now) katex support
This commit is contained in:
parent
cbd04fb16b
commit
df79e46283
2 changed files with 26 additions and 2 deletions
|
|
@ -1,9 +1,11 @@
|
|||
import { JSONContent } from "@tiptap/react";
|
||||
import { ContextItemWithId } from "core";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import styled, { keyframes } from "styled-components";
|
||||
import { defaultBorderRadius, vscBackground } from "..";
|
||||
import { selectSlashCommands } from "../../redux/selectors";
|
||||
import { newSession } from "../../redux/slices/stateSlice";
|
||||
import { RootStore } from "../../redux/store";
|
||||
import ContextItemsPeek from "./ContextItemsPeek";
|
||||
import TipTapEditor from "./TipTapEditor";
|
||||
|
|
@ -58,12 +60,30 @@ interface ContinueInputBoxProps {
|
|||
}
|
||||
|
||||
function ContinueInputBox(props: ContinueInputBoxProps) {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const active = useSelector((store: RootStore) => store.state.active);
|
||||
const availableSlashCommands = useSelector(selectSlashCommands);
|
||||
const availableContextProviders = useSelector(
|
||||
(store: RootStore) => store.state.config.contextProviders
|
||||
);
|
||||
|
||||
const [editorState, setEditorState] = useState(props.editorState);
|
||||
|
||||
useEffect(() => {
|
||||
const listener = (e) => {
|
||||
dispatch(newSession());
|
||||
if (e.data.type === "newSessionWithPrompt") {
|
||||
setEditorState(e.data.prompt);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("message", listener);
|
||||
return () => {
|
||||
window.removeEventListener("message", listener);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
|
|
@ -87,7 +107,7 @@ function ContinueInputBox(props: ContinueInputBoxProps) {
|
|||
borderRadius={defaultBorderRadius}
|
||||
>
|
||||
<TipTapEditor
|
||||
editorState={props.editorState}
|
||||
editorState={editorState}
|
||||
onEnter={props.onEnter}
|
||||
isMainInput={props.isMainInput}
|
||||
availableContextProviders={availableContextProviders}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import React, { memo, useEffect } from "react";
|
||||
import { useRemark } from "react-remark";
|
||||
// import rehypeKatex from "rehype-katex";
|
||||
// import remarkMath from "remark-math";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
defaultBorderRadius,
|
||||
|
|
@ -110,6 +112,8 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
|
|||
props: StyledMarkdownPreviewProps
|
||||
) {
|
||||
const [reactContent, setMarkdownSource] = useRemark({
|
||||
// remarkPlugins: [remarkMath],
|
||||
// rehypePlugins: [rehypeKatex as any, {}],
|
||||
rehypeReactOptions: {
|
||||
components: {
|
||||
a: ({ node, ...props }) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue