Update hostic-dom to fix style attributes

This commit is contained in:
sibiraj-s
2021-07-20 16:23:19 +05:30
committed by Hans Pagel
parent 8ed6ac4219
commit 656a80fc3f
3 changed files with 34 additions and 12 deletions

View File

@@ -22,7 +22,7 @@
], ],
"dependencies": { "dependencies": {
"@tiptap/core": "^2.0.0-beta.86", "@tiptap/core": "^2.0.0-beta.86",
"hostic-dom": "^0.8.6", "hostic-dom": "^0.8.7",
"prosemirror-model": "^1.14.2" "prosemirror-model": "^1.14.2"
} }
} }

View File

@@ -4,6 +4,7 @@ import { generateJSON } from '@tiptap/html'
import Document from '@tiptap/extension-document' import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph' import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text' import Text from '@tiptap/extension-text'
import TextAlign from '@tiptap/extension-text-align'
describe('generateJSON', () => { describe('generateJSON', () => {
it('generate JSON from HTML without an editor instance', () => { it('generate JSON from HTML without an editor instance', () => {
@@ -26,4 +27,30 @@ describe('generateJSON', () => {
}], }],
})) }))
}) })
// issue: https://github.com/ueberdosis/tiptap/issues/1601
it('generate JSON with style attributes', () => {
const html = '<p style="text-align: center;">Example Text</p>'
const json = generateJSON(html, [
Document,
Paragraph,
Text,
TextAlign.configure({ types: ['paragraph'] })
])
expect(JSON.stringify(json)).to.eq(JSON.stringify({
type: 'doc',
content: [{
type: 'paragraph',
attrs: {
textAlign: 'center'
},
content: [{
type: 'text',
text: 'Example Text',
}],
}],
}))
})
}) })

View File

@@ -4839,12 +4839,7 @@ css-what@^3.2.1:
resolved "https://registry.yarnpkg.com/css-what/-/css-what-3.4.2.tgz#ea7026fcb01777edbde52124e21f327e7ae950e4" resolved "https://registry.yarnpkg.com/css-what/-/css-what-3.4.2.tgz#ea7026fcb01777edbde52124e21f327e7ae950e4"
integrity sha512-ACUm3L0/jiZTqfzRM3Hi9Q8eZqd6IK37mMWPLz9PJxkLWllYeRf+EHUSHYEtFop2Eqytaq1FizFVh7XfBnXCDQ== integrity sha512-ACUm3L0/jiZTqfzRM3Hi9Q8eZqd6IK37mMWPLz9PJxkLWllYeRf+EHUSHYEtFop2Eqytaq1FizFVh7XfBnXCDQ==
css-what@^4.0.0: css-what@^5.0.0, css-what@^5.0.1:
version "4.0.0"
resolved "https://registry.yarnpkg.com/css-what/-/css-what-4.0.0.tgz#35e73761cab2eeb3d3661126b23d7aa0e8432233"
integrity sha512-teijzG7kwYfNVsUh2H/YN62xW3KK9YhXEgSlbxMlcyjPNvdKJqFx5lrwlJgoFP1ZHlB89iGDlo/JyshKeRhv5A==
css-what@^5.0.0:
version "5.0.1" version "5.0.1"
resolved "https://registry.yarnpkg.com/css-what/-/css-what-5.0.1.tgz#3efa820131f4669a8ac2408f9c32e7c7de9f4cad" resolved "https://registry.yarnpkg.com/css-what/-/css-what-5.0.1.tgz#3efa820131f4669a8ac2408f9c32e7c7de9f4cad"
integrity sha512-FYDTSHb/7KXsWICVsxdmiExPjCfRC4qRFBdVwv7Ax9hMnvMmEjP9RfxTEZ3qPZGmADDn2vAKSo9UcN1jKVYscg== integrity sha512-FYDTSHb/7KXsWICVsxdmiExPjCfRC4qRFBdVwv7Ax9hMnvMmEjP9RfxTEZ3qPZGmADDn2vAKSo9UcN1jKVYscg==
@@ -7690,12 +7685,12 @@ hosted-git-info@^4.0.1:
dependencies: dependencies:
lru-cache "^6.0.0" lru-cache "^6.0.0"
hostic-dom@^0.8.6: hostic-dom@^0.8.7:
version "0.8.6" version "0.8.7"
resolved "https://registry.yarnpkg.com/hostic-dom/-/hostic-dom-0.8.6.tgz#5a5e2a1270b12ff4d479acdb679ba16de3028b58" resolved "https://registry.yarnpkg.com/hostic-dom/-/hostic-dom-0.8.7.tgz#fafb73da1d0dbd08b0c76e5baf3ca8aba28716be"
integrity sha512-gostOugTHuFKhnO4YQpH21SBc8A4jQ1mB5sqUCYC4gXm2LLwQ85V9EFa4DPh6Z9M6sCUJ7TAs1/hqr8iraX7Rw== integrity sha512-TUUD8jv1fzfbual/ljzYMcyXorjAJX4dtm9eE3YxSyVmGCQSfTyvvsXpz60IfeZDdPUB2vjTOhlI8n2l+8BdmA==
dependencies: dependencies:
css-what "^4.0.0" css-what "^5.0.1"
he "^1.2.0" he "^1.2.0"
hsl-regex@^1.0.0: hsl-regex@^1.0.0: