diff --git a/packages/ckeditor5/src/plugin.js b/packages/ckeditor5/src/plugin.js index de433fe92..c6306fa41 100644 --- a/packages/ckeditor5/src/plugin.js +++ b/packages/ckeditor5/src/plugin.js @@ -258,9 +258,9 @@ export default class MathType extends Plugin { formula = Util.htmlSanitize(`${formula}`); // Replaces the < & > characters to its HTMLEntity to avoid render issues. - formula = formula.replace('"<"', '"<"') - .replace('">"', '">"') - .replace('><<', '><<'); + formula = formula.replaceAll('"<"', '"<"') + .replaceAll('">"', '">"') + .replaceAll('><<', '><<'); /* Model node that contains what's going to actually be inserted. This can be either: @@ -341,7 +341,7 @@ export default class MathType extends Plugin { function createViewImage(modelItem, { writer: viewWriter }) { const htmlDataProcessor = new HtmlDataProcessor(viewWriter.document); - const mathString = modelItem.getAttribute('formula').replace('ref="<"', 'ref="<"'); + const mathString = modelItem.getAttribute('formula').replaceAll('ref="<"', 'ref="<"'); const imgHtml = Parser.initParse(mathString, editor.config.get('language')); const imgElement = htmlDataProcessor.toView(imgHtml).getChild(0); @@ -418,9 +418,9 @@ export default class MathType extends Plugin { // CKEditor 5 replaces all the time the < and > for < and >, which our render can't understand. // We replace the values inserted for CKEditro5 to be able to render the formulas with the mentioned characters. - output = output.replace('"<"', '"<"') - .replace('">"', '">"') - .replace('><<', '><<'); + output = output.replaceAll('"<"', '"<"') + .replaceAll('">"', '">"') + .replaceAll('><<', '><<'); // Ckeditor retrieves editor data and removes the image information on the formulas // We transform all the retrieved data to images and then we Parse the data.