Changes for page ConfigSheet

Last modified by SuperNico Laub on 2025/09/18 17:55

From version 2.1
edited by SuperNico Laub
on 2025/09/18 17:55
Change comment: Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/17.7.0]
To version 1.1
edited by superadmin
on 2025/05/22 17:44
Change comment: Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/16.10.8]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.supernico
1 +XWiki.superadmin
Content
... ... @@ -18,6 +18,26 @@
18 18   #set ($isTemporaryAttachmentSupported = "$!services.temporaryAttachments" != '')
19 19   #set ($htmlSyntax = ${services.wysiwyg.HTMLSyntax.toIdString()|'annotatedxhtml/1.0'})
20 20   #set ($isHTML5 = !$htmlSyntax.equals('annotatedxhtml/1.0'))
21 + ## Verify if the office import feature is supported.
22 + ##
23 + ## It's not enough to check if the Office server is connected because the 'importOfficeAttachment' API is available
24 + ## only since XWiki 9.8 (see XWIKI-14739) while the CKEditor Integration extension can be installed on older versions
25 + ## of XWiki where the users won't be able to import office documents from the CKEditor even if the Office server is
26 + ## connected. On these older versions the users will have to use the Create Page dialog with the Page from Office
27 + ## option.
28 + ##
29 + ## We check if the 'importOfficeAttachment' API is available by trying to import an attachment that doesn't exist
30 + ## using the Office Viewer macro, which should output an error message saying that the attachment doesn't exist. This
31 + ## way the Office server is not actually called so there's no risk of slowing down or blocking the CKEditor load (see
32 + ## CKEDITOR-294).
33 + #set ($missingAttachmentReference = $services.model.resolveAttachment('CKEditor.OfficeImporter@doesNotExist.txt'))
34 + #set ($officeServerConnected = $services.officemanager.isConnected())
35 + #if ("$!officeServerConnected" == '')
36 + ## Before XWiki 12.3 and 11.10.5
37 + #set ($officeServerConnected = $services.officemanager.serverState == 'Connected')
38 + #end
39 + #set ($officeImportSupported = $officeServerConnected &&
40 + "$!services.wysiwyg.importOfficeAttachment($missingAttachmentReference, {'useOfficeViewer': true})" != '')
21 21   ## Global default configuration that doesn't depend on the edited content and that needs Velocity code for evaluation.
22 22   ## Static global configuration (that doesn't need Velocity) should be put in config.js . The default instance level
23 23   ## configuration is in EditSheet.
... ... @@ -26,7 +26,7 @@
26 26   'htmlSyntax': $htmlSyntax,
27 27   'stylesSet': "#if ($isHTML5)html5#{else}html4#end",
28 28   'xwiki-office': {
29 - 'enabled': $services.officemanager.isConnected()
49 + 'enabled': $officeImportSupported
30 30   },
31 31   'xwiki-realtime': {
32 32   'stylesheets': [