Merge pull request #3342 from FinnStutzenstein/Umlaute
Fixing strange umlauts when copy text from word
This commit is contained in:
commit
14e38861c7
@ -78,7 +78,7 @@ General:
|
|||||||
- Switched from npm to Yarn [#3188].
|
- Switched from npm to Yarn [#3188].
|
||||||
- Improved performance for PDF generation significantly (by upgrading
|
- Improved performance for PDF generation significantly (by upgrading
|
||||||
to pdfmake 0.1.30) [#3278, #3285].
|
to pdfmake 0.1.30) [#3278, #3285].
|
||||||
- Bugfixes for PDF creation [#3227, #3251, #3279, #3286, #3346, #3347].
|
- Bugfixes for PDF creation [#3227, #3251, #3279, #3286, #3346, #3347, #3342].
|
||||||
- Improvements for plugin integration [#3330].
|
- Improvements for plugin integration [#3330].
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,10 +119,21 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
.factory('HTMLValidizer', function() {
|
.factory('HTMLValidizer', function() {
|
||||||
var HTMLValidizer = {};
|
var HTMLValidizer = {};
|
||||||
|
|
||||||
|
// In some cases copying from word to OpenSlides results in umlauts
|
||||||
|
// that are the base letter and then the entity #776; to make the dots
|
||||||
|
// above the base letter. This breaks the PDF.
|
||||||
|
HTMLValidizer.replaceMalformedUmlauts = function (text) {
|
||||||
|
return text.replace(/([aeiouAEIOUy])[\u0308]/g, function (match, baseChar) {
|
||||||
|
return '&' + baseChar + 'uml;';
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
//checks if str is valid HTML. Returns valid HTML if not,
|
//checks if str is valid HTML. Returns valid HTML if not,
|
||||||
//return emptystring if empty
|
//return emptystring if empty
|
||||||
HTMLValidizer.validize = function(str) {
|
HTMLValidizer.validize = function(str) {
|
||||||
if (str) {
|
if (str) {
|
||||||
|
str = HTMLValidizer.replaceMalformedUmlauts(str);
|
||||||
|
|
||||||
var a = document.createElement('div');
|
var a = document.createElement('div');
|
||||||
a.innerHTML = str;
|
a.innerHTML = str;
|
||||||
angular.forEach(a.childNodes, function (child) {
|
angular.forEach(a.childNodes, function (child) {
|
||||||
|
Loading…
Reference in New Issue
Block a user