Project

General

Profile

Patch #43710 » 0002-Moves-wikiImageMimeTypes-to-meta-tag.patch

Marius BĂLTEANU, 2026-01-24 06:21

View differences:

app/assets/javascripts/attachments.js
}
function handleFileDropEvent(e) {
$(this).removeClass('fileover');
blockEventPropagation(e);
......
}
function addInlineAttachmentMarkup(file) {
var metaElement = document.querySelector('meta[name="image-mime-types"]')
var wikiImageMimeTypes = [];
if (metaElement) {
try {
wikiImageMimeTypes = JSON.parse(metaElement.content)
} catch (e) {
console.error('Failed to parse image mime types:', e)
}
}
// insert uploaded image inline if dropped area is currently focused textarea
if($(handleFileDropEvent.target).hasClass('wiki-edit') && $.inArray(file.type, window.wikiImageMimeTypes) > -1) {
if($(handleFileDropEvent.target).hasClass('wiki-edit') && $.inArray(file.type, wikiImageMimeTypes) > -1) {
var $textarea = $(handleFileDropEvent.target);
var cursorPosition = $textarea.prop('selectionStart');
var description = $textarea.val();
app/helpers/application_helper.rb
image_url(favicon_path)
end
def image_mime_types_tag
content_tag(:meta, nil, name: 'image-mime-types', content: Redmine::MimeType.by_type('image').to_json)
end
def robot_exclusion_tag
'<meta name="robots" content="noindex,follow,noarchive" />'.html_safe
end
app/views/layouts/base.html.erb
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= image_mime_types_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.13.2', 'tribute-5.1.3', 'application', 'responsive', 'wiki_editor', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
    (1-1/1)