Changes for page EditSheet
Last modified by superadmin on 2025/02/27 10:46
From version 3.1
edited by Thomas Coelho (local)
on 2022/08/02 15:11
on 2022/08/02 15:11
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/14.6]
To version 5.1
edited by Thomas Coelho (local)
on 2023/01/17 20:36
on 2023/01/17 20:36
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/14.10.3]
Summary
-
Objects (1 modified, 0 added, 0 removed)
Details
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -1,9 +1,14 @@ 1 1 /* 2 +#if ($services.debug.minify) 3 + #set ($jsExtension = '.min') 4 +#else 5 + #set ($jsExtension = '') 6 +#end 2 2 #set ($ckeditorPath = $services.webjars.url('org.xwiki.platform:xwiki-platform-ckeditor-webjar', 'ckeditor')) 3 3 #set ($ckeditorBasePath = $stringtool.removeEnd($stringtool.removeEnd($ckeditorPath, '.js'), 'ckeditor')) 4 -#set ($resourcePickerBundlePath = "${ckeditorBasePath}plugins/xwiki-resource/resourcePicker.bundle .min")5 -#set ($macroWizardBundlePath = "${ckeditorBasePath}plugins/xwiki-macro/macroWizard.bundle .min")6 -#set ($imageWizardBundlePath = "${ckeditorBasePath}plugins/xwiki-image/imageWizard.bundle .min")9 +#set ($resourcePickerBundlePath = "${ckeditorBasePath}plugins/xwiki-resource/resourcePicker.bundle$jsExtension") 10 +#set ($macroWizardBundlePath = "${ckeditorBasePath}plugins/xwiki-macro/macroWizard.bundle$jsExtension") 11 +#set ($imageWizardBundlePath = "${ckeditorBasePath}plugins/xwiki-image/imageWizard.bundle$jsExtension") 7 7 #set ($modalPath = "${ckeditorBasePath}plugins/xwiki-dialog/modal.min") 8 8 #set ($l10nPath = "${ckeditorBasePath}plugins/xwiki-localization/l10n.min") 9 9 */ ... ... @@ -76,12 +76,16 @@ 76 76 77 77 // Extend the default CKEditor configuration with settings that depend on the source document. 78 78 var getConfig = function(element) { 84 + var sourceSyntax = $(element).attr('data-syntax'); 79 79 var sourceDocument = XWiki.currentDocument; 80 - var sourceDocumentReference = $(element).attr('data-sourceDocumentReference'); 81 - if (sourceDocumentReference) { 82 - sourceDocument = new XWiki.Document(XWiki.Model.resolve(sourceDocumentReference, XWiki.EntityType.DOCUMENT)); 86 + sourceDocument.syntax = XWiki.docsyntax; 87 + var sourceDocumentReference = XWiki.Model.resolve($(element).attr('data-sourceDocumentReference'), 88 + XWiki.EntityType.DOCUMENT, XWiki.currentDocument.documentReference); 89 + if (!XWiki.currentDocument.documentReference.equals(sourceDocumentReference)) { 90 + sourceDocument = new XWiki.Document(sourceDocumentReference); 91 + // We assume the syntax of the source document is the same as the syntax of the edited content. 92 + sourceDocument.syntax = sourceSyntax; 83 83 } 84 - sourceDocument.syntax = $(element).attr('data-sourceDocumentSyntax'); 85 85 86 86 var config = { 87 87 filebrowserUploadUrl: getUploadURL(sourceDocument, 'filebrowser'), ... ... @@ -109,13 +109,18 @@ 109 109 '</div>', 110 110 '<div class="ckeditor-autocomplete-item-hint">{hint}</div>', 111 111 '</li>'].join(''), 112 - outputTemplate: '<a href="{url}" data-reference="{typed}|-|{type}|-|{reference}">{label}</a><span> </span>', 121 + outputTemplate: '<a href="{url}" data-reference="{typed}|-|{type}|-|{reference}">{label}</a>', 122 + followingSpace: true, 113 113 marker: '[', 114 114 minChars: 0, 115 115 itemsLimit: 6 116 116 } 117 117 ], 128 + // Used to resolve and serialize relative references. Also used to make HTTP requests with the right context. 118 118 sourceDocument: sourceDocument, 130 + // The syntax of the edited content is not always the same as the syntax of the source document (which applies to 131 + // the source document content, but we might be editing something else, like an object property). 132 + sourceSyntax: sourceSyntax, 119 119 uploadUrl: getUploadURL(sourceDocument, 'filetools'), 120 120 'xwiki-link': { 121 121 // We use the source document to compute the link label generator URL because we want the link references to be