mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 04:14:38 +08:00
FIX: Disable previews if diffhtml is enabled (#14537)
diffhtml should not rerender video and audio elements so there is no point in having these.
This commit is contained in:
@ -183,7 +183,10 @@ function renderImageOrPlayableMedia(tokens, idx, options, env, slf) {
|
|||||||
// see https://github.com/markdown-it/markdown-it/blob/master/docs/architecture.md#renderer
|
// see https://github.com/markdown-it/markdown-it/blob/master/docs/architecture.md#renderer
|
||||||
// handles |video and |audio alt transformations for image tags
|
// handles |video and |audio alt transformations for image tags
|
||||||
if (split[1] === "video") {
|
if (split[1] === "video") {
|
||||||
if (options.discourse.previewing) {
|
if (
|
||||||
|
options.discourse.previewing &&
|
||||||
|
!options.discourse.limitedSiteSettings.enableDiffhtmlPreview
|
||||||
|
) {
|
||||||
return `<div class="onebox-placeholder-container">
|
return `<div class="onebox-placeholder-container">
|
||||||
<span class="placeholder-icon video"></span>
|
<span class="placeholder-icon video"></span>
|
||||||
</div>`;
|
</div>`;
|
||||||
@ -365,6 +368,7 @@ export function setup(opts, siteSettings, state) {
|
|||||||
|
|
||||||
opts.discourse.limitedSiteSettings = {
|
opts.discourse.limitedSiteSettings = {
|
||||||
secureMedia: siteSettings.secure_media,
|
secureMedia: siteSettings.secure_media,
|
||||||
|
enableDiffhtmlPreview: siteSettings.enable_diffhtml_preview,
|
||||||
};
|
};
|
||||||
|
|
||||||
opts.engine = window.markdownit({
|
opts.engine = window.markdownit({
|
||||||
|
@ -65,8 +65,8 @@ module Onebox
|
|||||||
def placeholder_html
|
def placeholder_html
|
||||||
return article_html if (is_article? || force_article_html?)
|
return article_html if (is_article? || force_article_html?)
|
||||||
return image_html if is_image?
|
return image_html if is_image?
|
||||||
return Onebox::Helpers.video_placeholder_html if is_video? || is_card?
|
return Onebox::Helpers.video_placeholder_html if !SiteSetting.enable_diffhtml_preview? && (is_video? || is_card?)
|
||||||
return Onebox::Helpers.generic_placeholder_html if is_embedded?
|
return Onebox::Helpers.generic_placeholder_html if !SiteSetting.enable_diffhtml_preview? && is_embedded?
|
||||||
to_html
|
to_html
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ module Onebox
|
|||||||
end
|
end
|
||||||
|
|
||||||
def placeholder_html
|
def placeholder_html
|
||||||
::Onebox::Helpers.audio_placeholder_html
|
SiteSetting.enable_diffhtml_preview ? to_html : ::Onebox::Helpers.audio_placeholder_html
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -29,7 +29,7 @@ module Onebox
|
|||||||
end
|
end
|
||||||
|
|
||||||
def placeholder_html
|
def placeholder_html
|
||||||
::Onebox::Helpers.video_placeholder_html
|
SiteSetting.enable_diffhtml_preview ? to_html : ::Onebox::Helpers.video_placeholder_html
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user