From 5aaef8afc2f138d7b09d19406c550b8d1a2f54fc Mon Sep 17 00:00:00 2001 From: sunhao Date: Thu, 9 Jan 2025 16:49:14 +0800 Subject: [PATCH] * [bug #58835] fix edit code block lang not record aciton to history panel. --- module/doc/model.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index 640ac04acf..ea8eed96d2 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1698,10 +1698,16 @@ class docModel extends model if(isset($doc->content) && empty($doc->content)) return dao::$errors['content'] = sprintf($this->lang->error->notempty, $this->lang->doc->content); } - $files = $this->loadModel('file')->saveUpload('doc', $docID); - $changes = common::createChanges($oldDoc, $doc); - $changed = $files ? true : false; - if(!$changed && isset($doc->rawContent)) $changed = (isset($oldDoc->rawContent) ? $oldDoc->rawContent : null) != $doc->rawContent; + $files = $this->loadModel('file')->saveUpload('doc', $docID); + $changes = common::createChanges($oldDoc, $doc); + $oldRawContent = isset($oldDocContent->rawContent) ? $oldDocContent->rawContent : ''; + $newRawContent = isset($doc->rawContent) ? $doc->rawContent : ''; + $changed = $files ? true : false; + if($oldRawContent != $newRawContent) + { + $changed = true; + $changes[] = array('field' => 'rawContent', 'old' => $oldRawContent, 'new' => $newRawContent); + } if(!$changed) { foreach($changes as $change) @@ -1723,7 +1729,7 @@ class docModel extends model $docContent->files = $oldDocContent->files; $docContent->type = isset($doc->contentType) ? $doc->contentType : $oldDocContent->type; if($files) $docContent->files .= ',' . join(',', array_keys($files)); - $docContent->rawContent = isset($doc->rawContent) ? $doc->rawContent : ''; + $docContent->rawContent = $newRawContent; $docContent->files = trim($docContent->files, ','); if(isset($doc->digest)) $docContent->digest = $doc->digest;