Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ACE module files failing to load #82

Merged
merged 1 commit into from
Feb 7, 2018

Conversation

danxuliu
Copy link
Member

@danxuliu danxuliu commented Feb 5, 2018

Fixes (in master) #39, which is a regression introduced in #32

When an ACE module is loaded, if the module is not already defined, the file that should contain the definition of the module is loaded. If no explicit URL was set for the module file, the URL of the file to load is based on the module name and the path configured for the component type (worker, mode or theme); if no explicit path was set or the module has no special type then the basePath configuration option is used instead.

When the ACE editor is initialized, by default the base path is set to the directory of the ace.js file. When the JavaScript files were merged ace.js was no longer added to the page as a single script file, so the base path was no longer set, and thus the module URL was just based on its name, without a path. Due to this the URL for the ace/ext/searchbox module ended being just ext-searchbox.js, and as such it was relative to the URL of the current page (and thus, wrong). Note, however, that themes and syntax highlighting worked fine because the needed files were explicitly added to the page.

In order to fix this the right base path had to be set in the editor configuration.

Besides master, this fix is needed too in the stable12 and stable13 branches. It brings back the search box, and also the syntax check in stable12; in stable13 and master the syntax check is not working either since the update to ACE 1.2.8.; something for another pull request ;-)

@nextcloud/javascript

When the ACE editor is initialized, by default the base path used to
load module files is set to the directory of the "ace.js" file. Since
the JavaScript files were merged "ace.js" is no longer added to the page
as a single script file, so the base path was no longer set, and thus
the module files failed to load. Now the right base path is explicitly
set in the editor configuration.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants