Modifications pour le document EditSheet

Modifié par Florent Charton le 2026/03/13 11:04

Depuis la version 5.1
modifié par Florent Charton
sur 2026/01/08 10:59
Commentaire de modification : Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/17.4.8]
À la version 2.1
modifié par Florent Charton
sur 2024/08/08 18:44
Commentaire de modification : Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/15.10.11]

Résumé

Détails

Propriétés de la Page
Contenu
... ... @@ -1,0 +1,38 @@
1 +{{include reference="CKEditor.VelocityMacros"/}}
2 +
3 +{{velocity}}
4 +#if ($doc.fullName == 'CKEditor.EditSheet')
5 + This is a sheet for editing the document content using [[CKEditor>>http://ckeditor.com/]].
6 +#else
7 + {{html clean="false"}}
8 + ## Include the auto-save styles.
9 + #set ($discard = $xwiki.ssfx.use('js/xwiki/editors/autosave.css', true))
10 + #if ("$!request.section" != '')
11 + <div class="hidden">
12 + <input type="hidden" name="section" value="$!escapetool.xml($request.section)"/>
13 + </div>
14 + #end
15 + <div class="row">
16 + <div class="cke-editMeta col-xs-12 col-md-7">
17 + ## Add support for editing the page title (which is not available by default in Inline Form edit mode).
18 + #set ($editor = 'wiki')
19 + #template('editmeta.vm')
20 + #set ($editor = 'inline')
21 + </div>
22 + </div>
23 + ## The xwikieditcontent id is needed for the auto-save feature.
24 + <div id="xwikieditcontent" data-autosave="true">
25 + #set ($parameters = {
26 + 'content': $tdoc.content,
27 + 'attributes': {
28 + 'id': 'content',
29 + 'name': 'content',
30 + 'rows': 25,
31 + 'cols': 80
32 + }
33 + })
34 + #ckeditor($parameters)
35 + </div>
36 + {{/html}}
37 +#end
38 +{{/velocity}}
XWiki.JavaScriptExtension[0]
Code
... ... @@ -54,11 +54,9 @@
54 54   }
55 55  
56 56   var uploadDisabled = element.hasAttribute('data-upload-disabled');
57 - var startupFocus = element.hasAttribute('data-startup-focus');
58 58  
59 59   var config = {
60 60   filebrowserUploadUrl: uploadDisabled ? '' : getUploadURL(sourceDocument, 'filebrowser'),
61 - startupFocus,
62 62   height: $(element).height(),
63 63   // Used to resolve and serialize relative references. Also used to make HTTP requests with the right context.
64 64   sourceDocument: sourceDocument,
XWiki.JavaScriptExtension[2]
Code
... ... @@ -10,9 +10,7 @@
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).then(() => {
14 - this.classList.remove('loading');
15 - });
13 + createEditor(ckeditor, this);
16 16   } catch(e) {
17 17   console.log(e);
18 18   }
XWiki.StyleSheetExtension[0]
Code
... ... @@ -12,13 +12,6 @@
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 -
22 22  /* Show the modal above the CKEditor dialogs */
23 23  body > .modal-backdrop {
24 24   z-index: 10040;
... ... @@ -211,6 +211,8 @@
211 211  a.cke_button.cke_button__xwiki-macro-edit > span.cke_button_icon.cke_button__xwiki-macro-edit_icon,
212 212  a.cke_button.cke_button__xwiki-link-open > span.cke_button_icon.cke_button__xwiki-link-open_icon,
213 213  a.cke_button.cke_button__insert > span.cke_button_icon.cke_button__insert_icon {
207 + /* This is needed for XWiki versions older than 7.1M1 where we overwrite the icons path (see above). */
208 + background-image: none !important;
214 214   font-family: 'Glyphicons Halflings';
215 215   position: relative;
216 216   top: 1px;
... ... @@ -317,7 +317,7 @@
317 317   max-width: 64px;
318 318   vertical-align: text-top;
319 319  }
320 -/* The image still takes some space in all browsers even if there's no source specified. Let's make sure it's hidden.
315 +/* The image still takes some space in IE11 even if there's no source specified. Let's make sure it's hidden.
321 321   See CKEDITOR-389: Missing space in the suggestions that appear while using the autocomplete function on IE 11 */
322 322  .ckeditor-autocomplete-item-preview-wrapper img[src=""],
323 323  .ckeditor-autocomplete-item-icon-wrapper img[src=""] {
... ... @@ -370,89 +370,29 @@
370 370  }
371 371  
372 372  .cke_contents > textarea.cke_source.cke_editable_inline {
368 + border: 1px solid transparent;
369 + border-radius: 0;
373 373   box-shadow: none;
371 + margin-top: -1px;
372 + margin-left: -1px;
373 +
374 + .form-control-focus();
374 374  }
375 375  
377 +.cke_contents.fake {
378 + /* We need this to have the box shadow visible when the source area is focused. */
379 + overflow: visible;
380 +}
381 +
376 376  #xwikicontent + .cke_contents > textarea.cke_source.cke_editable_inline {
377 377   /* Don't take the padding and the margin into account when computing the 100% width. */
378 378   box-sizing: content-box;
379 379   /* Make sure the Source area has the same width as the WYSIWYG area. */
380 - margin-left: -@grid-gutter-width / 2;
381 - margin-right: -@grid-gutter-width / 2;
386 + margin-left: -@grid-gutter-width / 2 - 1px;
387 + margin-right: -@grid-gutter-width / 2 - 1px;
382 382  }
383 383  
384 384  /**
385 - * Custom styles to match XWiki's Look & Feel
386 - */
387 -.cke_chrome,
388 -.cke_chrome > .cke_inner {
389 - border-radius: @border-radius-base;
390 -}
391 -
392 -.cke_chrome > .cke_inner > .cke_top {
393 - border-top-right-radius: @border-radius-base;
394 - border-top-left-radius: @border-radius-base;
395 -}
396 -
397 -.cke_chrome > .cke_inner > .cke_bottom {
398 - border-bottom-right-radius: @border-radius-base;
399 - border-bottom-left-radius: @border-radius-base;
400 -}
401 -
402 -/* The standalone WYSIWYG edit mode shows the form action toolbar right below the CKEditor instance used to edit the
403 - document content. We make the bottom border rounded on the form action toolbar instead. */
404 -#xwikieditcontent > .cke_chrome,
405 -#xwikieditcontent > .cke_chrome > .cke_inner,
406 -#xwikieditcontent > .cke_chrome > .cke_inner > .cke_bottom {
407 - border-bottom-right-radius: 0;
408 - border-bottom-left-radius: 0;
409 -}
410 -
411 -a.cke_button,
412 -a.cke_combo_button {
413 - border-radius: @border-radius-small;
414 -}
415 -
416 -.cke_panel,
417 -.cke_dialog_body,
418 -.cke_dialog a.cke_dialog_ui_button,
419 -.cke_dialog input.cke_dialog_ui_input_text,
420 -.cke_dialog select.cke_dialog_ui_input_select,
421 -.cke_dialog fieldset.cke_dialog_ui_fieldset,
422 -.cke_notification {
423 - border-radius: @border-radius-base;
424 -}
425 -
426 -.cke_panel.cke_menu_panel,
427 -.cke_panel.cke_combopanel {
428 - margin: 2px 0;
429 -}
430 -
431 -.cke_dialog_title,
432 -.cke_dialog a.cke_dialog_tab {
433 - border-top-right-radius: @border-radius-base;
434 - border-top-left-radius: @border-radius-base;
435 -}
436 -
437 -.cke_dialog_contents,
438 -.cke_dialog_footer {
439 - border-bottom-right-radius: @border-radius-base;
440 - border-bottom-left-radius: @border-radius-base;
441 -}
442 -
443 -/**
444 - * Custom styles for the in-line editor
445 - */
446 -.viewbody > .cke_float {
447 - /* Shift the floating toolbar in order to match the content padding. */
448 - margin-right: floor((@grid-gutter-width / 2));
449 - margin-left: ceil((@grid-gutter-width / 2));
450 -}
451 -.cke_float .cke_top {
452 - border-radius: @border-radius-base;
453 -}
454 -
455 -/**
456 456   * Full-screen styles for the in-line editor
457 457   */
458 458  body[data-maximized="true"] {
... ... @@ -488,6 +488,12 @@
488 488   margin: 0 !important;
489 489   overflow-y: auto !important;
490 490   z-index: 9995;
426 +
427 + &:focus {
428 + /* Remove the focus border. */
429 + border-color: transparent !important;
430 + box-shadow: none !important;
431 + }
491 491   }
492 492   .cke_maximize_backdrop {
493 493   top: 0;
... ... @@ -507,37 +507,3 @@
507 507   z-index: 9995;
508 508   }
509 509  }
510 -
511 -/*
512 - * Override the CKEditor reset for the table border color.
513 - * The default border color from CKEditor is quite lacking on contrast.
514 - */
515 -.cke_editable.cke_show_borders table.cke_show_border,
516 -.cke_editable.cke_show_borders table.cke_show_border > tr > th,
517 -.cke_editable.cke_show_borders table.cke_show_border > tr > td,
518 -.cke_editable.cke_show_borders table.cke_show_border > thead > tr > th,
519 -.cke_editable.cke_show_borders table.cke_show_border > thead > tr > td,
520 -.cke_editable.cke_show_borders table.cke_show_border > tbody > tr > th,
521 -.cke_editable.cke_show_borders table.cke_show_border > tbody > tr > td,
522 -.cke_editable.cke_show_borders table.cke_show_border > tfoot > tr > th,
523 -.cke_editable.cke_show_borders table.cke_show_border > tfoot > tr > td {
524 - border-color: @table-border-color;
525 - border-style: solid;
526 -}
527 -
528 -/* CKEditor contains a CSS reset. It works with its own style sheets and does not use the ones in XWiki.
529 -However, we want `.sr-only` from XWiki to still be usable in our CKEditor environment.
530 -We need to redefine the XWiki styles of this class to have better priority than the CKEditor CSS reset.
531 -Without this, the elements with this class are still shown which would be different from the behaviour
532 -of `.sr-only` anywhere else in XWiki (as described in our doc).
533 -This redefinition allows for a more consistent behaviour of the `.sr-only` class. */
534 -.cke_reset_all .sr-only {
535 - position: absolute;
536 - width: 1px;
537 - height: 1px;
538 - padding: 0;
539 - margin: -1px;
540 - overflow: hidden;
541 - clip: rect(0, 0, 0, 0);
542 - border: 0;
543 -}