convert-rich-text
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -34,2 +34,3 @@ module.exports = function(grunt) { | ||
options: { | ||
watch: true, | ||
browserifyOptions: { | ||
@@ -47,9 +48,2 @@ standalone: '<%= pkg.name %>' | ||
options: { | ||
alias: [ '<%= pkg.main %>:<%= pkg.name %>' ] | ||
} | ||
}, | ||
watch: { | ||
src: [ '<%= pkg.main %>' ], | ||
dest: './build/<%= pkg.name %>.require.js', | ||
options: { | ||
alias: [ '<%= pkg.main %>:<%= pkg.name %>' ], | ||
@@ -69,2 +63,3 @@ watch: true | ||
external: [ '<%= pkg.name %>' ], | ||
watch: true, | ||
// Embed source map for tests | ||
@@ -71,0 +66,0 @@ debug: true |
@@ -10,2 +10,3 @@ var dom = require('./dom'); | ||
this.line = null; | ||
this.newLine(); | ||
} | ||
@@ -26,3 +27,2 @@ | ||
if (lineText.length) { | ||
this.newLine(); | ||
this.appendChild(lineText, attrs); | ||
@@ -33,2 +33,3 @@ } | ||
this.formatLine(attrs); | ||
this.newLine(); | ||
} | ||
@@ -41,3 +42,4 @@ }.bind(this)); | ||
Doc.prototype.getHTML = function() { | ||
return this.root.innerHTML; | ||
// HACK: fix this | ||
return this.root.innerHTML.replace(/<p><\/p>$/, ''); | ||
}; | ||
@@ -44,0 +46,0 @@ |
{ | ||
"name": "convert-rich-text", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Convert an insert-only rich-text delta into HTML", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,6 +28,7 @@ var assert = require('chai').assert; | ||
delta: { ops: [ | ||
{insert: 'Hello, World!\n', attributes: {bold: true}} | ||
{insert: 'Hello, '}, | ||
{insert: 'World!\n', attributes: {bold: true}} | ||
]}, | ||
expected: | ||
'<p><b>Hello, World!</b></p>' | ||
'<p>Hello, <b>World!</b></p>' | ||
}, | ||
@@ -39,6 +40,7 @@ { | ||
{insert: '\n', attributes: {firstheader: true}}, | ||
{insert: 'This is a demo of convert-rich-text'}, | ||
{insert: 'This is a demo of convert-rich-text '}, | ||
{insert: 1, attributes: { | ||
image: 'http://i.imgur.com/2ockv.gif' | ||
}}, | ||
{insert: ' '}, | ||
{insert: 'Google', attributes: {link: 'https://www.google.com'}} | ||
@@ -49,5 +51,5 @@ ]}, | ||
'<h1><b>This is a second line.</b></h1>' + | ||
'<p>This is a demo of convert-rich-text</p>' + | ||
'<p><img src="http://i.imgur.com/2ockv.gif"></p>' + | ||
'<p><a href="https://www.google.com">Google</a></p>' | ||
'<p>This is a demo of convert-rich-text ' + | ||
'<img src="http://i.imgur.com/2ockv.gif"> ' + | ||
'<a href="https://www.google.com">Google</a></p>' | ||
}, | ||
@@ -73,2 +75,13 @@ { | ||
{ | ||
desc: 'Links', | ||
delta: { ops: [ | ||
{attributes:{bold:true},insert:'hello'}, | ||
{insert:' '}, | ||
{attributes:{link:'http://vox.com'},insert:'world'}, | ||
{insert:' this works...?\n'} | ||
]}, | ||
expected: | ||
'<p><b>hello</b> <a href="http://vox.com">world</a> this works...?</p>' | ||
}, | ||
{ | ||
desc: 'Custom', | ||
@@ -75,0 +88,0 @@ delta: { ops: [ |
25555
489