Changes for page EditSheet

Last modified by superadmin on 2025/10/09 09:51

From version 11.1
edited by Thomas Coelho (local)
on 2025/02/13 15:10
Change comment: Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/17.0.0]
To version 14.1
edited by superadmin
on 2025/10/09 09:51
Change comment: Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/17.8.0]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.coelho
1 +XWiki.superadmin
XWiki.JavaScriptExtension[2]
Code
... ... @@ -10,7 +10,9 @@
10 10   container.find('.ckeditor-textarea').each(function() {
11 11   // Wrap in try/catch so that a failure to load one editor doesn't affect the other editors.
12 12   try {
13 - createEditor(ckeditor, this);
13 + createEditor(ckeditor, this).then(() => {
14 + this.classList.remove('loading');
15 + });
14 14   } catch(e) {
15 15   console.log(e);
16 16   }
XWiki.StyleSheetExtension[0]
Code
... ... @@ -12,6 +12,13 @@
12 12   resize: none;
13 13  }
14 14  
15 +/* Hide the form action bar while the editor is loading in order to avoid UI flickering (because the editor may enhance
16 + or replace the form action bar). */
17 +main > div:has(.ckeditor-textarea.loading) ~ .bottom-editor,
18 +#xwikicontent.loading ~ form#inplace-editing {
19 + visibility: hidden;
20 +}
21 +
15 15  /* Show the modal above the CKEditor dialogs */
16 16  body > .modal-backdrop {
17 17   z-index: 10040;
... ... @@ -172,6 +172,25 @@
172 172  }
173 173  
174 174  /**
182 + * Handle the layout and display of the warning message for headerless tables.
183 + * This message is added by the xwiki-table plugin.
184 + * Some of the default styles are just overridden by the CKEditor reset.
185 + */
186 +.cke_dialog_container span.box.warningmessage {
187 + .alert-warning;
188 + /* Default warning boxes are not meant to be used in a strict layout like the one of this table dialog.
189 + * We need an extra customization to avoid breaking this layout. */
190 + white-space: break-spaces;
191 + /* By default, the warning is not shown. */
192 + display: none;
193 +}
194 +
195 +/* When the value of the previous field is the one we want to avoid, we show the warning. */
196 +.cke_dialog_container tr:has(select [value=""]:checked) + tr span.box.warningmessage {
197 + display: unset;
198 +}
199 +
200 +/**
175 175   * Link Options Toggle
176 176   */
177 177  
... ... @@ -363,29 +363,89 @@
363 363  }
364 364  
365 365  .cke_contents > textarea.cke_source.cke_editable_inline {
366 - border: 1px solid transparent;
367 - border-radius: 0;
368 368   box-shadow: none;
369 - margin-top: -1px;
370 - margin-left: -1px;
371 -
372 - .form-control-focus();
373 373  }
374 374  
375 -.cke_contents.fake {
376 - /* We need this to have the box shadow visible when the source area is focused. */
377 - overflow: visible;
378 -}
379 -
380 380  #xwikicontent + .cke_contents > textarea.cke_source.cke_editable_inline {
381 381   /* Don't take the padding and the margin into account when computing the 100% width. */
382 382   box-sizing: content-box;
383 383   /* Make sure the Source area has the same width as the WYSIWYG area. */
384 - margin-left: -@grid-gutter-width / 2 - 1px;
385 - margin-right: -@grid-gutter-width / 2 - 1px;
399 + margin-left: -@grid-gutter-width / 2;
400 + margin-right: -@grid-gutter-width / 2;
386 386  }
387 387  
388 388  /**
404 + * Custom styles to match XWiki's Look & Feel
405 + */
406 +.cke_chrome,
407 +.cke_chrome > .cke_inner {
408 + border-radius: @border-radius-base;
409 +}
410 +
411 +.cke_chrome > .cke_inner > .cke_top {
412 + border-top-right-radius: @border-radius-base;
413 + border-top-left-radius: @border-radius-base;
414 +}
415 +
416 +.cke_chrome > .cke_inner > .cke_bottom {
417 + border-bottom-right-radius: @border-radius-base;
418 + border-bottom-left-radius: @border-radius-base;
419 +}
420 +
421 +/* The standalone WYSIWYG edit mode shows the form action toolbar right below the CKEditor instance used to edit the
422 + document content. We make the bottom border rounded on the form action toolbar instead. */
423 +#xwikieditcontent > .cke_chrome,
424 +#xwikieditcontent > .cke_chrome > .cke_inner,
425 +#xwikieditcontent > .cke_chrome > .cke_inner > .cke_bottom {
426 + border-bottom-right-radius: 0;
427 + border-bottom-left-radius: 0;
428 +}
429 +
430 +a.cke_button,
431 +a.cke_combo_button {
432 + border-radius: @border-radius-small;
433 +}
434 +
435 +.cke_panel,
436 +.cke_dialog_body,
437 +.cke_dialog a.cke_dialog_ui_button,
438 +.cke_dialog input.cke_dialog_ui_input_text,
439 +.cke_dialog select.cke_dialog_ui_input_select,
440 +.cke_dialog fieldset.cke_dialog_ui_fieldset,
441 +.cke_notification {
442 + border-radius: @border-radius-base;
443 +}
444 +
445 +.cke_panel.cke_menu_panel,
446 +.cke_panel.cke_combopanel {
447 + margin: 2px 0;
448 +}
449 +
450 +.cke_dialog_title,
451 +.cke_dialog a.cke_dialog_tab {
452 + border-top-right-radius: @border-radius-base;
453 + border-top-left-radius: @border-radius-base;
454 +}
455 +
456 +.cke_dialog_contents,
457 +.cke_dialog_footer {
458 + border-bottom-right-radius: @border-radius-base;
459 + border-bottom-left-radius: @border-radius-base;
460 +}
461 +
462 +/**
463 + * Custom styles for the in-line editor
464 + */
465 +.viewbody > .cke_float {
466 + /* Shift the floating toolbar in order to match the content padding. */
467 + margin-right: floor((@grid-gutter-width / 2));
468 + margin-left: ceil((@grid-gutter-width / 2));
469 +}
470 +.cke_float .cke_top {
471 + border-radius: @border-radius-base;
472 +}
473 +
474 +/**
389 389   * Full-screen styles for the in-line editor
390 390   */
391 391  body[data-maximized="true"] {
... ... @@ -421,12 +421,6 @@
421 421   margin: 0 !important;
422 422   overflow-y: auto !important;
423 423   z-index: 9995;
424 -
425 - &:focus {
426 - /* Remove the focus border. */
427 - border-color: transparent !important;
428 - box-shadow: none !important;
429 - }
430 430   }
431 431   .cke_maximize_backdrop {
432 432   top: 0;
... ... @@ -463,3 +463,20 @@
463 463   border-color: @table-border-color;
464 464   border-style: solid;
465 465  }
546 +
547 +/* CKEditor contains a CSS reset. It works with its own style sheets and does not use the ones in XWiki.
548 +However, we want `.sr-only` from XWiki to still be usable in our CKEditor environment.
549 +We need to redefine the XWiki styles of this class to have better priority than the CKEditor CSS reset.
550 +Without this, the elements with this class are still shown which would be different from the behaviour
551 +of `.sr-only` anywhere else in XWiki (as described in our doc).
552 +This redefinition allows for a more consistent behaviour of the `.sr-only` class. */
553 +.cke_reset_all .sr-only {
554 + position: absolute;
555 + width: 1px;
556 + height: 1px;
557 + padding: 0;
558 + margin: -1px;
559 + overflow: hidden;
560 + clip: rect(0, 0, 0, 0);
561 + border: 0;
562 +}