diff --git a/src/css/prosemirror.scss b/src/css/prosemirror.scss
index 7d60937cf31..cd0f05ee362 100644
--- a/src/css/prosemirror.scss
+++ b/src/css/prosemirror.scss
@@ -98,7 +98,7 @@ div.ProseMirror {
padding: .5em 0;
}
- p.paragraph-content {
+ p .paragraph-content {
margin-bottom: 1em;
line-height: 150%;
}
@@ -248,7 +248,7 @@ div.ProseMirror {
position: relative;
padding-left: 3px;
- p.paragraph-content {
+ p .paragraph-content {
margin-bottom: 0.5em;
}
}
diff --git a/src/nodes/Paragraph.js b/src/nodes/Paragraph.js
index fb7cc6ce924..035d5f622af 100644
--- a/src/nodes/Paragraph.js
+++ b/src/nodes/Paragraph.js
@@ -1,13 +1,11 @@
import TiptapParagraph from '@tiptap/extension-paragraph'
+import { VueNodeViewRenderer } from '@tiptap/vue-2'
+import ParagraphView from './ParagraphView.vue'
const Paragraph = TiptapParagraph.extend({
- addOptions() {
- return {
- HTMLAttributes: {
- class: 'paragraph-content',
- },
- }
+ addNodeView() {
+ return VueNodeViewRenderer(ParagraphView)
},
parseHTML() {
diff --git a/src/nodes/ParagraphView.vue b/src/nodes/ParagraphView.vue
new file mode 100644
index 00000000000..d403632434f
--- /dev/null
+++ b/src/nodes/ParagraphView.vue
@@ -0,0 +1,133 @@
+
+
+
+
', '
') + return html.replaceAll('><', '>\n<').replace(/\n$/, '') } diff --git a/src/tests/tiptap.spec.js b/src/tests/tiptap.spec.js index 1deac36115f..1a5fbb27a97 100644 --- a/src/tests/tiptap.spec.js +++ b/src/tests/tiptap.spec.js @@ -13,11 +13,11 @@ const renderedHTML = ( markdown ) => { describe('TipTap', () => { it('render softbreaks', () => { const markdown = 'This\nis\none\nparagraph' - expect(renderedHTML(markdown)).toEqual(`
${markdown}
`) + expect(renderedHTML(markdown)).toEqual(`${markdown}
`) }) it('render hardbreak', () => { const markdown = 'Hard line break \nNext Paragraph' - expect(renderedHTML(markdown)).toEqual('Hard line break
Next Paragraph
Hard line break
Next Paragraph