Skip to content

Commit

Permalink
fix: filtering elements in insert image dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandrfedorov97 committed Sep 18, 2024
1 parent 5daf2fa commit 9a67b49
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/main/resources/templates/editor.vm
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,21 @@ $webResourceManager.requireResource("onlyoffice.onlyoffice-confluence-plugin:onl

var dialog = $("#insert-image-dialog");

dialog.find(".file-list").on("DOMNodeInserted", function(event) {
var fileExt = event.srcElement.dataset.fileName.split(".").pop();
if (!fileTypes.includes(fileExt)) $(event.srcElement).remove();
var waitLoading = function (dialog, callback) {
if (!dialog.find(".loading-message").first().hasClass('hidden')) {
setTimeout(function() {
waitLoading(dialog, callback);
}, 100);
} else {
callback();
}
};

waitLoading(dialog, function() {
dialog.find(".attached-file").map(function (index, element) {
var fileExt = element.dataset.fileName.split(".").pop();
if (!fileTypes.includes(fileExt)) $(element).remove();
});
});
};

Expand Down

0 comments on commit 9a67b49

Please sign in to comment.