Skip to content

Commit

Permalink
fix: context path
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandrfedorov97 committed Dec 21, 2023
1 parent e1019e0 commit 2d2674e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ define('cp/component/onlyoffice-button', [

if (title) {
this.$el.html(templateStore.get('controlOnlyofficeButton')({
contextPath: AJS.contextPath(),
attachmentId: attachmentId,
title: title
}));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/js/dialog-filecreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ AJS.toInit(function ($) {
var insertImageDialog = AJS.Editor.ImageDialog.insertImageDialog(function(a) {
var fileExt = a.selectItems[0].attributes.fileName.split(".").pop();
if (fileExt == "docx") {
window.open("/plugins/servlet/onlyoffice/convert?attachmentId=" + a.selectItems[0].attributes.id +
window.open(AJS.contextPath() + "/plugins/servlet/onlyoffice/convert?attachmentId=" + a.selectItems[0].attributes.id +
"&pageId=" + AJS.params.pageId + "&newTitle=" + $("#view-input-docxf").attr("value")
)
setTimeout(function () { document.location.reload(); }, 1000);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/js/onlyoffice-preview-macro-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

(function($) {
$.getJSON("/plugins/servlet/onlyoffice/formats", function(data) {
$.getJSON(AJS.contextPath() + "/plugins/servlet/onlyoffice/formats", function(data) {
AJS.MacroBrowser.activateSmartFieldsAttachmentsOnPage("onlyoffice-preview", data);
});
})(AJS.$);
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
* @param title The title ONLYOFFICE button.
*/
{template .controlOnlyofficeButton}
<a role="button" target="_blank" tabindex=58" aria-haspopup="true" id="cp-control-panel-onlyoffice" href="/plugins/servlet/onlyoffice/doceditor?attachmentId={$attachmentId}" title="{$title}" class="cp-icon"></a>
<a role="button" target="_blank" tabindex=58" aria-haspopup="true" id="cp-control-panel-onlyoffice" href="{contextPath()}/plugins/servlet/onlyoffice/doceditor?attachmentId={$attachmentId}" title="{$title}" class="cp-icon"></a>
{/template}
4 changes: 2 additions & 2 deletions src/main/resources/templates/preview.vm
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<script type="text/javascript" src="${docServiceApiUrl}"></script>

#if($action == "edit")
<a class="aui-button" target="_blank" style="color: var(--aui-btn-text); margin-bottom: 2px;" href="/plugins/servlet/onlyoffice/doceditor?attachmentId=${attachmentId}">$i18n.getText('onlyoffice.editor.editlink')</a>
<a class="aui-button" target="_blank" style="color: var(--aui-btn-text); margin-bottom: 2px;" href="$req.contextPath/plugins/servlet/onlyoffice/doceditor?attachmentId=${attachmentId}">$i18n.getText('onlyoffice.editor.editlink')</a>
#elseif($action == "fill")
<a class="aui-button" target="_blank" style="color: var(--aui-btn-text); margin-bottom: 2px;" href="/plugins/servlet/onlyoffice/doceditor?attachmentId=${attachmentId}">$i18n.getText('onlyoffice.editor.fillFormlink')</a>
<a class="aui-button" target="_blank" style="color: var(--aui-btn-text); margin-bottom: 2px;" href="$req.contextPath/plugins/servlet/onlyoffice/doceditor?attachmentId=${attachmentId}">$i18n.getText('onlyoffice.editor.fillFormlink')</a>
#end

<div id="iframeEditor_${id}"></div>
Expand Down

0 comments on commit 2d2674e

Please sign in to comment.