Skip to content

Commit

Permalink
feat: Introduce tiptap mime type based modes with default extensions.…
Browse files Browse the repository at this point in the history
… DRAFT /1

NOTE: this would contradict the current mode where only what is defined
in the toolbar is actually allowed as HTML. this is limiting! better, we
define a default set of extension per mime type. this can then also be
imported in the tiptap collaboration server to construct a valid
representation of the content and be able to store that from there back
to the backend.
  • Loading branch information
thet committed Sep 30, 2023
1 parent 33d016b commit 336ebd2
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import ExtBlockquote from "@tiptap/extension-blockquote";
import ExtBold from "@tiptap/extension-bold";
import ExtBulletList from "@tiptap/extension-bullet-list";
import ExtCode from "@tiptap/extension-code";
import ExtCodeBlock from "@tiptap/extension-code-block";
import ExtDocument from "@tiptap/extension-document";
import ExtEmbed from "./extensions/embed";
import ExtFigcaption from "./extensions/figcaption";
import ExtFigure from "./extensions/figure";
import ExtHardBreak from "@tiptap/extension-hard-break";
import ExtHeading from "./extensions/heading";
import ExtHorizontalRule from "@tiptap/extension-horizontal-rule";
import ExtImageFigure from "./extensions/image-figure";
import ExtImageInline from "./extensions/image-inline";
import ExtItalic from "@tiptap/extension-italic";
import ExtLink from "./extensions/link";
import ExtListItem from "@tiptap/extension-list-item";
import ExtOrderedList from "@tiptap/extension-ordered-list";
import ExtParagraph from "@tiptap/extension-paragraph";
import ExtStrike from "@tiptap/extension-strike";
import ExtTable from "@tiptap/extension-table";
import ExtTableCell from "@tiptap/extension-table-cell";
import ExtTableHeader from "@tiptap/extension-table-header";
import ExtTableRow from "@tiptap/extension-table-row";
import ExtText from "@tiptap/extension-text";

// source extension?

export const modes = {
"text/html": [
ExtBlockquote,
ExtBold,
ExtBulletList,
ExtCode,
ExtCodeBlock,
ExtDocument,
ExtEmbed,
ExtFigcaption,
ExtFigure,
ExtHardBreak,
ExtHeading,
ExtHorizontalRule,
ExtImageFigure,
ExtImageInline,
ExtItalic,
ExtLink,
ExtListItem,
ExtOrderedList,
ExtParagraph,
ExtStrike,
ExtTable,
ExtTableCell,
ExtTableHeader,
ExtTableRow,
ExtText,
],
"text/plain": [ExtDocument],
"text/markdown": [ExtDocument],
};

export default { modes };

0 comments on commit 336ebd2

Please sign in to comment.