diff --git a/spec/helpers/util.js b/spec/helpers/util.js index d2e902140..7fab8d731 100644 --- a/spec/helpers/util.js +++ b/spec/helpers/util.js @@ -238,3 +238,1038 @@ function selectElementContentsAndFire(el, options) { } } } + +var WORD_PASTE_EXAMPLE = ['', +'', +'
', +'', +'', +'', +'', +'', +'', +'', +'', +'', +'', +'', +'', +'', +'', +'', +'', +'', +'My',
+'complicated word document renders like this in the card generator.
Test',
+'big text
Testing',
+'smaller text and crossed out text.
· Test list
· Test
o ',
+'Test',
+'indented
· Tes6t
1. tes t test test
a. tes t indented
One
Two
One
Two
' + }, + { + source: 'Microsoft Word - full document paste', + paste: WORD_PASTE_EXAMPLE, + output: 'Mycomplicated word document renders like this in the card generator.
Testbig text
Testingsmaller text and crossed out text.
· Test list
· Test
o Testindented
· Tes6t
1. tes t test test
a. tes t indented
' } ], inlineTests = [ diff --git a/src/js/extensions/paste.js b/src/js/extensions/paste.js index c658a6d26..4c768b1c9 100644 --- a/src/js/extensions/paste.js +++ b/src/js/extensions/paste.js @@ -57,7 +57,10 @@ [new RegExp(/\n+- [new RegExp(/<\/?o:[a-z]*>/gi), ''] + [new RegExp(/<\/?o:[a-z]*>/gi), ''], + + // Microsoft Word adds some special elements around list items + [new RegExp(/(((?!/gi), '$1'] ]; } /*jslint regexp: false*/