Skip to content

Commit 45c620a

Browse files
committed
Fix creating a new file and loading a saved file
1 parent bfccb86 commit 45c620a

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Changelog
44
1.1.1 (Unreleased)
55
-----------------------
66
- Fix #21: Missing icon in Context Menu (File handler)
7+
- Fix #24: Fix creating a new file and loading a saved file
78

89
1.1.0 (August 28, 2025)
910
-----------------------

resources/humhub.drawio.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@ humhub.module('drawio', function (module, require, $) {
3939
Editor.prototype.initEditor = function () {
4040
var that = this;
4141

42-
if (typeof drawioEditorFileGuids === 'undefined') {
43-
drawioEditorFileGuids = [];
44-
}
45-
if (drawioEditorFileGuids.indexOf(that.options.fileGuid) !== -1) {
46-
// Don't initialize it twice
47-
return;
48-
}
49-
drawioEditorFileGuids.push(that.options.fileGuid);
50-
5142
$(window).on('message', function (e) {
5243
if ($('[data-ui-widget="drawio.Editor"]').data('file-guid') !== that.options.fileGuid) {
5344
// Skip event from editor of another file

widgets/EditorWidget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function getData()
4848
'file-guid' => $this->file->guid,
4949
'file-name' => Html::encode($this->file->fileName),
5050
'file-extension' => Html::encode(strtolower(FileHelper::getExtension($this->file))),
51-
'file-content' => file_get_contents($this->file->store->get()),
51+
'file-content' => file_get_contents($this->file->store->get()) ?: null,
5252
'file-save-url' => Url::to(['/drawio/open/update', 'guid' => $this->file->guid]),
5353
'user-guid' => ($user) ? Html::encode($user->guid) : '',
5454
'user-first-name' => ($user) ? Html::encode($user->profile->firstname) : 'Anonymous',

0 commit comments

Comments
 (0)