Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/components/CodeiumEditor/CodeiumEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ export interface CodeiumEditorProps extends EditorProps {
* documents.
*/
otherDocuments?: Document[];

/**
* Optional classname for the container.
*/
containerClassName?: string;

/**
* Optional styles for the container.
*/
containerStyle?: React.CSSProperties;
}

/**
Expand All @@ -43,6 +53,8 @@ export interface CodeiumEditorProps extends EditorProps {
export const CodeiumEditor: React.FC<CodeiumEditorProps> = ({
languageServerAddress = 'https://web-backend.codeium.com',
otherDocuments = [],
containerClassName = '',
containerStyle = {},
...props
}) => {
const editorRef = useRef<editor.IStandaloneCodeEditor | null>(null);
Expand Down Expand Up @@ -166,7 +178,9 @@ export const CodeiumEditor: React.FC<CodeiumEditorProps> = ({
style={{
...layout,
position: 'relative',
...containerStyle,
}}
className={containerClassName}
>
<a
href={'https://codeium.com?referrer=codeium-editor'}
Expand Down
68 changes: 68 additions & 0 deletions src/stories/CodeiumEditor.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,74 @@ export const MarkdownEditor: Story = {
},
};

export const PlainTextEditor: Story = {
decorators: (Story) => (
<div>
<h1>Plain Text</h1>
<textarea
style={{
width: '700px',
height: '100px',
border: '1px solid black',
borderRadius: '2px',
padding: '6px',
fontFamily: 'sans-serif',
}}
placeholder="Type something"
/>
<Story />
</div>
),
args: {
...baseParams,
language: 'markdown',
value: 'This is a test textarea. Lorem',
containerStyle: {
border: '1px solid black',
borderRadius: '2px',
padding: '6px',
},
options: {
scrollbar: {
vertical: 'hidden',
horizontal: 'hidden',
},
renderControlCharacters: false,
glyphMargin: false,
rulers: [],
overviewRulerLanes: 0,
overviewRulerBorder: false,
wordWrap: 'on',
renderLineHighlight: 'none',
lineNumbers: 'off',
renderWhitespace: 'none',
hideCursorInOverviewRuler: true,
scrollBeyondLastLine: false,
smoothScrolling: true,
folding: false,
fontFamily: 'Helvetica',
fontSize: 13,
language: 'plaintext',
lineDecorationsWidth: 0,
minimap: {
enabled: false,
},
occurrencesHighlight: 'off',
cursorStyle: 'line-thin',
hover: {
enabled: false,
},
selectionHighlight: false,
find: {
seedSearchStringFromSelection: 'never',
},
multiCursorLimit: 1,
links: false,
matchBrackets: 'never',
},
},
};

const HTML_SNIPPET = `<html>
<head>
<title>Contact Form</title>
Expand Down