mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Don't stop youtube videos from playing on cloak
This commit is contained in:
parent
ef1ff113a3
commit
65d7103bdc
@ -24,6 +24,7 @@ const icons = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default createWidget('post-small-action', {
|
export default createWidget('post-small-action', {
|
||||||
|
buildKey: attrs => `post-small-act-${attrs.id}`,
|
||||||
tagName: 'div.small-action.onscreen-post.clearfix',
|
tagName: 'div.small-action.onscreen-post.clearfix',
|
||||||
|
|
||||||
buildId(attrs) {
|
buildId(attrs) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import transformPost from 'discourse/lib/transform-post';
|
import transformPost from 'discourse/lib/transform-post';
|
||||||
import { Placeholder } from 'discourse/lib/posts-with-placeholders';
|
import { Placeholder } from 'discourse/lib/posts-with-placeholders';
|
||||||
import { h } from 'virtual-dom';
|
|
||||||
import { addWidgetCleanCallback } from 'discourse/components/mount-widget';
|
import { addWidgetCleanCallback } from 'discourse/components/mount-widget';
|
||||||
|
|
||||||
const CLOAKING_ENABLED = !window.inTestEnv;
|
const CLOAKING_ENABLED = !window.inTestEnv;
|
||||||
@ -86,9 +85,11 @@ export default createWidget('post-stream', {
|
|||||||
|
|
||||||
const height = _cloaked[post.id];
|
const height = _cloaked[post.id];
|
||||||
if (height) {
|
if (height) {
|
||||||
result.push(h('div.cloaked-post', { id: `post_${post.post_number}`,
|
transformed.cloaked = true;
|
||||||
attributes: { style: `height: ${height}px` } }));
|
transformed.height = height;
|
||||||
} else if (transformed.isSmallAction) {
|
}
|
||||||
|
|
||||||
|
if (transformed.isSmallAction) {
|
||||||
result.push(this.attach('post-small-action', transformed, { model: post }));
|
result.push(this.attach('post-small-action', transformed, { model: post }));
|
||||||
} else {
|
} else {
|
||||||
result.push(this.attach('post', transformed, { model: post }));
|
result.push(this.attach('post', transformed, { model: post }));
|
||||||
|
@ -378,7 +378,14 @@ export default createWidget('post', {
|
|||||||
buildKey: attrs => `post-${attrs.id}`,
|
buildKey: attrs => `post-${attrs.id}`,
|
||||||
shadowTree: true,
|
shadowTree: true,
|
||||||
|
|
||||||
|
buildAttributes(attrs) {
|
||||||
|
if (attrs.cloaked) {
|
||||||
|
return { style: `height: ${attrs.height}px` };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
buildClasses(attrs) {
|
buildClasses(attrs) {
|
||||||
|
if (attrs.cloaked) { return 'cloaked-post'; }
|
||||||
const classNames = ['topic-post', 'clearfix'];
|
const classNames = ['topic-post', 'clearfix'];
|
||||||
|
|
||||||
if (attrs.selected) { classNames.push('selected'); }
|
if (attrs.selected) { classNames.push('selected'); }
|
||||||
@ -397,6 +404,8 @@ export default createWidget('post', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
html(attrs) {
|
html(attrs) {
|
||||||
|
if (attrs.cloaked) { return 'cloaked'; }
|
||||||
|
|
||||||
return this.attach('post-article', attrs);
|
return this.attach('post-article', attrs);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user