Skip to content

Commit

Permalink
delete: remove forceEdit parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
rivexe committed Oct 14, 2024
1 parent fc5b0fe commit 716c3e8
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 56 deletions.
3 changes: 1 addition & 2 deletions controller/editorapicontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,14 @@ public function fillempty($fileId) {
* @param bool $desktop - desktop label
* @param bool $template - file is template
* @param string $anchor - anchor link
* @param bool $forceEdit - open editing
*
* @return JSONResponse
*
* @NoAdminRequired
* @PublicPage
* @CORS
*/
public function config($fileId, $filePath = null, $shareToken = null, $version = 0, $inframe = false, $desktop = false, $template = false, $anchor = null, $forceEdit = false) {
public function config($fileId, $filePath = null, $shareToken = null, $version = 0, $inframe = false, $desktop = false, $template = false, $anchor = null) {
$user = $this->userSession->getUser();
$userId = null;
$accountId = null;
Expand Down
11 changes: 4 additions & 7 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,6 @@ public function download($fileId, $toExtension = null, $template = false) {
* @param string $shareToken - access token
* @param integer $version - file version
* @param bool $inframe - open in frame
* @param bool $forceEdit - open editing
* @param bool $template - file is template
* @param string $anchor - anchor for file content
*
Expand All @@ -1287,7 +1286,7 @@ public function download($fileId, $toExtension = null, $template = false) {
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index($fileId, $filePath = null, $shareToken = null, $version = 0, $inframe = false, $forceEdit = false, $template = false, $anchor = null) {
public function index($fileId, $filePath = null, $shareToken = null, $version = 0, $inframe = false, $template = false, $anchor = null) {
$this->logger->debug("Open: $fileId ($version) $filePath", ["app" => $this->appName]);

if (empty($shareToken) && !$this->userSession->isLoggedIn()) {
Expand Down Expand Up @@ -1327,8 +1326,7 @@ public function index($fileId, $filePath = null, $shareToken = null, $version =
"version" => $version,
"template" => $template,
"inframe" => false,
"anchor" => $anchor,
"forceEdit" => $forceEdit
"anchor" => $anchor
];

if ($inframe === true) {
Expand Down Expand Up @@ -1359,16 +1357,15 @@ public function index($fileId, $filePath = null, $shareToken = null, $version =
* @param string $shareToken - access token
* @param integer $version - file version
* @param bool $inframe - open in frame
* @param bool $forceEdit - open editing
*
* @return TemplateResponse
*
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
*/
public function publicPage($fileId, $shareToken, $version = 0, $inframe = false, $forceEdit = false) {
return $this->index($fileId, null, $shareToken, $version, $inframe, $forceEdit);
public function publicPage($fileId, $shareToken, $version = 0, $inframe = false) {
return $this->index($fileId, null, $shareToken, $version, $inframe);
}

/**
Expand Down
27 changes: 0 additions & 27 deletions js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
OCA.Onlyoffice.template = $("#iframeEditor").data("template");
OCA.Onlyoffice.inframe = !!$("#iframeEditor").data("inframe");
OCA.Onlyoffice.anchor = $("#iframeEditor").attr("data-anchor");
OCA.Onlyoffice.forceEdit = $("#iframeEditor").attr("data-forceEdit");
OCA.Onlyoffice.currentWindow = window;

if (OCA.Onlyoffice.inframe) {
Expand Down Expand Up @@ -104,10 +103,6 @@
params.push("anchor=" + encodeURIComponent(OCA.Onlyoffice.anchor));
}

if (OCA.Onlyoffice.forceEdit) {
params.push("forceEdit=true");
}

if (OCA.Onlyoffice.Desktop) {
params.push("desktop=true");
}
Expand Down Expand Up @@ -229,15 +224,6 @@
OCA.Onlyoffice.onRequestSharingSettings;
}

if (
!config.document.permissions.edit &&
config.document.permissions.fillForms &&
config.canEdit
) {
config.events.onRequestEditRights =
OCA.Onlyoffice.onRequestEditRights;
}

OCA.Onlyoffice.docEditor = new DocsAPI.DocEditor(
"iframeEditor",
config
Expand Down Expand Up @@ -272,19 +258,6 @@
});
};

OCA.Onlyoffice.onRequestEditRights = function () {
if (OCA.Onlyoffice.inframe) {
window.parent.postMessage(
{
method: "onRequestEditRights",
},
"*"
);
return;
}
location.href += "&forceEdit=true";
};

OCA.Onlyoffice.onRequestHistory = function (version) {
$.get(
OC.generateUrl(
Expand Down
9 changes: 0 additions & 9 deletions js/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@
OC.Notification.show(messageObj.message, messageObj.props);
};

OCA.Onlyoffice.onRequestEditRights = function () {
$("#onlyoffice-frame").attr(
"src",
$("#onlyoffice-frame").attr("src") + "&forceEdit=true"
);
};

window.addEventListener(
"message",
function (event) {
Expand Down Expand Up @@ -191,8 +184,6 @@
case "onShowMessage":
OCA.Onlyoffice.onShowMessage(event.data.param);
break;
case "onRequestEditRights":
OCA.Onlyoffice.onRequestEditRights();
}
},
false
Expand Down
11 changes: 2 additions & 9 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,12 @@
if (open) {
const fileName = response.name;
const extension = OCA.Onlyoffice.GetFileExtension(fileName);
const forceEdit = OCA.Onlyoffice.setting.formats[extension].fillForms;
OCA.Onlyoffice.OpenEditor(
response.id,
dir,
fileName,
0,
winEditor,
forceEdit
winEditor
);
}

Expand All @@ -117,8 +115,7 @@
fileDir,
fileName,
version,
winEditor,
forceEdit
winEditor
) {
let filePath = "";
if (fileName) {
Expand All @@ -142,10 +139,6 @@
);
}

if (forceEdit) {
url += "&forceEdit=true";
}

if (version > 0) {
url += "&version=" + version;
}
Expand Down
3 changes: 1 addition & 2 deletions templates/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
data-version="<?php p($_["version"]) ?>"
data-template="<?php p($_["template"]) ?>"
data-anchor="<?php p($_["anchor"]) ?>"
data-inframe="<?php p($_["inframe"]) ?>"
data-forceedit="<?php p($_["forceEdit"]) ?>"></div>
data-inframe="<?php p($_["inframe"]) ?>"></div>

<?php if (!empty($_["documentServerUrl"])) { ?>
<script nonce="<?php p(base64_encode($_["requesttoken"])) ?>"
Expand Down

0 comments on commit 716c3e8

Please sign in to comment.