Updated: Comment #0
Problem/Motivation
We do use Drupal's dialog in Drupal-specific CKEditor plugins, like the image and link plugins.
We don't do that for other functionality, like
- the table plugin, which shows a CKEditor dialog:
- the "Source" button, which shows a CKEditor dialog when using CKEditor in in-place editing:
(WordPress does this too for TinyMCE's dialogs, see #1879120-39: Use Drupal-specific image and link plugins — use core dialogs rather than CKEditor dialogs, containing alterable Drupal forms.)
Proposed resolution
Make CKEditor dialog styling match Drupal's dialog styling.
Remaining tasks
None.
User interface changes
CKEditor's dialog styling overridden in Seven.
- Before
- After
API changes
None.
Related Issues
The first 20 or so comments in #1879120: Use Drupal-specific image and link plugins — use core dialogs rather than CKEditor dialogs, containing alterable Drupal forms.
Comment | File | Size | Author |
---|---|---|---|
#105 | interdiff-2090937-98-105.txt | 1.49 KB | darketaine |
#105 | 2090937-105.patch | 8.62 KB | darketaine |
#98 | interdiff-2090937-89-98.txt | 4.57 KB | darketaine |
#98 | 2090937-98.patch | 8.41 KB | darketaine |
#96 | 2090937-95-close-icon.png | 64.7 KB | star-szr |
Comments
Comment #1
Wim LeersI think perhaps this is not getting the necessary love because it lives in the CKEditor module component. Moving to a more appropriate component, and updating the issue summary.
Comment #2
LewisNyman+1, makes sense. Are we able to modify the mark up for this dialog or do we have to duplicate styling?
Comment #3
Wim LeersModifying the markup is sadly impossible, so the styling will have to be duplicated.
Comment #4
LewisNymanLet's do this.
Comment #5
Wim LeersActually, come to think of it, it might be possible to modify the markup of CKEditor's dialogs… See https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/dialog/plug.... I'll ping the CKEditor guys and ask them to comment here.
Comment #6
Reinmar CreditAttribution: Reinmar commentedThe variable (dialog template) that you mentioned Wim is private, so in order to make it overridable, we would need to move it to some public object. We could do that without any trouble, but... :D
I don't think that playing with the dialog system's underlaying DOM structure will be safe and useful. I've never worked a lot with this part of CKEditor, but I can already think of few reasons:
Of course, I assumed that you want to change all the templates. If you just want to change the main one the situation may be much simpler, but is it still worth it? Therefore, I would change the stylesheets only to make the CKEditor's components resemble Drupal's ones.
Comment #7
Wim LeersThank you very much for the very thorough explanation! :) Looks like my original statement in #3 was correct after all :)
I don't know what this means exactly. I'd think we'd only want to modify the wrapper markup, i.e. the "skeleton" of the dialog, not the "filler" of each dialog.
Comment #8
Reinmar CreditAttribution: Reinmar commentedAh, ok. I thought that you might want to modify the contents, because that's theoretically also doable. Dialog definitions do not (usually) contain any markup, but they use CKEditor's ui components definitions and these components can be overridden. However, that's doable only theoretically because of no view layer separation and thus huge amount of work.
As for the wrapper, if you'll find it hard to achieve some result without changing the skeleton, I don't see a problem in exposing (by the dialog plugin) the skeleton's template.
Comment #9
Wim LeersI take it this means this is not yet the case?
Comment #10
Wim LeersI totally lost track of this because it's in the very generic
component.Comment #11
Bojhan CreditAttribution: Bojhan as a volunteer commentedHow hard is this to change?
@wim could you provde some guidance?
Comment #12
Wim LeersPinged the CKEditor team to point us to the relevant docs.
Comment #13
Reinmar CreditAttribution: Reinmar commentedWe don't have any documentation for styling dialogs. We have only a generic documentation regarding skins and creating a new skin: http://docs.ckeditor.com/#!/guide/skin_sdk_intro. I think it should be enough for you because it's just a CSS. I would propose two approaches:
So it boils down to the question of how much you'll need to change the skin.
Comment #14
Wim LeersThanks, that's clear!
Comment #15
Wim LeersSo #13 made this a CSS-only issue.
The attached patch takes away the non-CSS aspects of it. It just makes CKEditor's dialogs have a 5px solid red border. All that is left to be done, is make it look exactly like Seven's dialogs :)
This is what this patch makes it look like:
Comment #16
Wim LeersTweeted about this: https://twitter.com/wimleers/status/700362144769036288.
Comment #17
sarah_p CreditAttribution: sarah_p commentedI can do it if it's not a critical turnaround, would probably be tomorrow or at the latest over the weekend.
Comment #18
Wim LeersNot at all critical :) Take your time.
It'd just be lovely to have this fixed in Drupal 8.1 for those who for example frequently create HTML tables in CKEditor.
Thanks for stepping up — much appreciated!
Comment #19
darketaine CreditAttribution: darketaine as a volunteer commentedWill try and move this forward. This is a first approach for the table plugin, which shows a CKEditor dialog. The "Source" button, which shows a CKEditor dialog when using CKEditor in in-place editing takes the current theme's styling so in this case it should be added at classy (tagging accordingly).
@Wim Leers: should I move on and do the same for classy?
Comment #20
Wim LeersWow! This is night & day :) This looks awesome!
However, since I'm neither a CSS expert, nor the maintainer of the Seven theme, I think this is going to need sign-off from a strong front-end person. Preferably Cottser would be the committer of this issue/patch. I'll ping a bunch of people to hopefully get reviews of the CSS itself.
I personally found just a few small remarks. But again, a person with stronger CSS skills should review this:
Isn't this something that's only necessary for old IE? (D8 doesn't support old IE)
Why separately target password inputs? I can't imagine ever having to enter a password in a CKEditor dialog. Why not just target all inputs?
Can you please insert the missing newline at the very end of the file?
Comment #21
Wim LeersOh, and I also am not sure what to answer to your Classy question. This is quite an edge case, so I defer to the front-end committer Cottser to decide that.
Comment #22
tic2000 CreditAttribution: tic2000 at Intellix commentedThis and all other urls like that will not work if drupal is in a folder.
Comment #23
tic2000 CreditAttribution: tic2000 at Intellix commentedComment #24
darketaine CreditAttribution: darketaine as a volunteer commented@Wim Leers for the first one, I tried to stay inline with
/core/assets/vendor/jquery.ui/themes/base/theme.css
which still uses this, but yeah probably it's not needed anymore. The second one is extreme to have it in a CKEditor dialog, indeed.@tic2000 I tried to stay inline with
/core/themes/seven/css/components/dialog.css
. I know that this will happen, but maybe it's a matter we should discuss for theming in general as it's used in core themes already.Comment #25
darketaine CreditAttribution: darketaine as a volunteer commentedNew patch after #20 and #22 suggestions :)
Comment #26
Wim Leers#24: What's in
core/assets/vendor/jquery.ui
is vendor code, i.e. upstream: from jQuery UI. We don't modify it, even if there's things in there we don't need.#25: looks great to me! I have no further feedback. This now needs review from a strong front-end/CSS person.
Comment #27
davidhernandezShould these be added not with a library, but using the ckeditor settings in the info file, or is that deprecated?
Bartik still has it...
Regarding Classy, I'm not sure that is the appropriate place for this. Classy, as far as I can tell, does not have any ckeditor specific styling. It only has the more generic dialog css, and extends core's dialog library, not the ckeditor one. If the argument is that all dialogs, regardless of implementation should have this styling, is there a way we can have quickedit load the library?
Comment #28
davidhernandezSorry, didn't mean to ember those images.
Comment #29
Wim Leers#27:
ckeditor_stylesheets
is for stylesheets loaded inside CKEditor, i.e. in its iframe, i.e. to style the HTML that you're editing.The dialog lives in the parent document.
So they're entirely separate things.
Comment #30
davidhernandezAh, ok. Good to know. (I should probably know these things. :P )
Comment #31
darketaine CreditAttribution: darketaine as a volunteer commented#27: Neither Classy nor Seven have CKEditor specific theming. It's about dialog's styling and unfortunately it's not just including the one that's created for Seven in Classy cause it has different theming.
I have to note here that even if we move on with classy too, if someone creates his own theming without classy as a base theme, it's inevitable to have different theming in Quick edit between links, images and ckeditor's modals (as it has different markup)
Comment #32
davidhernandezWhat is the argument against putting this in the ckeditor module?
Comment #33
Wim LeersSimple: the CKEditor module uses native Drupal dialogs for all of its plugins (link & image). Those dialogs are themed by the currently active Drupal theme.
The point of this issue is that CKEditor dialogs match Drupal dialogs. (CKEditor dialogs are used for e.g. the Table plugin, which doesn't make sense to reimplement in Drupal).
Which means that the styling of the CKEditor dialog must be per-theme, because the Drupal dialog is also styled per-theme.
Comment #34
davidhernandezI see. So we need this styling in Classy...
and this in Seven...
Comment #35
darketaine CreditAttribution: darketaine as a volunteer commentedYeap, exactly. The thing is that for the administration, where most people use Seven things are a bit easier, but for the quick edit part things can be trickier as it's depending on the current theme (in simple case, that's Classy).
Comment #36
davidhernandezClassy is fine. That base styling is there, not in Stable or core. Themes not using Classy are on their own. That is the point of sensible defaults versus not. We have to draw a line somewhere.
Comment #37
ironkiat CreditAttribution: ironkiat at Pixel Onion Pte Ltd commentedThanks to @bojhan, following up this in DrupalCon Asia...
Ported the Seven dialog style to bartik theme as the dialog in "quick edit" mode is still using classy.
Updated in Bartik:
Would be great if anyone could do a review on this?
Comment #39
ironkiat CreditAttribution: ironkiat at Pixel Onion Pte Ltd commentedCurrent state in bartik:
Comment #40
darketaine CreditAttribution: darketaine as a volunteer commentedI don't think the issue here is to change other themes' already styled dialogs, but make the ckeditor's core modals look like the drupal's. Maybe it would be better to create another issue if we think this is necessary for quick editor
Comment #41
ironkiat CreditAttribution: ironkiat at Pixel Onion Pte Ltd commentedEarlier patch failed, just updated patch file to pass testing.
Comment #42
Bojhan CreditAttribution: Bojhan as a volunteer commented@darketaine From WimLeers, David and a conversation with Lauri at DrupalconAsia - it is my understanding is that we do wish to change Bartik. We do not wish to adjust the standard look of CKeditor. This because the "raw" output of core, should not contain any opionated styling and just be purely functional.
Comment #43
Bojhan CreditAttribution: Bojhan as a volunteer commentedComment #44
thpoul CreditAttribution: thpoul as a volunteer commented@ironkiat can you please post the interdiff 35-41? It is always helpful to view the differences between patches and review them.
Comment #45
darketaine CreditAttribution: darketaine as a volunteer commented@Bojhan But Bartik is just a theme. If you change it with a custom theme for example the dialogs will stay not-themed again. The issue is to make Ckeditor's dialogs look like Drupal's in Seven and -maybe- Classy which is a base theme. Of course none said core's theme should be changed. Classy is only under discussion cause it has a minimum styling in dialogs which is different from CKEditor's. Bartik and any other -even core- theme is not in this issue's scope :/
That's what I get at least from the description of the issue
Anyway let's see what Wim Leers and Cottser think about it :)
Comment #46
ironkiat CreditAttribution: ironkiat at Pixel Onion Pte Ltd commented@thpoul It's the comment 39 (the current state ie. comment 35) and the 41 (in the updated bartik).
Comment #47
thpoul CreditAttribution: thpoul as a volunteer commented@ironkiat oops, I misspelled 25 to 35, sorry about that. I meant the interdiff of patch
2090937-25.patch
and2090937-42.patch
. Take a look here.Comment #48
ironkiat CreditAttribution: ironkiat at Pixel Onion Pte Ltd commentedThanks @thpoul! I've uploaded the interdiff file here ;)
Comment #49
star-szrI haven't read all the comments since I've been assigned but @Bojhan caught me up. I agree this should not go into Classy (or Stable for that matter) because Classy doesn't provide visual styling.
As for screenshots and manual testing I think we should also be covering when Bartik is used for content entry ("Use the administration theme when editing or creating content" unchecked on /admin/appearance).
Comment #50
darketaine CreditAttribution: darketaine as a volunteer commentedClassy has a minimum styling (the one with the white header) though. That was my argument. Anyway I thought the issue was about styling the ckeditor dialogs like Drupal's only, not even changing the existing Drupal's dialogs look like Seven's (that's what the last patch does) but I guess I got it wrong :)
Comment #51
darketaine CreditAttribution: darketaine as a volunteer commentedBtw #41 patch overrides completely all Bartik's dialogs even when "Use the administration theme when editing or creating content" is not checked to Seven's theming.
The fact that when you check the option Seven's theming doesn't appear instead of Bartik's in Quick Edit mode is another issue I think, not relevant to ckeditor's here. If that option worked like that it would take Seven's theme (which is changed for ckeditor from previous patches) and wouldn't need any more CSS. In that way any changes that would take place in Seven's dialogs for example would have immediate effect on Bartik's (and other theme's) quick edit too, not needing to duplicate CSS.
Comment #52
ironkiat CreditAttribution: ironkiat at Pixel Onion Pte Ltd commentedYes it doesn't check whether is Administration theme being use to create content and it's meant to override it for all Bartik's dialog.
I'm not too sure right now what's the direction of this but I think it make sense that when "Use the Administration theme when creating content" is checked, it uses Seven's styling, or it is limited to just the content creation screens, which I could possibly make it more specific in the CSS.
Comment #53
darketaine CreditAttribution: darketaine as a volunteer commentedI would suggest to wait for Wim Leers who is the reporter and maintainer of the relative component.
Comment #54
davidhernandezClassy provides the minimal styling in the first image I posted in #34. It is in the dialog.css.
Comment #55
Wim Leers#37, #39: No, please don't do that here. That's a completely different issue. @darketaine is right in #40 & #51: this is just about CKEditor's native dialogs.
#42: Yes, we do want to change dialogs in Bartik to have sane styling. But that's a completely different issue. That's Drupal dialogs, not CKEditor dialogs. And doing that would belong in Bartik.
This is @darketaine's first core issue, and it's unfortunate that this issue has now been made extremely confusing. It's amazing that @darketaine hasn't already given up. Thanks for sticking with us, @darketaine!
So, +1 for #53.
For the problem being discussed/fixed in #37/#39/#42/…: it turns out that the current styling of Bartik's dialogs is as intended, according to #2226189: Style the modal in Bartik. However, given everybody seems to think it looks off, I think it's worth opening a follow-up to that issue. In that issue, only the absolute minimum was done. Let's go further.
Comment #56
darketaine CreditAttribution: darketaine as a volunteer commented@WimLeers he he, it's not about giving up or getting confused but pushing things to the right -for the issue- direction.
For the other issue that came up I don't think it's even a Bartik's problem, but a decision about how we want the "Use the Administration theme when creating content" option to work in any theme. If that option checked has effect on Quick Editor too, then the work done here will have instant effect on any theme's ckeditor modals too. So the solution would be to just include the right CSS files in that case, not duplicating the relative CSS in any theme.
Comment #57
star-szrSorry if I contributed to the confusion!
Comment #59
Wim LeersAttempt at improving title to make the actual issue scope more clear.
Comment #60
Wim LeersThe patch in #25 by @darketaine was the one that was within scope. It fully addresses the problem here. Reuploading it, without any changes.
Moving back to 8.1.x-dev, because there is zero risk here.
Compare:
Comment #61
star-szrOverall this looks very good! Before really reviewing the CSS I figured it would make sense to manually test and review the visual appearance.
I spotted a couple things that are a little bit off compared to the native dialogs and should be fixed:
The buttons are 18px high, should be 17px to be consistent with Seven's other buttons:
The typography of the dialog's title is a bit off, in the following screenshot the Drupal native dialog with the title renamed via inspector can be seen on the left. This affects the height as well:
Comment #62
kostyashupenkoComment #63
kostyashupenkoFixed height of button, but not clear for me what should i do with typography? Could you describe the task in more detail and would be great to see another screens as well. Thanks
button before:
button after:
Comment #64
kostyashupenkoComment #65
darketaine CreditAttribution: darketaine as a volunteer commented@kostyashupenko the problem is not on the padding (which -after #63 patch- causes the button to be smaller than Seven's), it's on the rendering of the font in both cases (title and button).
@Cottser I will fix it asap. Thanx for the -first phase of- review :)
Comment #66
darketaine CreditAttribution: darketaine as a volunteer commentedComment #67
darketaine CreditAttribution: darketaine at Pixual commentedAnd here it is. Changed font-size and line-height on both cases.
Comment #68
Wim LeersBack to Cottser.
Comment #69
star-szrGoing to leave it at RTBC and review later but the CSS file should have a @file docblock or at least a docblock at the top. Forgot to mention that yesterday.
Comment #70
darketaine CreditAttribution: darketaine at Pixual commentedOh I'm sorry, I totally forgot that.
Comment #71
catchComment #72
star-szrThanks :)
On my list to review.
Comment #73
star-szrSorry for the long turnaround on this review, I was sick for a while. I think once 1 (and maybe 2) below are addressed this is ready to go into 8.2.x and 8.1.x after beta2 is cut.
.cke_dialog_contents
needs:.cke_reset_all .cke_dialog_title
could use a font-size of 1.3344em (one digit more precise than the 1.334em in #70) so that the computed font-size value matches that of.ui-dialog .ui-dialog-title
.The only other things I can think of are that we could disable the CKEditor moving functionality (where you can move the modal around by dragging the title bar) and just in general handle the positioning and such more like the core dialog (for example scroll the contents of the dialog when the viewport isn't tall enough to show it all), but:
Comment #74
himanshugautam CreditAttribution: himanshugautam commentededited as per #73
Comment #75
himanshugautam CreditAttribution: himanshugautam commentedComment #76
star-szr@himanshugautam interdiff please!
Comment #77
himanshugautam CreditAttribution: himanshugautam commentedComment #78
star-szrThanks @himanshugautam. I also just realized I haven't yet reviewed the code itself thoroughly, so I will still work on that :)
Comment #79
star-szrSince this is a user interface change, unfortunately I think it actually is too late for 8.1.x now that we are well into the beta phase per https://www.drupal.org/core/d8-allowed-changes#minor and the fact that this is an improvement, not a bug fix. Bumping to 8.2.x (where the patch still applies).
Comment #80
sarah_p CreditAttribution: sarah_p commentedSorry for dropping off, I got lost in the land of resetting up my local dev environment post computer wipe, thanks to everyone who pushed it through in a timely manner anyway. :)
Comment #81
star-szrPutting on my list, don't want to forget about this one :)
Comment #82
yoroy CreditAttribution: yoroy at Roy Scholten commentedI love the attention to detail here :)
Comment #83
emma.mariaApologies for being picky but from looking through the code I've noticed some small CSS formatting standard nits...
A few decimal values within the CSS are missing leading zeros.
The file comment needs a blank line after it as per the Drupal CSS file comment standards...
Comment #84
star-szrThanks @emma.maria appreciate it :)
Comment #85
thpoul CreditAttribution: thpoul at Pixual commentedHere you go as per #83
@emma.maria I saw that
core/themes/seven/css/components/form.css
has the same issue with leading zeros. Look attextarea.form-textarea
. Perhaps we should fix that in an other issue?Comment #86
thpoul CreditAttribution: thpoul at Pixual commentedSwitching to NR. Sorry for the noise.
Comment #87
Wim LeersAFAICT RTBC again:
Addresses #73.2/#83.2.
Addresses #83.1
Addresses #73.1.
Comment #88
star-szrSorry for the review-in-many-parts, grabbing minutes when I can here and there.
The biggest thing I noticed with this review is after finally running this through http://csslint.net it pulled out an overly specific selector:
.cke_reset_all a.cke_dialog_close_button
It wanted this to be more like (remove the a element from the selector):
.cke_reset_all .cke_dialog_close_button
In doing so I noticed that CKEditor has LTR and RTL styles for the positioning of the close modal button (X). Nobody has tested RTL so far!
So I think we need to:
a
).To test RTL with the table plugin, I:
And some nits below.
While we're picking nits all of the commas on the lines I've selected need a space after them per https://www.drupal.org/node/1887862#properties.
This hex value should be lowercase per https://www.drupal.org/node/1887862#properties.
Comment #89
thpoul CreditAttribution: thpoul at Pixual commentedHere is the updated patch updated as per #88. Nits were fixed and RTL support has been added.
A note on why.cke_rtl
has been chosen instead of[dir="rtl"]
:If someone skips the installation of the Interface Translation module then CKEditor will not have RTL support (I was quite surprised to see this) and if
[dir="rtl"]
is applied the table dialog will look like this:which is wrong since all the CKEditor dialogs should follow the same theming rules (check the image dialog for example and you will see that it has complete styling.if.cke_rtl
is used instead then we will have the following:.
After reconsidering the logic above, if a user does not activate the Interface Translation module the dialog will look like the following screenshot:
.
Activating the Interface Translation module will result in the following which should be the expected one:
.
I really wish to see this getting moved forward.
PS: Major credit of this should go to @darketaine who was the one pointing me the RTL css rules.
Comment #90
Wim LeersBack to RTBC, let's see if @Cottser has more feedback :)
Comment #91
star-szrThanks, will review again soon :)
Comment #93
emma.mariaThe patch is green and still applies so I'm setting this back to RTBC *tiptoes away*
Comment #94
Wim Leers:D
Comment #95
star-szrThanks everyone. We are getting closer!
#73.1 (bottom corner radii) has not been fixed - there is a specificity issue because I think the CKEditor skin dialog.css is loaded after the ckeditor-dialog.css being added here.
I also tested on a high density screen and found that CKEditor has specific styles for high density displays (screenshot below), we'll need to add to our selector for the close icon and potentially others (refresh, lock, unlock - not sure if those would be used in our case). I think we need to take a good look at the CKEditor moono theme dialog.css to see what else we may need to account for.
Comment #96
star-szrUploading the missing screenshot.
Comment #97
Wim LeersThanks for your extremely detailed reviews, @Cottser!
Comment #98
darketaine CreditAttribution: darketaine at Pixual commentedAfter @Cottser's recommendations in #95 I checked out CKEditor moono theme dialog.css and apart from high density displays there were lots of overrides from high contrast displays selectors. Taking that into account here are some more specific selectors (that's a bit ugly :/ )
Hope this is in the right direction :)
Comment #99
Wim LeersBack to @Cottser!
Comment #100
star-szrThanks, will review as soon as I can!
Comment #102
thpoul CreditAttribution: thpoul at Pixual commentedComment #103
star-szrOther things have been getting in the way but this is at the top of my list to review :)
Comment #104
star-szrThis looks great, I ran through a bunch of tests again and can't find any faults with the code or visuals.
My only other thought at this time is whether we should be doing some grouping (and possible commenting) of the CSS rules per "Blank lines" in https://www.drupal.org/node/1887862#whitespace. It's relatively minor but since we're adding a new ~250 line CSS file I thought I would bring it up.
Comment #105
darketaine CreditAttribution: darketaine at Pixual commentedI 'll give this a try.
I hope comments are in the right direction, I tried to not overdo it.
Comment #106
Wim LeersThanks!
Comment #108
star-szrThanks to everyone who worked on this especially @darketaine for sticking with us :) so happy to be committing this.
Committed 21c135f and pushed to 8.2.x. Thanks! :D
Comment #109
Wim LeersWOOOOOOOOT!
Go go go @darketaine!
Comment #110
webchickGreat work!
This has traditionally been a big enough annoyance that it might be worth explicitly calling out in the release notes.
Comment #111
Bojhan CreditAttribution: Bojhan as a volunteer commentedComment #114
Wim Leers@Bojhan: nice release note suggestion :P
@webchick @Bojhan In all seriousness, I doubt this merits a release note mention. This only affects native CKEditor dialogs, not the link/image dialogs that Drupal's CKEditor integration uses, because those dialogs are Drupal dialogs, not CKEditor dialogs.
Comment #116
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedThanks a lot .. was waiting for this for so long.
We need to find a way to let other admin themes use this library.
I will try adding this in some other admin themes.
And this :
Rewarded work :)
Comment #117
Wim LeersThis introduced a small regression: #2820200: Display resize icon for CKEditor on Seven theme. Please review the proposed patch there (which is super simple: it deletes 3 lines from a CSS file!).
Comment #118
Wim Leers