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
3 changes: 3 additions & 0 deletions src/stories/editor/_types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ export interface EditorArgs extends Partial<EditorOptions> {
hasInlineMenu?: boolean;
bubbleOptions?: any;
headerTitle?: string;
className?: string;
footerSaveText?: string;
/** Applies validation state styling */
validation?: validationStatus;
onSave?: (editor: Editor) => void;
disableSaveShortcut?: boolean;
disableHeader?: boolean;
contentType?: "markdown";
}

export interface EditorHeaderArgs {
Expand Down
3 changes: 3 additions & 0 deletions src/stories/editor/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Markdown.args = {
...defaultArgs,
children: "# Hello i'm a markdown title",
contentType: "markdown",
disableHeader: true,
className: "markdown-editor",
disableSaveShortcut: true,
};

export const Placeholder = Template.bind({});
Expand Down
12 changes: 10 additions & 2 deletions src/stories/editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ const Editor = ({
footerSaveText,
placeholderOptions,
extensions,
disableHeader,
className,
...props
}: PropsWithChildren<EditorArgs>) => {
const {
Expand Down Expand Up @@ -135,10 +137,16 @@ const Editor = ({
ed.on("update", ({ editor }) => setActiveEditor(editor as TipTapEditor));

return (
<EditorContainer editable={isEditable} validation={props.validation}>
<EditorContainer
className={className}
editable={isEditable}
validation={props.validation}
>
{isEditable && (
<>
<EditorHeader title={headerTitle} validation={props.validation} />
{!disableHeader && (
<EditorHeader title={headerTitle} validation={props.validation} />
)}
{hasInlineMenu && <FloatingMenu editor={ed} />}
</>
)}
Expand Down
Loading