Skip to content

Commit

Permalink
DLT-2237: add image extension to editor
Browse files Browse the repository at this point in the history
  • Loading branch information
emariotti-dialpad committed Dec 10, 2024
1 parent 14d997a commit b13ce9f
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 86 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"@tiptap/extension-code-block": "^2.6.6",
"@tiptap/extension-document": "^2.6.6",
"@tiptap/extension-hard-break": "^2.6.6",
"@tiptap/extension-image": "^2.6.6",
"@tiptap/extension-history": "^2.6.6",
"@tiptap/extension-italic": "^2.6.6",
"@tiptap/extension-link": "^2.6.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Paragraph from '@tiptap/extension-paragraph';
import Placeholder from '@tiptap/extension-placeholder';
import Bold from '@tiptap/extension-bold';
import BulletList from '@tiptap/extension-bullet-list';
import Image from '@tiptap/extension-image';
import Italic from '@tiptap/extension-italic';
import TipTapLink from '@tiptap/extension-link';
import ListItem from '@tiptap/extension-list-item';
Expand Down Expand Up @@ -282,6 +283,14 @@ export default {
default: true,
},

/**
* Whether the input allows inline images to be rendered.
*/
allowInlineImages: {
type: Boolean,
default: true,
},

/**
* Additional TipTap extensions to be added to the editor.
*/
Expand Down Expand Up @@ -447,6 +456,10 @@ export default {
}));
}

if (this.allowInlineImages) {
extensions.push(Image);
}

if (this.additionalExtensions.length) {
extensions.push(...this.additionalExtensions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Blockquote from '@tiptap/extension-blockquote';
import CodeBlock from '@tiptap/extension-code-block';
import Document from '@tiptap/extension-document';
import HardBreak from '@tiptap/extension-hard-break';
import Image from '@tiptap/extension-image';
import Paragraph from '@tiptap/extension-paragraph';
import Placeholder from '@tiptap/extension-placeholder';
import Bold from '@tiptap/extension-bold';
Expand Down Expand Up @@ -282,6 +283,14 @@ export default {
default: true,
},

/**
* Whether the input allows inline images to be rendered.
*/
allowInlineImages: {
type: Boolean,
default: true,
},

/**
* Additional TipTap extensions to be added to the editor.
*/
Expand Down Expand Up @@ -447,6 +456,10 @@ export default {
}));
}

if (this.allowInlineImages) {
extensions.push(Image);
}

if (this.additionalExtensions.length) {
extensions.push(...this.additionalExtensions);
}
Expand Down
Loading

0 comments on commit b13ce9f

Please sign in to comment.