Skip to content

Commit

Permalink
Comment
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-csg committed Feb 21, 2024
1 parent afa8704 commit 337a932
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion amd/build/card.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion amd/build/card.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion amd/build/column.min.js.map

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion amd/src/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,12 @@ export default class extends KanbanComponent {
}
// Update title (also in modals).
if (element.title !== undefined) {
this.getElement(selectors.INPLACEEDITABLE).setAttribute('data-value', element.title);
// For Moodle inplace editing title is once needed plain and once with html entities encoded.
// This avoids double encoding of html entities as the value of "data-value" is exactly what is shown
// in the input field when clicking on the inplace editable.
let titlehelper = document.createElement('textarea');
titlehelper.innerHTML = element.title;
this.getElement(selectors.INPLACEEDITABLE).setAttribute('data-value', titlehelper.value);
this.getElement(selectors.INPLACEEDITABLE).querySelector('a').innerHTML = element.title;
this.getElement(selectors.DESCRIPTIONMODALTITLE).innerHTML = element.title;
this.getElement(selectors.DISCUSSIONMODALTITLE).innerHTML = element.title;
Expand Down
3 changes: 3 additions & 0 deletions amd/src/column.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ export default class extends KanbanComponent {
}
// Update data for inplace editing if title was updated (this is important if title was modified by another user).
if (element.title !== undefined) {
// For Moodle inplace editing title is once needed plain and once with html entities encoded.
// This avoids double encoding of html entities as the value of "data-value" is exactly what is shown
// in the input field when clicking on the inplace editable.
let titlehelper = document.createElement('textarea');
titlehelper.innerHTML = element.title;
this.getElement(selectors.INPLACEEDITABLE).setAttribute('data-value', titlehelper.value);
Expand Down

0 comments on commit 337a932

Please sign in to comment.