Changes for page EditSheet

Last modified by superadmin on 2025/02/27 10:46

From version 8.1
edited by Thomas Coelho (local)
on 2023/09/25 10:22
Change comment: Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/15.7]
To version 7.1
edited by Thomas Coelho (local)
on 2023/07/26 11:23
Change comment: Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/15.5]

Summary

Details

XWiki.JavaScriptExtension[0]
Code
... ... @@ -58,6 +58,36 @@
58 58   var config = {
59 59   filebrowserUploadUrl: uploadDisabled ? '' : getUploadURL(sourceDocument, 'filebrowser'),
60 60   height: $(element).height(),
61 + mentions: [
62 + {
63 + // We use the source document to compute the feed URL because we want the suggested link references to be
64 + // relative to the edited document (we want the editor to output relative references as much as possible).
65 + feed: sourceDocument.getURL('get', $.param({
66 + sheet: 'CKEditor.LinkSuggestions',
67 + outputSyntax: 'plain',
68 + language: XWiki.locale
69 + // Prevent the curly brackets from being URL encoded because they mark a placeholder that will be replaced
70 + // with the text typed by the user (and CKEditor takes care of URL encoding it).
71 + }) + '&input={encodedQuery}'),
72 + itemTemplate: [
73 + '<li data-id="{id}" class="ckeditor-autocomplete-item">',
74 + '<div>',
75 + '<span class="ckeditor-autocomplete-item-icon-wrapper">',
76 + // We have to output both icon types but normally only one is defined and the other is hidden.
77 + '<img src="{iconURL}"/>',
78 + '<span class="{iconClass}"></span>',
79 + '</span>',
80 + '<span class="ckeditor-autocomplete-item-label">{label}</span>',
81 + '</div>',
82 + '<div class="ckeditor-autocomplete-item-hint">{hint}</div>',
83 + '</li>'].join(''),
84 + outputTemplate: '<a href="{url}" data-reference="{typed}|-|{type}|-|{reference}">{label}</a>',
85 + followingSpace: true,
86 + marker: '[',
87 + minChars: 0,
88 + itemsLimit: 6
89 + }
90 + ],
61 61   // Used to resolve and serialize relative references. Also used to make HTTP requests with the right context.
62 62   sourceDocument: sourceDocument,
63 63   // The syntax of the edited content is not always the same as the syntax of the source document (which applies to
XWiki.StyleSheetExtension[0]
Code
... ... @@ -293,28 +293,8 @@
293 293   max-width: 14px;
294 294   vertical-align: text-top;
295 295  }
296 -.ckeditor-autocomplete-item-preview-wrapper {
297 - display: flex;
298 - align-items: center;
299 - justify-content: space-around;
300 - height: 64px;
301 - margin-right: .5em;
302 - text-align: center;
303 - vertical-align: middle;
304 - width: 64px;
305 -}
306 -.ckeditor-autocomplete-centered {
307 - justify-content: center;
308 -}
309 -.ckeditor-autocomplete-item-preview-wrapper img {
310 - border-radius: 3px;
311 - max-height: 64px;
312 - max-width: 64px;
313 - vertical-align: text-top;
314 -}
315 315  /* The image still takes some space in IE11 even if there's no source specified. Let's make sure it's hidden.
316 316   See CKEDITOR-389: Missing space in the suggestions that appear while using the autocomplete function on IE 11 */
317 -.ckeditor-autocomplete-item-preview-wrapper img[src=""],
318 318  .ckeditor-autocomplete-item-icon-wrapper img[src=""] {
319 319   display: none;
320 320  }