fix: project description editor never loads, blocking project save (#11302)#11329
Open
BenJule wants to merge 1 commit into
Open
fix: project description editor never loads, blocking project save (#11302)#11329BenJule wants to merge 1 commit into
BenJule wants to merge 1 commit into
Conversation
…11302) The CKEditor instances for the project/profile description were only created in the translation script's onload handler. editor.html is opened without a ?lang= query, so the locale falls back to navigator.language (often en-US in the webview), which resolves to a translation file that doesn't exist (en-us.umd.js). The failed load fires onerror, not onload, so the editors were never created: there was no description field and 'The project description is empty' blocked saving for everyone. Initialise the editors on both onload and onerror (guarded so they're only created once), so a missing/failed translation file no longer leaves the page without a usable description editor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #11302. In the Project tab, the Description field is required but there's no editor to type into, and saving fails with "The project description is empty" with no way to fix it (see the screenshots in the issue).
Root cause
The description editors (CKEditor) are created in
resources/web/model_new/js/ckeditor_config.js, but only inside theonloadhandler of a dynamically-loaded translation file:editor.htmlis navigated to without a?lang=query, soeditorLanguagefalls back tonavigator.language, which the webview commonly reports asen-US. That resolves totranslations/en-us.umd.js, which doesn't exist (onlyen,en-au,en-gbship). A missing file firesonerror, notonload, so the editors are never created: no description field appears, and the required-field validation then blocks saving for everyone in this situation, regardless of UI language.Fix
Initialise the editors on both
onloadandonerror(guarded so they're created only once). If the translation file fails to load, the editors still come up (in English) instead of leaving the page with no description editor at all.Test plan
ckeditor_config.js, syntax-checked withnode --check.