From 63d1b2bc9cd13c069e5d51d6cbb179f70d03dc1a Mon Sep 17 00:00:00 2001 From: DawoudSheraz Date: Fri, 17 Jan 2020 14:34:59 +0500 Subject: [PATCH] modify URL generation in tinymce editor --- common/lib/xmodule/xmodule/js/spec/html/edit_spec.js | 6 +++++- common/lib/xmodule/xmodule/js/src/html/edit.js | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/spec/html/edit_spec.js b/common/lib/xmodule/xmodule/js/spec/html/edit_spec.js index cfa3f1225a..1da3f9ea1e 100644 --- a/common/lib/xmodule/xmodule/js/spec/html/edit_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/html/edit_spec.js @@ -1,5 +1,5 @@ describe('HTMLEditingDescriptor', function() { - beforeEach(() => window.baseUrl = "/static/deadbeef"); + beforeEach(() => window.baseUrl = "/static/deadbeef/"); afterEach(() => delete window.baseUrl); describe('Visual HTML Editor', function() { beforeEach(function() { @@ -48,6 +48,10 @@ describe('HTMLEditingDescriptor', function() { const savedContent = this.descriptor.getVisualEditor().getContent() expect(savedContent).toEqual(expectedData); }); + it('Editor base URL does not contain double slash', function(){ + const editor = this.descriptor.getVisualEditor(); + expect(editor.editorManager.baseURL).not.toContain('//'); + }); }); describe('Raw HTML Editor', function() { beforeEach(function() { diff --git a/common/lib/xmodule/xmodule/js/src/html/edit.js b/common/lib/xmodule/xmodule/js/src/html/edit.js index cc2c798ccc..a86cf21cf8 100644 --- a/common/lib/xmodule/xmodule/js/src/html/edit.js +++ b/common/lib/xmodule/xmodule/js/src/html/edit.js @@ -88,7 +88,7 @@ This is a workaround for the fact that tinyMCE's baseURL property is not getting correctly set on AWS instances (like sandbox). It is not necessary to explicitly set baseURL when running locally. */ - tinyMCE.baseURL = baseUrl + "/js/vendor/tinymce/js/tinymce"; + tinyMCE.baseURL = baseUrl + "js/vendor/tinymce/js/tinymce"; /* This is necessary for the LMS bulk e-mail acceptance test. In that particular scenario, @@ -96,7 +96,7 @@ */ tinyMCE.suffix = ".min"; this.tiny_mce_textarea = $(".tiny-mce", this.element).tinymce({ - script_url: baseUrl + "/js/vendor/tinymce/js/tinymce/tinymce.full.min.js", + script_url: baseUrl + "js/vendor/tinymce/js/tinymce/tinymce.full.min.js", font_formats: _getFonts(), theme: "modern", skin: 'studio-tmce4', @@ -126,7 +126,7 @@ visual: false, plugins: "textcolor, link, image, codemirror", codemirror: { - path: baseUrl + "/js/vendor" + path: baseUrl + "js/vendor" }, image_advtab: true, @@ -1204,7 +1204,7 @@ Translators: this is a toolbar button tooltip from the raw HTML editor displayed in the browser when a user needs to edit HTML */ title: gettext('Code block'), - image: baseUrl + "/images/ico-tinymce-code.png", + image: baseUrl + "images/ico-tinymce-code.png", onclick: function() { return ed.formatter.toggle('code'); }