Comments (4)
I'm having the exact same issue. I tried to debug it today but couldn't find any reasonable solution. Looks like there is something wrong on how ckanext-pages is serving/accessing webassets.
I also don't understand why is appending /pages_edit/
when debug=False
.
@smotornyuk any idea what is going on here?
from ckanext-pages.
Sure. Don't blame webassets, ckanext-pages just didn't configure CKEditor properly.
CKEditor is an enterprise solution. It comes with themes, plugins, and modules. How can CKEditor load modules in runtime? Probably, using some assumptions. For example, CKEditor may assume that plugin xxx
will be available as public xxx.js
file. Does it mean, that CKEditor should append the following tag to the page, whenever it enables the xxx
plugin in runtime?:
<script src="/xxx.js">Cannot load xxx plugin for CKEditor</script>
Answer: almost. Not every system serves public files from the site root. From my experience, some /public/
, /static/
, /assets/
prefix is usually used. That's why CKEditor is trying to be smart(and it usually works). It checks the origin of ckeditor.js
. It's almost safe to assume, that ckeditor.js
is loaded from a public source, thus all its plugins can be loaded from the same path.
For example. if ckeditor.js
is loaded from /x/y/z/ckeditor.js
, it will try to load xxx.js
from the same place - /x/y/z/ceditor.js
.
And it works in debug mode because every file is loaded separately. ckeditor.js
loaded from the public folder, available at the site root(/ckeditor.js
), so do all the plugins.
What happens in production mode? All files are compiled into a single huge main.js
. There are no more cketior.js
. CKEditor cannot identify a public folder for the current portal. It searches for the source of the script that initialized CKEditor instead. Is it /webassets/ckanext-pages/main.js
? Yes. Probably, it should load xxx
plugins from /webassets/ckanext-pages/xxx.js
then? No. All the plugins, translations, etc are not included in webassets and are not served by them. CKEditor has to load them from the public path(in your case unless you are using custom site root) it's /
.
How we can tell CKEditor to use a custom public path? By setting global variable CKEDITOR_BASEPATH
. For example, in this case, something like this will solve the problem:
<script>window.CKEDITOR_BASEPATH = "/"</script>
You may want to use ckan.SITE_ROOT
instead of hardcoding /
, but in this case, you have to make sure, that CKAN's JS is loaded before your script.
from ckanext-pages.
Thanks for your answer @smotornyuk .
I'm just trying to understand what changed since this feature stop working when updating from 2.9
to 2.10
. That's why I'm pointing to ckanext-pages
registering or loading assets differently than before.
CKAN 2.9 with ckanext-pages v0.3.7:
CKAN 2.10 with ckanext-pages v0.5.1:
That's why I'm trying to get more insights on how webassets are handled. I'll keep looking into this!
from ckanext-pages.
I suspect, somebody has overriden this hack
from ckanext-pages.
Related Issues (20)
- cannot find macros/form.html
- CKEditor security vulnerabilities HOT 1
- Docker install pages failed HOT 1
- InvalidRequestError: Entity '<class 'ckanext.pages.db._Page'>' has no property 'group_id' HOT 3
- Support for ckan 2.9.2 HOT 4
- /blog available in menu HOT 1
- Page don't show on navbar
- How to create a new page for a new template?
- [Docker] `pages initdb` command defaults to `DEFAULT_SOLR_URL` HOT 2
- Auto page creation
- Language code for pages in header nav.main missing
- Error: CKEditor not initialized
- pages break entire site when containing an <img> tag without src attribute
- Is it possible to search in pages?
- create page option does not appear on the website's homepage
- Release new version
- Permission denied IO Error HOT 7
- Language/Localisation of Article Content
- Unable to configure pages with a custom root_path
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ckanext-pages.