Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#9718 closed Bug (invalid)

Paste from word plugin fails to load default clean-up file when not running under root web directory

Reported by: Johannes Fischer Owned by:
Priority: Normal Milestone:
Component: Plugin : Paste from Word Version: 4.0.1
Keywords: Cc:

Description

All if our ckeditor files are deployed in a sub directory of our web application ('/resources/richtexteditor') while the ckeditor.js file is located under the root directory.

Because of this deployment type, we set the CKEDITOR.basePath property to the path to the editor's resource folder.

When pasting text from word into the editor instance, we see a 404 exception for the /pastefromword/filter/default.js file because the base path was not applied to the resource URL (see following screenshot).

When debugging the code, this.path (in pastfromword/plugin.js, line 15) contains an absolute URL (starting with http://) which will cause that the default CKEDITOR.getUrl() method does not prefix the 'resource' provided with the previously set base path.

It looks to me that the this.path should only contain a relative URL so that the CKEDITOR.getUrl() function can prefix it with the base path if needed.

Thanks, Johannes

Attachments (2)

pastefromword_filter_issue.png (70.9 KB) - added by Johannes Fischer 6 years ago.
Screenshot taken after the attempt to paste text from word. The developer toolbar shows the resulting errors when trying to load the filter rules.
pastefromword_folder_structure.png (13.8 KB) - added by Johannes Fischer 6 years ago.
Folder structure as seen in VS Solution Explorer.

Download all attachments as: .zip

Change History (12)

Changed 6 years ago by Johannes Fischer

Screenshot taken after the attempt to paste text from word. The developer toolbar shows the resulting errors when trying to load the filter rules.

comment:1 Changed 6 years ago by Johannes Fischer

We currently work around this problem by setting the absolute path to the default filter in CKEDITOR.config.pasteFromWordCleanupFile, but it would be nice if we could remove this work around again. Please let me know if you need more information. Thanks - Johannes

comment:2 Changed 6 years ago by Jakub Ś

Keywords: pastefromword removed
Resolution: duplicate
Status: newclosed

DUP of #8893

comment:3 Changed 6 years ago by Johannes Fischer

Hi j.swiderski,

I looked at the ticket #8893 and while those two tickets are related, it does not talk about the actual default value for the filter and the fact that this.path (as stated in my description) comes with a absolute path to the plugins folder which ignores the different base path set on the CKEDITOR instance prior to instantiating the editor.

The patch provided under #8893 does not seem to address this and I would kindly ask to take another look at this problem here and potentially re-open the ticket.

Thanks, Johannes

comment:4 Changed 6 years ago by Jakub Ś

You are right this does not look like a duplicate.

Could I ask you to provide screenshot with your folders structure for CKEditor? I would like to recreate this problem.
Could you also provide page where base path is set (CKE is probably installed there as well)? I would like to see how you are setting this value.

NOTE: Default plugin value is - this.path + 'filter/default.js' where this path is path to plugin folder calculated by CKEditor.

comment:5 Changed 6 years ago by Johannes Fischer

Thank you for reviewing this issue again. I will attach a screen shot of my Visual Studio Solution Explorer shortly that will show you the folder structure of the plugins. "Webroot", in this case, represent the actual webroot of our deployed application and should therefore not be in the path. The ckeditor.js file is located in a different project directly under the webroot.

Based on the second screenshot, the proper this.path value should be "resources/richtexteditor/plugins/pastefromword/", but when I debug the value in chrome, this.path has a value of "http://localhost:6400/plugins/pastefromword/", which leads to the 404 error in the first screenshot I posted.

Below is the line of code that we use to set the basePath property. I can assure that it is executed prior to instantiating the first instance of CKEditor:

CKEDITOR.basePath = document.location.protocol + "" + document.location.host + _args.AppBase + "resources/richtexteditor/";

NOTE: We used CKEditor 3.6.5 in the exact same way and that was working fine. Only after switching to the 4.0 master, we started to encounter this issue.

Hope this helps.

Changed 6 years ago by Johannes Fischer

Folder structure as seen in VS Solution Explorer.

comment:6 Changed 6 years ago by Johannes Fischer

Sorry, copy and pasting removed some characters from the line of code... it's:

CKEDITOR.basePath = document.location.protocol + "//" + document.location.host + _args.AppBase + "resources/richtexteditor/";

Last edited 6 years ago by Johannes Fischer (previous) (diff)

comment:7 Changed 6 years ago by Jakub Ś

Resolution: duplicate
Status: closedreopened
Version: 4.04.0.1 (GitHub - master)

comment:8 Changed 6 years ago by Jakub Ś

Resolution: invalid
Status: reopenedclosed

I have tried this folder structure in CKEditor 3.6.5 and CKEditor 4.0 and both worked as expected.

ckeditor.js
 resources
  richtexteditor
   samples
   plugins
   etc.

One of samples was having this code:

<script>
 window.CKEDITOR_BASEPATH = 'http://192.169.16.116:2224/test/resources/richtexteditor/'; 
</script>

If this didn’t work for pasefromword filter it wouldn’t work for styles plugin as well. This plugin uses the same path assignment as pastefromword – path to plugin + folder/filename.js

I assume that either you have done some changes in this plugin or/and Visual Studio is breaking something as well (I remember it was adding ~ to paths).

I’m closing this issue once more as I don’t see any problem here.

comment:9 Changed 6 years ago by Johannes Fischer

Ok, I will take a closer look. Thanks for looking into this. Johannes

comment:10 Changed 5 years ago by Frederico Caldeira Knabben

Component: Core : PastingPlugin : Paste from Word
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy