Skip to content

Commit

Permalink
fix: anchor disappear in notes app for accentuated chars - EXO-68365 -
Browse files Browse the repository at this point in the history
…Meeds-io/meeds#1495 (#573)

Before this change, when create or edit note, add some lines in the
body, select a text click on anchor icon in ckeditor, in Anchor Name
type text containing accents, save note and edit note, anchor containing
accentuated chars disappear. To resolve this problem, remove the
accentuted chars in the anchor name. After this change, anchors are well
displayed with name without accents.

(cherry picked from commit c11f217)
  • Loading branch information
Jihed525 authored and exo-swf committed Dec 27, 2023
1 parent 18137db commit 9b5ddd0
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ CKEDITOR.dialog.add( 'anchor', function( editor ) {
attributes: attributes
} ), 'cke_anchor', 'anchor' );
}


function removeAccents( name ) {
return name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
}

function getSelectedAnchor( selection ) {
var range = selection.getRanges()[ 0 ],
Expand Down Expand Up @@ -69,8 +72,9 @@ CKEDITOR.dialog.add( 'anchor', function( editor ) {
return getSelectedAnchor( editor.getSelection() ) || null;
},
onOk: function() {
var name = CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtName' ) ),
attributes = {
var name = CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtName' ) );
name = removeAccents(name);
var attributes = {
id: name,
name: name,
'data-cke-saved-name': name
Expand Down

0 comments on commit 9b5ddd0

Please sign in to comment.