Skip to content

Commit

Permalink
fix: retrieve raw content from TinyMCE editor (openedx#31212) (opened…
Browse files Browse the repository at this point in the history
…x#31500)

During the upgrade to TinyMCE v5, we changed the content format to `text`.
However, it ignores changes in HTML tags. This reverts the format to `raw`.
  • Loading branch information
asadali145 authored and Tutor committed Feb 10, 2023
1 parent ddd8da4 commit 2bf46cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion xmodule/js/spec/html/edit_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('HTMLEditingDescriptor', function() {
});
it('Returns data from Raw Editor if text has not changed', function(done) {
const visualEditorStub =
{getContent() { return 'original visual text' }};
{getContent() { return '<p>original visual text</p>' }};
spyOn(this.descriptor, 'getVisualEditor').and.callFake(() => visualEditorStub);

var self = this;
Expand Down
4 changes: 2 additions & 2 deletions xmodule/js/src/html/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@
haven't dirtied the Editor. Store the raw content so we can compare it later.
*/
this.starting_content = visualEditor.getContent({
format: "text",
format: "raw",
no_events: 1
});
return visualEditor.focus();
Expand All @@ -1410,7 +1410,7 @@
if (this.editor_choice === 'visual') {
visualEditor = this.getVisualEditor();
raw_content = visualEditor.getContent({
format: "text",
format: "raw",
no_events: 1
});
if (this.starting_content !== raw_content) {
Expand Down

0 comments on commit 2bf46cc

Please sign in to comment.