Patch #43710 » 0002-Moves-wikiImageMimeTypes-to-meta-tag.patch
| app/assets/javascripts/attachments.js | ||
|---|---|---|
| 191 | 191 |
} |
| 192 | 192 |
function handleFileDropEvent(e) {
|
| 193 | ||
| 194 | 193 |
$(this).removeClass('fileover');
|
| 195 | 194 |
blockEventPropagation(e); |
| ... | ... | |
| 290 | 289 |
} |
| 291 | 290 |
function addInlineAttachmentMarkup(file) {
|
| 291 | ||
| 292 |
var metaElement = document.querySelector('meta[name="image-mime-types"]')
|
|
| 293 |
var wikiImageMimeTypes = []; |
|
| 294 | ||
| 295 |
if (metaElement) {
|
|
| 296 |
try {
|
|
| 297 |
wikiImageMimeTypes = JSON.parse(metaElement.content) |
|
| 298 |
} catch (e) {
|
|
| 299 |
console.error('Failed to parse image mime types:', e)
|
|
| 300 |
} |
|
| 301 |
} |
|
| 302 | ||
| 292 | 303 |
// insert uploaded image inline if dropped area is currently focused textarea |
| 293 |
if($(handleFileDropEvent.target).hasClass('wiki-edit') && $.inArray(file.type, window.wikiImageMimeTypes) > -1) {
|
|
| 304 |
if($(handleFileDropEvent.target).hasClass('wiki-edit') && $.inArray(file.type, wikiImageMimeTypes) > -1) {
|
|
| 294 | 305 |
var $textarea = $(handleFileDropEvent.target); |
| 295 | 306 |
var cursorPosition = $textarea.prop('selectionStart');
|
| 296 | 307 |
var description = $textarea.val(); |
| app/helpers/application_helper.rb | ||
|---|---|---|
| 1838 | 1838 |
image_url(favicon_path) |
| 1839 | 1839 |
end |
| 1840 |
def image_mime_types_tag |
|
| 1841 |
content_tag(:meta, nil, name: 'image-mime-types', content: Redmine::MimeType.by_type('image').to_json)
|
|
| 1842 |
end |
|
| 1843 | ||
| 1840 | 1844 |
def robot_exclusion_tag |
| 1841 | 1845 |
'<meta name="robots" content="noindex,follow,noarchive" />'.html_safe |
| 1842 | 1846 |
end |
| app/views/layouts/base.html.erb | ||
|---|---|---|
| 7 | 7 |
<meta name="description" content="<%= Redmine::Info.app_name %>" /> |
| 8 | 8 |
<meta name="keywords" content="issue,bug,tracker" /> |
| 9 | 9 |
<%= csrf_meta_tag %> |
| 10 |
<%= image_mime_types_tag %> |
|
| 10 | 11 |
<%= favicon %> |
| 11 | 12 |
<%= stylesheet_link_tag 'jquery/jquery-ui-1.13.2', 'tribute-5.1.3', 'application', 'responsive', 'wiki_editor', :media => 'all' %> |
| 12 | 13 |
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> |