Skip to content
Next
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Frontend
Project
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
814
Merge Requests
63
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
e103e3e3
Commit
e103e3e3
authored
5 hours ago
by
Ben Hayward
Browse files
Options
Download
Testing and fixes
parent
9283d879
feat/rich-embed-modals-2162
1 merge request
!617
WIP: [Sprint/QuietQuail](feat) Rich embed open in media modals #2162
Pipeline
#92906362
passed with stages
in 80 minutes and 16 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
15 deletions
+33
-15
src/app/common/components/rich-embed/rich-embed.ts
View file @
e103e3e3
...
...
@@ -20,6 +20,7 @@ import { FeaturesService } from '../../../services/features.service';
})
export
class
MindsRichEmbed
{
type
:
string
=
''
;
mediaSource
:
string
=
''
;
src
:
any
=
{};
preview
:
any
=
{};
maxheight
:
number
=
320
;
...
...
@@ -68,11 +69,16 @@ export class MindsRichEmbed {
}
init
()
{
this
.
openModal
=
this
.
mediaModalRequested
.
observers
.
length
>
0
;
// Inline Embedding
let
inlineEmbed
=
this
.
parseInlineEmbed
(
this
.
inlineEmbed
);
if
(
this
.
featureService
.
has
(
'
media-modal
'
)
&&
this
.
mediaSource
===
'
youtube
'
)
{
this
.
openModal
=
this
.
mediaModalRequested
.
observers
.
length
>
0
;
}
if
(
inlineEmbed
&&
inlineEmbed
.
id
&&
...
...
@@ -89,7 +95,11 @@ export class MindsRichEmbed {
this
.
inlineEmbed
=
inlineEmbed
;
if
(
this
.
openModal
)
{
if
(
this
.
openModal
&&
this
.
featureService
.
has
(
'
media-modal
'
)
&&
this
.
mediaSource
===
'
youtube
'
)
{
if
(
this
.
inlineEmbed
&&
this
.
inlineEmbed
.
htmlProvisioner
)
{
this
.
inlineEmbed
.
htmlProvisioner
().
then
(
html
=>
{
this
.
inlineEmbed
.
html
=
html
;
...
...
@@ -102,7 +112,11 @@ export class MindsRichEmbed {
}
action
(
$event
)
{
if
(
this
.
openModal
&&
this
.
featureService
.
has
(
'
media-modal
'
))
{
if
(
this
.
openModal
&&
this
.
featureService
.
has
(
'
media-modal
'
)
&&
this
.
mediaSource
===
'
youtube
'
)
{
$event
.
preventDefault
();
$event
.
stopPropagation
();
this
.
mediaModalRequested
.
emit
();
...
...
@@ -146,6 +160,7 @@ export class MindsRichEmbed {
if
((
matches
=
youtube
.
exec
(
url
))
!==
null
)
{
if
(
matches
[
1
])
{
this
.
mediaSource
=
'
youtube
'
;
return
{
id
:
`video-youtube-
${
matches
[
1
]}
`
,
className
:
...
...
@@ -164,6 +179,7 @@ export class MindsRichEmbed {
if
((
matches
=
vimeo
.
exec
(
url
))
!==
null
)
{
if
(
matches
[
1
])
{
this
.
mediaSource
=
'
vimeo
'
;
return
{
id
:
`video-vimeo-
${
matches
[
1
]}
`
,
className
:
...
...
@@ -182,6 +198,7 @@ export class MindsRichEmbed {
if
((
matches
=
soundcloud
.
exec
(
url
))
!==
null
)
{
if
(
matches
[
1
])
{
this
.
mediaSource
=
'
soundcloud
'
;
return
{
id
:
`audio-soundcloud-
${
matches
[
1
]}
`
,
className
:
...
...
@@ -206,9 +223,9 @@ export class MindsRichEmbed {
// Spotify
let
spotify
=
/^
(?:
https
?
:
\/\/)?
open
\.
spotify
\.
com
\/
track
\/([
a-z0-9
]
+
)
/i
;
if
((
matches
=
spotify
.
exec
(
url
))
!==
null
)
{
if
(
matches
[
1
])
{
this
.
mediaSource
=
'
spotify
'
;
return
{
id
:
`audio-spotify-
${
matches
[
1
]}
`
,
className
:
...
...
@@ -233,7 +250,7 @@ export class MindsRichEmbed {
if
(
!
id
)
{
return
null
;
}
this
.
mediaSource
=
'
giphy
'
;
return
{
id
:
`image-giphy-
${
matches
[
1
]}
`
,
className
:
...
...
@@ -251,7 +268,9 @@ export class MindsRichEmbed {
}
hasInlineContentLoaded
()
{
return
!
this
.
openModal
&&
this
.
inlineEmbed
&&
this
.
inlineEmbed
.
html
;
return
this
.
featureService
.
has
(
'
media-modal
'
)
?
!
this
.
openModal
&&
this
.
inlineEmbed
&&
this
.
inlineEmbed
.
html
:
this
.
embeddedInline
&&
this
.
inlineEmbed
&&
this
.
inlineEmbed
.
html
;
}
detectChanges
()
{
...
...
This diff is collapsed.
src/app/modules/media/modal/modal.component.ts
View file @
e103e3e3
...
...
@@ -26,6 +26,7 @@ import isMobileOrTablet from '../../../helpers/is-mobile-or-tablet';
import
{
ActivityService
}
from
'
../../../common/services/activity.service
'
;
import
{
SiteService
}
from
'
../../../common/services/site.service
'
;
import
{
ClientMetaService
}
from
'
../../../common/services/client-meta.service
'
;
import
{
FeaturesService
}
from
'
../../../services/features.service
'
;
export
type
MediaModalParams
=
{
redirectUrl
?:
string
;
...
...
@@ -127,6 +128,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
private
location
:
Location
,
private
site
:
SiteService
,
private
clientMetaService
:
ClientMetaService
,
private
featureService
:
FeaturesService
,
@
SkipSelf
()
injector
:
Injector
)
{
this
.
clientMetaService
...
...
@@ -167,6 +169,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
break
;
default
:
if
(
this
.
featureService
.
has
(
'
media-modal
'
)
&&
this
.
entity
.
perma_url
&&
this
.
entity
.
title
&&
!
this
.
entity
.
entity_guid
...
...
@@ -542,12 +545,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
// Show overlay and video controls
onMouseEnterStage
()
{
if
(
this
.
contentType
===
'
rich-embed
'
)
{
this
.
overlayVisible
=
false
;
}
this
.
overlayVisible
=
true
;
if
(
this
.
contentType
===
'
video
'
)
{
// Make sure progress bar seeker is updating when video controls are visible
this
.
videoComponent
.
stageHover
=
true
;
...
...
This diff is collapsed.
src/app/services/features.service.ts
View file @
e103e3e3
...
...
@@ -22,9 +22,10 @@ export class FeaturesService {
if
(
typeof
this
.
_features
[
feature
]
===
'
undefined
'
)
{
if
(
isDevMode
()
&&
!
this
.
_hasWarned
(
feature
))
{
console
.
warn
(
`[FeaturedService] Feature '
${
feature
}
' is not declared. Assuming false.`
);
console
.
warn
// `[FeaturedService] Feature '${feature}' is not declared. Assuming false.`
();
this
.
_warnedCache
[
feature
]
=
Date
.
now
();
}
...
...
This diff is collapsed.
Please
register
or
sign in
to comment