FIX: Fast edit doesn’t work on content with certain characters (#20410)

Small js fix for fast edit to allow posts to save changes when the post contains apostrophes and quotation marks. Replaces unicode characters in text prior to saving the edit.

Includes system tests for fast edit and introduces a new system spec component for fast edit usage.
This commit is contained in:
David Battersby
2023-02-23 11:30:16 +08:00
committed by GitHub
parent 576745637e
commit 0a619d8c88
5 changed files with 114 additions and 3 deletions

View File

@ -39,9 +39,9 @@ function getQuoteTitle(element) {
}
function fixQuotes(str) {
// u+201c
// u+201d ”
return str.replace(/[\u201C\u201D]/g, '"');
// u+201c, u+201d = “ ”
// u+2018, u+2019 = ‘ ’
return str.replace(/[\u201C\u201D]/g, '"').replace(/[\u2018\u2019]/g, "'");
}
export default Component.extend(KeyEnterEscape, {