mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:39:01 +08:00
fix: fix a bug when parsing attributes if no parseHTML method is provided, fix #2058
This commit is contained in:
parent
c94d2b0517
commit
5da313a548
@ -3,7 +3,7 @@ export default function fromString(value: any): any {
|
||||
return value
|
||||
}
|
||||
|
||||
if (value.match(/^\d*(\.\d+)?$/)) {
|
||||
if (value.match(/^[+-]?(?:\d*\.)?\d+$/)) {
|
||||
return Number(value)
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,12 @@ describe('fromString', () => {
|
||||
expect(value).to.eq('test')
|
||||
})
|
||||
|
||||
it('should return an empty string', () => {
|
||||
const value = fromString('')
|
||||
|
||||
expect(value).to.eq('')
|
||||
})
|
||||
|
||||
it('should convert to a number', () => {
|
||||
const value = fromString('1')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user