Problem/Motivation
When editing a Text Format, I can't change the text editor option from "CKEditor" to "None".
Steps to reproduce:
Start with a base install of D8 dev or D8 beta 2
Log in as administrator
Go to Admin -> Configuration -> Content Authoring -> Text Formats and Editors
Edit a text format that has CKEditor selected. "Full HTML" is a good example.
Change text editor to "None"
Note that some of the CKEditor options still appear on the page.
Save the form.
On the Text Format list, the format you just edited will still have "CKEditor" shown as its editor.
I couldn't find any way to change to "None" without creating a new text format.
Note: Changing from "None" to "CKEditor" does work as expected. It's just impossible to change back to "None."
System specs: PHP 5.5.14, Apache 2.2.26, MySQL 5.6.17 running on OSX 10.9.5. Observed in both Chrome 38 and Firefox 33.
Proposed resolution
When choosing "None" for text editor, the CKEditor config options should disappear.
When saving the form, it should set the text editor to "None" if that's what I chose.
Comment | File | Size | Author |
---|---|---|---|
#13 | 2372893-13.patch | 2.91 KB | idebr |
#13 | 2372893-13.fail_.patch | 1.71 KB | idebr |
#13 | interdiff-13-9.txt | 1.86 KB | idebr |
#1 | 2372893-1.patch | 1.29 KB | Wim Leers |
Comments
Comment #1
Wim LeersReproduced. You're right. This is a regression.
You can see this even more clearly at
admin/config/content/formats/manage/restricted_html
. In the "Text editor"<select>
, choose "CKEditor". The settings are loaded via AJAX. Then select "None" again. The settings remain.Something must've changed in the AJAX or form system, because this was definitely working before.
Comment #2
Wim LeersAn inability to change the text editor is probably at least major.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedThe issue was introduced in #2316533: Add getValue/setValue/hasValue and isValueEmpty to FormState where an isset() was removed while doing some allround refactoring. Since getValue is used now, a check against null is better. That is exactly what the patch does.
After applying the patch, the issue is resolved. Marking this rtbc.
Comment #5
BerdirIs it possible to write a test for this? Ajax stuff is always a bit tricky, especially if there is no js fallback button.
Comment #6
Wim LeersThere is a no-js fallback button.
Comment #7
BerdirHa, well, then there is no excuse for not having tests? ;)
Comment #8
Wim LeersIndeed.
Comment #9
idebr CreditAttribution: idebr commentedI was able to reproduce the issue reported by kdechant and I can confirm the patch by Wim Leers solves it. To make sure it doesn't break again in the future I added a test.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedThe test as proposed in #9 seems to test the issue properly, however it is run on every invocation of selectUnicornEditor() and thus multiple times. I'd say that's unneeded and it also doesn't do any good for the performance of these tests. Wouldn't it be better to move it into a separate test method?
Comment #12
idebr CreditAttribution: idebr commentedEach test method triggers a rebuild of the test environment, so moving it to a separate method would not likely be beneficial for performance of the test. How about moving it to an existing test (testAddEditorToExistingFormat / testAddEditorToNewFormat)?
Comment #13
idebr CreditAttribution: idebr commentedI moved the assertion to EditorAdminTest::testAddEditorToExistingFormat() so it only gets called once.
Comment #18
Anonymous (not verified) CreditAttribution: Anonymous commentedYou are right on the performance, it's not really relevant in this issue. And I think it's a good idea to move it to a specific method like you did in #13.
The patch in itself is still fine. I'm not sure why there are test failures, so I queued the patches for retesting.
Comment #20
idebr CreditAttribution: idebr commentedHEAD was broken last night: http://cgit.drupalcode.org/drupal/commit/?id=a6d172fe212f2f334e10530c7b3...
The test passes now as expected.
Comment #21
Anonymous (not verified) CreditAttribution: Anonymous commentedYes, they do. I think this is good to go in now.
Comment #22
amateescu CreditAttribution: amateescu commentedWe don't usually put any vague information about what caused the bug in the issue title :)
Comment #23
idebr CreditAttribution: idebr commentedTechnically you can still change editors, its just the configuration panel does not update correctly.
Comment #24
Wim LeersRTBC+1, thanks for writing a test for this!
Just one typo, that can be fixed upon commit:
s/are/is/
Comment #25
Wim LeersComment #26
alexpottThis issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed c0b346b and pushed to 8.0.x. Thanks!
Fixed the nit in #24 on commit.