Changes for page EditSheet

Last modified by teamwire007 on 2026/11/03 07:34

From version 12.1
edited by teamwire007
on 2026/11/03 07:34
Change comment: Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/17.10.14]
To version 4.1
edited by teamwire004
on 2024/07/12 13:08
Change comment: Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/15.10.10]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.teamwire007
1 +XWiki.teamwire004
Content
... ... @@ -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,
... ... @@ -140,7 +140,7 @@
140 140   // We have to overwrite both appendChild and insertBefore because depending on the presence of the BASE element
141 141   // RequireJS uses one or the other.
142 142   ckeditor.on('instanceReady', ({editor}) => {
143 - if (editor.mode === 'wysiwyg' && editor.document.$ !== document) {
141 + if (editor.document.$ !== document) {
144 144   // This editor instance is using a separate DOM document for editing which means it's a standalone editor.
145 145   const initialHead = editor.document.$.head;
146 146   const originalAppendChild = initialHead.appendChild;
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;
... ... @@ -33,23 +33,6 @@
33 33  }
34 34  
35 35  /**
36 - * Standalone edit mode: display the document title as a text input (while preserving the heading styles) in order to
37 - * emphasize that the title can be changed. The in-place edit mode keeps the borderless title in order to avoid text
38 - * flickering when entering or leaving the edit mode.
39 - */
40 -#editMeta #document-title h1.editable {
41 - /* The title input is aligned with the edited content, like the other form fields. */
42 - margin-left: 0;
43 -
44 - & > input[name="title"] {
45 - border: 1px solid @input-border;
46 - border-radius: @input-border-radius;
47 - .box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075));
48 - .form-control-focus();
49 - }
50 -}
51 -
52 -/**
53 53   * Full-screen styles (for the standalone / classic editor).
54 54   */
55 55  
... ... @@ -196,25 +196,6 @@
196 196  }
197 197  
198 198  /**
199 - * Handle the layout and display of the warning message for headerless tables.
200 - * This message is added by the xwiki-table plugin.
201 - * Some of the default styles are just overridden by the CKEditor reset.
202 - */
203 -.cke_dialog_container span.box.warningmessage {
204 - .alert-warning;
205 - /* Default warning boxes are not meant to be used in a strict layout like the one of this table dialog.
206 - * We need an extra customization to avoid breaking this layout. */
207 - white-space: break-spaces;
208 - /* By default, the warning is not shown. */
209 - display: none;
210 -}
211 -
212 -/* When the value of the previous field is the one we want to avoid, we show the warning. */
213 -.cke_dialog_container tr:has(select [value=""]:checked) + tr span.box.warningmessage {
214 - display: unset;
215 -}
216 -
217 -/**
218 218   * Link Options Toggle
219 219   */
220 220  
... ... @@ -247,6 +247,8 @@
247 247  a.cke_button.cke_button__xwiki-macro-edit > span.cke_button_icon.cke_button__xwiki-macro-edit_icon,
248 248  a.cke_button.cke_button__xwiki-link-open > span.cke_button_icon.cke_button__xwiki-link-open_icon,
249 249  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;
250 250   font-family: 'Glyphicons Halflings';
251 251   position: relative;
252 252   top: 1px;
... ... @@ -353,7 +353,7 @@
353 353   max-width: 64px;
354 354   vertical-align: text-top;
355 355  }
356 -/* 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.
357 357   See CKEDITOR-389: Missing space in the suggestions that appear while using the autocomplete function on IE 11 */
358 358  .ckeditor-autocomplete-item-preview-wrapper img[src=""],
359 359  .ckeditor-autocomplete-item-icon-wrapper img[src=""] {
... ... @@ -406,89 +406,29 @@
406 406  }
407 407  
408 408  .cke_contents > textarea.cke_source.cke_editable_inline {
368 + border: 1px solid transparent;
369 + border-radius: 0;
409 409   box-shadow: none;
371 + margin-top: -1px;
372 + margin-left: -1px;
373 +
374 + .form-control-focus();
410 410  }
411 411  
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 +
412 412  #xwikicontent + .cke_contents > textarea.cke_source.cke_editable_inline {
413 413   /* Don't take the padding and the margin into account when computing the 100% width. */
414 414   box-sizing: content-box;
415 415   /* Make sure the Source area has the same width as the WYSIWYG area. */
416 - margin-left: -@grid-gutter-width / 2;
417 - margin-right: -@grid-gutter-width / 2;
386 + margin-left: -@grid-gutter-width / 2 - 1px;
387 + margin-right: -@grid-gutter-width / 2 - 1px;
418 418  }
419 419  
420 420  /**
421 - * Custom styles to match XWiki's Look & Feel
422 - */
423 -.cke_chrome,
424 -.cke_chrome > .cke_inner {
425 - border-radius: @border-radius-base;
426 -}
427 -
428 -.cke_chrome > .cke_inner > .cke_top {
429 - border-top-right-radius: @border-radius-base;
430 - border-top-left-radius: @border-radius-base;
431 -}
432 -
433 -.cke_chrome > .cke_inner > .cke_bottom {
434 - border-bottom-right-radius: @border-radius-base;
435 - border-bottom-left-radius: @border-radius-base;
436 -}
437 -
438 -/* The standalone WYSIWYG edit mode shows the form action toolbar right below the CKEditor instance used to edit the
439 - document content. We make the bottom border rounded on the form action toolbar instead. */
440 -#xwikieditcontent > .cke_chrome,
441 -#xwikieditcontent > .cke_chrome > .cke_inner,
442 -#xwikieditcontent > .cke_chrome > .cke_inner > .cke_bottom {
443 - border-bottom-right-radius: 0;
444 - border-bottom-left-radius: 0;
445 -}
446 -
447 -a.cke_button,
448 -a.cke_combo_button {
449 - border-radius: @border-radius-small;
450 -}
451 -
452 -.cke_panel,
453 -.cke_dialog_body,
454 -.cke_dialog a.cke_dialog_ui_button,
455 -.cke_dialog input.cke_dialog_ui_input_text,
456 -.cke_dialog select.cke_dialog_ui_input_select,
457 -.cke_dialog fieldset.cke_dialog_ui_fieldset,
458 -.cke_notification {
459 - border-radius: @border-radius-base;
460 -}
461 -
462 -.cke_panel.cke_menu_panel,
463 -.cke_panel.cke_combopanel {
464 - margin: 2px 0;
465 -}
466 -
467 -.cke_dialog_title,
468 -.cke_dialog a.cke_dialog_tab {
469 - border-top-right-radius: @border-radius-base;
470 - border-top-left-radius: @border-radius-base;
471 -}
472 -
473 -.cke_dialog_contents,
474 -.cke_dialog_footer {
475 - border-bottom-right-radius: @border-radius-base;
476 - border-bottom-left-radius: @border-radius-base;
477 -}
478 -
479 -/**
480 - * Custom styles for the in-line editor
481 - */
482 -.viewbody > .cke_float {
483 - /* Shift the floating toolbar in order to match the content padding. */
484 - margin-right: floor((@grid-gutter-width / 2));
485 - margin-left: ceil((@grid-gutter-width / 2));
486 -}
487 -.cke_float .cke_top {
488 - border-radius: @border-radius-base;
489 -}
490 -
491 -/**
492 492   * Full-screen styles for the in-line editor
493 493   */
494 494  body[data-maximized="true"] {
... ... @@ -524,6 +524,12 @@
524 524   margin: 0 !important;
525 525   overflow-y: auto !important;
526 526   z-index: 9995;
426 +
427 + &:focus {
428 + /* Remove the focus border. */
429 + border-color: transparent !important;
430 + box-shadow: none !important;
431 + }
527 527   }
528 528   .cke_maximize_backdrop {
529 529   top: 0;
... ... @@ -543,37 +543,3 @@
543 543   z-index: 9995;
544 544   }
545 545  }
546 -
547 -/*
548 - * Override the CKEditor reset for the table border color.
549 - * The default border color from CKEditor is quite lacking on contrast.
550 - */
551 -.cke_editable.cke_show_borders table.cke_show_border,
552 -.cke_editable.cke_show_borders table.cke_show_border > tr > th,
553 -.cke_editable.cke_show_borders table.cke_show_border > tr > td,
554 -.cke_editable.cke_show_borders table.cke_show_border > thead > tr > th,
555 -.cke_editable.cke_show_borders table.cke_show_border > thead > tr > td,
556 -.cke_editable.cke_show_borders table.cke_show_border > tbody > tr > th,
557 -.cke_editable.cke_show_borders table.cke_show_border > tbody > tr > td,
558 -.cke_editable.cke_show_borders table.cke_show_border > tfoot > tr > th,
559 -.cke_editable.cke_show_borders table.cke_show_border > tfoot > tr > td {
560 - border-color: @table-border-color;
561 - border-style: solid;
562 -}
563 -
564 -/* CKEditor contains a CSS reset. It works with its own style sheets and does not use the ones in XWiki.
565 -However, we want `.sr-only` from XWiki to still be usable in our CKEditor environment.
566 -We need to redefine the XWiki styles of this class to have better priority than the CKEditor CSS reset.
567 -Without this, the elements with this class are still shown which would be different from the behaviour
568 -of `.sr-only` anywhere else in XWiki (as described in our doc).
569 -This redefinition allows for a more consistent behaviour of the `.sr-only` class. */
570 -.cke_reset_all .sr-only {
571 - position: absolute;
572 - width: 1px;
573 - height: 1px;
574 - padding: 0;
575 - margin: -1px;
576 - overflow: hidden;
577 - clip: rect(0, 0, 0, 0);
578 - border: 0;
579 -}