pageflow 15.1.1 → 15.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pageflow might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +337 -162
- data/README.md +1 -2
- data/admins/pageflow/accounts.rb +13 -35
- data/admins/pageflow/entry.rb +21 -1
- data/admins/pageflow/entry_templates.rb +140 -0
- data/admins/pageflow/membership.rb +12 -0
- data/admins/pageflow/user.rb +5 -3
- data/app/assets/javascripts/pageflow/admin/accounts.js +3 -3
- data/app/assets/javascripts/pageflow/admin/entries.js +65 -0
- data/app/assets/javascripts/pageflow/admin/users.js +1 -1
- data/app/assets/javascripts/pageflow/asset_urls.js.erb +1 -0
- data/app/assets/javascripts/pageflow/base.js +0 -12
- data/app/assets/javascripts/pageflow/components.js +2 -6
- data/app/assets/javascripts/pageflow/dist/ui.js +56 -14
- data/app/assets/javascripts/pageflow/vendor.js +13 -10
- data/app/assets/stylesheets/pageflow/base.scss +0 -7
- data/app/assets/stylesheets/pageflow/editor/base.scss +2 -0
- data/app/assets/stylesheets/pageflow/editor/composables.scss +5 -1
- data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +44 -55
- data/app/assets/stylesheets/pageflow/editor/help.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/logo/variant/background_image.scss +4 -0
- data/app/assets/stylesheets/pageflow/themes/default/logo/variant/watermark.scss +5 -0
- data/app/assets/stylesheets/pageflow/ui/tooltip.scss +17 -3
- data/app/controllers/pageflow/editor/widgets_controller.rb +1 -1
- data/app/helpers/pageflow/admin/entries_helper.rb +16 -0
- data/app/helpers/pageflow/pages_helper.rb +1 -0
- data/app/helpers/pageflow/structured_data_helper.rb +0 -2
- data/app/models/pageflow/account.rb +26 -0
- data/app/models/pageflow/draft_entry.rb +13 -3
- data/app/models/pageflow/entry.rb +16 -2
- data/app/models/pageflow/entry_duplicate.rb +1 -0
- data/app/models/pageflow/entry_template.rb +69 -0
- data/app/models/pageflow/published_entry.rb +13 -3
- data/app/models/pageflow/revision.rb +1 -1
- data/app/models/pageflow/theming.rb +8 -47
- data/app/policies/pageflow/account_policy.rb +10 -0
- data/app/policies/pageflow/entry_template_policy.rb +22 -0
- data/app/policies/pageflow/theming_policy.rb +0 -4
- data/app/views/admin/accounts/_configuration_label.html.erb +5 -0
- data/app/views/admin/accounts/_entry_template_details.html.arb +19 -0
- data/app/views/admin/accounts/_form.html.erb +5 -31
- data/app/views/admin/accounts/_share_providers_label.html.erb +5 -0
- data/app/views/admin/accounts/_theming_details.html.arb +0 -12
- data/app/views/admin/entries/_attributes_table.html.arb +5 -0
- data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +2 -0
- data/app/views/admin/entries/entry_types.json.jbuilder +4 -0
- data/app/views/admin/entry_templates/_form.html.erb +58 -0
- data/app/views/admin/users/_not_allowed_to_see_user_quota.html.erb +3 -0
- data/app/views/components/pageflow/admin/entry_templates_tab.rb +48 -0
- data/app/views/pageflow/admin/users/_quota_exhausted.html.erb +1 -1
- data/app/views/pageflow/themes/_theme.json.jbuilder +1 -0
- data/config/initializers/admin_resource_tabs.rb +5 -0
- data/config/initializers/help_entries.rb +1 -5
- data/config/locales/de.yml +100 -162
- data/config/locales/en.yml +91 -150
- data/db/migrate/20200122115400_create_pageflow_entry_templates.rb +75 -0
- data/db/migrate/20200206134400_convert_legacy_scrolled_content_element_types.rb +48 -0
- data/db/migrate/20200515112500_add_constraints_to_entry_templates.rb +21 -0
- data/db/migrate/20200807135200_rename_pageflow_entry_template_entry_type_to_entry_type_name.rb +7 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/components.js +7 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +1465 -1348
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +9218 -0
- data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-client.js +1 -1
- data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-server.js +3 -3
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/frontend.js +6 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/server_rendering.js +9 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/vendor.js +8 -0
- data/entry_types/paged/app/controllers/pageflow_paged/application_controller.rb +2 -2
- data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/page_background_asset_helper.rb +4 -3
- data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/react_server_side_rendering_helper.rb +23 -2
- data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +2 -2
- data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +2 -2
- data/entry_types/paged/app/views/pageflow_paged/entries/_entry.html.erb +1 -1
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/page_background_asset/_element.html.erb +0 -0
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/_widget.html.erb +0 -0
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/page.html.erb +0 -0
- data/entry_types/paged/config/initializers/features.rb +1 -1
- data/entry_types/paged/config/initializers/help_entries.rb +17 -0
- data/entry_types/paged/config/locales/new/help.de.yml +162 -0
- data/entry_types/paged/config/locales/new/help.en.yml +153 -0
- data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -0
- data/entry_types/paged/lib/pageflow_paged/plugin.rb +5 -1
- data/entry_types/paged/lib/pageflow_paged/react.rb +12 -0
- data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/page_type.rb +2 -2
- data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/widget_type.rb +2 -2
- data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react-server.js +20613 -0
- data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react.js +21495 -0
- data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react-server.js +24 -0
- data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react.js +24 -0
- data/entry_types/scrolled/app/assets/javascripts/pageflow_scrolled/legacy.js +0 -0
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +15 -4
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +8 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +10 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +4 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/i18n_helper.rb +35 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +33 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +8 -0
- data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +38 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/content_elements/batch.json.jbuilder +2 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -7
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +32 -4
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +13 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +7 -0
- data/entry_types/scrolled/config/initializers/help_entries.rb +16 -0
- data/entry_types/scrolled/config/locales/new/de.yml +565 -10
- data/entry_types/scrolled/config/locales/new/en.yml +472 -11
- data/entry_types/scrolled/config/routes.rb +1 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +31 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDesktop.svg +56 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoMobile.svg +22 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +4 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +3 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +93 -28
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +133 -0
- data/entry_types/scrolled/package/contentElements-editor.js +469 -0
- data/entry_types/scrolled/package/contentElements-frontend.css +1 -0
- data/entry_types/scrolled/package/contentElements-frontend.js +878 -0
- data/entry_types/scrolled/package/editor.js +2725 -2590
- data/entry_types/scrolled/package/frontend-server.js +228 -0
- data/entry_types/scrolled/package/frontend/EditableText-4264c349.js +1993 -0
- data/entry_types/scrolled/package/frontend/Wavesurfer-c3c45324.js +378 -0
- data/entry_types/scrolled/package/frontend/components-cfe6a479.js +2115 -0
- data/entry_types/scrolled/package/frontend/getPrototypeOf-63c7c8e8.js +86 -0
- data/entry_types/scrolled/package/frontend/index.css +9 -0
- data/entry_types/scrolled/package/frontend/index.js +4425 -0
- data/entry_types/scrolled/package/package.json +28 -7
- data/entry_types/scrolled/spec/fixtures/audio.m4a +0 -0
- data/entry_types/scrolled/spec/fixtures/video.mp4 +0 -0
- data/lib/generators/pageflow/initializer/templates/pageflow.rb +20 -9
- data/lib/pageflow/ability_mixin.rb +15 -2
- data/lib/pageflow/configuration.rb +6 -5
- data/lib/pageflow/engine.rb +1 -0
- data/lib/pageflow/entry_type_configuration.rb +1 -0
- data/lib/pageflow/global_config_api.rb +5 -4
- data/lib/pageflow/react.rb +4 -2
- data/lib/pageflow/seeds.rb +0 -2
- data/lib/pageflow/theme.rb +4 -0
- data/lib/pageflow/themes.rb +5 -1
- data/lib/pageflow/version.rb +1 -1
- data/{packages/pageflow → package}/config/jest/index.js +2 -2
- data/{packages/pageflow → package}/config/jest/transformers/jst.js +1 -1
- data/{packages/pageflow → package}/config/jest/transformers/upwardBabel.js +0 -0
- data/package/config/webpack.js +22 -0
- data/{packages/pageflow → package}/editor.js +493 -1122
- data/package/frontend.js +2525 -0
- data/{packages/pageflow → package}/package.json +5 -1
- data/package/testHelpers.js +732 -0
- data/{packages/pageflow → package}/ui.js +56 -14
- data/spec/factories/accounts.rb +9 -1
- data/spec/factories/entry_templates.rb +9 -0
- data/spec/factories/published_entries.rb +8 -1
- data/spec/factories/themings.rb +0 -1
- metadata +74 -27
- data/app/assets/javascripts/pageflow/dist/editor.js +0 -11890
- data/app/assets/javascripts/pageflow/dist/frontend.js +0 -5798
- data/config/initializers/entry_types.rb +0 -4
- data/entry_types/scrolled/package/frontend.js +0 -3404
- data/packages/pageflow/config/jest/transformers/cssModules.js +0 -1
- data/packages/pageflow/config/webpack.js +0 -15
- data/packages/pageflow/testHelpers.js +0 -268
@@ -0,0 +1 @@
|
|
1
|
+
.Heading-module_root__33TFw{margin-top:.2em;margin-bottom:0;padding-top:.3em}@media (orientation:landscape){.Heading-module_first__1PMJX{padding-top:25%}}.BeforeAfter-module_sliderStart__2C5cN{background-color:#fff;position:absolute;z-index:1}.BeforeAfter-module_container__2Lm06{--frame1pos:-8;--frame2pos:16;--frame3pos:-32;--frame4pos:32;--frame1px:calc(var(--frame1pos)*1px);--frame2px:calc(var(--frame2pos)*1px);--frame3px:calc(var(--frame3pos)*1px);--frame4px:calc(var(--frame4pos)*1px)}.BeforeAfter-module_container__2Lm06.BeforeAfter-module_wiggle__3nVSe div div:nth-child(3){-webkit-animation:BeforeAfter-module_SliderLeftRightShake__2mcn5 1.5s cubic-bezier(.36,.07,.19,.97) both;animation:BeforeAfter-module_SliderLeftRightShake__2mcn5 1.5s cubic-bezier(.36,.07,.19,.97) both}.BeforeAfter-module_container__2Lm06.BeforeAfter-module_wiggle__3nVSe div img:nth-child(2){-webkit-animation:BeforeAfter-module_BeforeImageLeftRightShake__38m9V 1.5s cubic-bezier(.36,.07,.19,.97) both;animation:BeforeAfter-module_BeforeImageLeftRightShake__38m9V 1.5s cubic-bezier(.36,.07,.19,.97) both}.BeforeAfter-module_container__2Lm06 div div:nth-child(4) div{transition:opacity .1s ease-out .3s!important}.BeforeAfter-module_container__2Lm06.BeforeAfter-module_wiggle__3nVSe div img:first-child{-webkit-animation:BeforeAfter-module_AfterImageLeftRightShake__3WMf1 1.5s cubic-bezier(.36,.07,.19,.97) both;animation:BeforeAfter-module_AfterImageLeftRightShake__3WMf1 1.5s cubic-bezier(.36,.07,.19,.97) both}.BeforeAfter-module_container__2Lm06 div div:nth-child(5) div{transition:opacity .1s ease-out .3s!important}@-webkit-keyframes BeforeAfter-module_BeforeImageLeftRightShake__38m9V{10%,90%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame1px)),auto,auto)}20%,80%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame2px)),auto,auto)}30%,50%,70%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame3px)),auto,auto)}40%,60%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame4px)),auto,auto)}}@keyframes BeforeAfter-module_BeforeImageLeftRightShake__38m9V{10%,90%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame1px)),auto,auto)}20%,80%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame2px)),auto,auto)}30%,50%,70%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame3px)),auto,auto)}40%,60%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame4px)),auto,auto)}}@-webkit-keyframes BeforeAfter-module_AfterImageLeftRightShake__3WMf1{10%,90%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame1px)))}20%,80%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame2px)))}30%,50%,70%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame3px)))}40%,60%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame4px)))}}@keyframes BeforeAfter-module_AfterImageLeftRightShake__3WMf1{10%,90%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame1px)))}20%,80%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame2px)))}30%,50%,70%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame3px)))}40%,60%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame4px)))}}@-webkit-keyframes BeforeAfter-module_SliderLeftRightShake__2mcn5{10%,90%{transform:translate3d(-20%,0,0)}20%,80%{transform:translate3d(40%,0,0)}30%,50%,70%{transform:translate3d(-80%,0,0)}40%,60%{transform:translate3d(80%,0,0)}}@keyframes BeforeAfter-module_SliderLeftRightShake__2mcn5{10%,90%{transform:translate3d(-20%,0,0)}20%,80%{transform:translate3d(40%,0,0)}30%,50%,70%{transform:translate3d(-80%,0,0)}40%,60%{transform:translate3d(80%,0,0)}}.SoundDisclaimer-module_soundDisclaimer__31hWh{text-align:center;border:1px solid;border-radius:4px;cursor:pointer;font-size:inherit}.SoundDisclaimer-module_soundDisclaimer__31hWh:hover{background:hsla(0,0%,100%,.25)}.TextBlock-module_text__21Hk4 h2,.TextBlock-module_text__21Hk4 li,.TextBlock-module_text__21Hk4 p{margin:1em 0 0}.TextBlock-module_text__21Hk4 a{color:currentColor;word-wrap:break-word}.TextBlock-module_text__21Hk4 ol,.TextBlock-module_text__21Hk4 ul{margin:0;padding-left:20px}.TextBlock-module_text__21Hk4 blockquote{padding:.5em 1em .5em 2em;margin:1em 0 0 .5em;position:relative}.TextBlock-module_text__21Hk4 blockquote:before{content:"\201C";font-size:3em;font-weight:700;color:#aaa;position:absolute;top:0;left:0;line-height:1em}.VideoEmbed-module_embedPlayer__54NKG{background-color:#000;position:absolute;top:0;left:0;bottom:0;right:0}.ExternalLink-module_hidden__3jer0{display:none}.ExternalLink-module_link_item__Blypv{width:45%;max-width:45%;vertical-align:top;margin:2% auto;background-color:#fff;color:#000;text-decoration:none;transition:transform .3s}.ExternalLink-module_link_item__Blypv.ExternalLink-module_invert__1zrgN{background-color:#222;color:#fff}.ExternalLink-module_link_item__Blypv.ExternalLink-module_layout_center__3NRpQ{width:29%;max-width:29%}.ExternalLink-module_link_item__Blypv:hover{transform:scale(1.05)}.ExternalLink-module_link_item__Blypv:hover .ExternalLink-module_link_title__FZJ-0{text-decoration:underline}.ExternalLink-module_link_thumbnail__2_BHq{width:auto;background-repeat:no-repeat;background-size:cover;padding-top:56.25%;position:relative}.ExternalLink-module_link_details__lRhKU{margin:20px}.ExternalLink-module_link_details__lRhKU>.ExternalLink-module_link_title__FZJ-0{font-size:1.2em;font-weight:700;margin-bottom:20px}.ExternalLink-module_link_details__lRhKU>p{width:100%;white-space:normal;line-height:1.3em}.ExternalLink-module_tooltip__18MpC{position:absolute;left:50%;top:80px;width:180px;padding:5px;margin-left:-95px;background-color:#444;color:#fff;border:1px solid #fff;opacity:.9;font-size:13px;text-align:center;white-space:normal}.ExternalLink-module_tooltip__18MpC>span{display:block;color:#fff;text-decoration:underline}.ExternalLinkList-module_ext_links_container__16IIo{display:flex;flex-wrap:wrap;border-collapse:separate;border-spacing:10px;min-height:240px;width:auto;height:auto;pointer-events:all;position:relative;transition:opacity .5s;transition-timing-function:cubic-bezier(.1,.57,.1,1);transition-duration:0ms}.DataWrapperChart-module_container__2eZ15{min-height:200px;background-color:rgba(0,0,0,.5)}.DataWrapperChart-module_container__2eZ15>iframe{width:100%;height:100%;position:relative;top:0}
|
@@ -0,0 +1,878 @@
|
|
1
|
+
import { useContentElementConfigurationUpdate, useI18n, withShadowClassName, Text, EditableInlineText, frontend, useFile, useContentElementEditorState, ViewportDependentPillarBoxes, useContentElementLifecycle, Figure, Image, usePlayerState, MediaInteractionTracking, VideoPlayer, VideoPlayerControls, AudioPlayer, AudioPlayerControls, EditableText, useDarkBackground } from 'pageflow-scrolled/frontend';
|
2
|
+
import React, { useRef, useState, useEffect } from 'react';
|
3
|
+
import classNames from 'classnames';
|
4
|
+
import ReactCompareImage from 'react-compare-image';
|
5
|
+
import { media } from 'pageflow/frontend';
|
6
|
+
import ReactPlayer from 'react-player';
|
7
|
+
|
8
|
+
function _defineProperty(obj, key, value) {
|
9
|
+
if (key in obj) {
|
10
|
+
Object.defineProperty(obj, key, {
|
11
|
+
value: value,
|
12
|
+
enumerable: true,
|
13
|
+
configurable: true,
|
14
|
+
writable: true
|
15
|
+
});
|
16
|
+
} else {
|
17
|
+
obj[key] = value;
|
18
|
+
}
|
19
|
+
|
20
|
+
return obj;
|
21
|
+
}
|
22
|
+
|
23
|
+
var styles = {"root":"Heading-module_root__33TFw","first":"Heading-module_first__1PMJX"};
|
24
|
+
|
25
|
+
function Heading(_ref) {
|
26
|
+
var configuration = _ref.configuration,
|
27
|
+
sectionProps = _ref.sectionProps;
|
28
|
+
var level = configuration.level || sectionProps.sectionIndex;
|
29
|
+
var firstSectionInEntry = level === 0;
|
30
|
+
var updateConfiguration = useContentElementConfigurationUpdate();
|
31
|
+
|
32
|
+
var _useI18n = useI18n({
|
33
|
+
locale: 'ui'
|
34
|
+
}),
|
35
|
+
t = _useI18n.t;
|
36
|
+
|
37
|
+
var legacyValue = configuration.children;
|
38
|
+
return (
|
39
|
+
/*#__PURE__*/
|
40
|
+
React.createElement("h1", {
|
41
|
+
className: classNames(styles.root, _defineProperty({}, styles.first, firstSectionInEntry), _defineProperty({}, withShadowClassName, !sectionProps.invert))
|
42
|
+
},
|
43
|
+
/*#__PURE__*/
|
44
|
+
React.createElement(Text, {
|
45
|
+
scaleCategory: firstSectionInEntry ? 'h1' : 'h2',
|
46
|
+
inline: true
|
47
|
+
},
|
48
|
+
/*#__PURE__*/
|
49
|
+
React.createElement(EditableInlineText, {
|
50
|
+
value: configuration.value,
|
51
|
+
defaultValue: legacyValue,
|
52
|
+
placeholder: t('pageflow_scrolled.inline_editing.type_heading'),
|
53
|
+
onChange: function onChange(value) {
|
54
|
+
return updateConfiguration({
|
55
|
+
value: value
|
56
|
+
});
|
57
|
+
}
|
58
|
+
})))
|
59
|
+
);
|
60
|
+
}
|
61
|
+
|
62
|
+
frontend.contentElementTypes.register('heading', {
|
63
|
+
component: Heading
|
64
|
+
});
|
65
|
+
|
66
|
+
function ownKeys(object, enumerableOnly) {
|
67
|
+
var keys = Object.keys(object);
|
68
|
+
|
69
|
+
if (Object.getOwnPropertySymbols) {
|
70
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
71
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
72
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
73
|
+
});
|
74
|
+
keys.push.apply(keys, symbols);
|
75
|
+
}
|
76
|
+
|
77
|
+
return keys;
|
78
|
+
}
|
79
|
+
|
80
|
+
function _objectSpread2(target) {
|
81
|
+
for (var i = 1; i < arguments.length; i++) {
|
82
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
83
|
+
|
84
|
+
if (i % 2) {
|
85
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
86
|
+
_defineProperty(target, key, source[key]);
|
87
|
+
});
|
88
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
89
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
90
|
+
} else {
|
91
|
+
ownKeys(Object(source)).forEach(function (key) {
|
92
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
93
|
+
});
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
return target;
|
98
|
+
}
|
99
|
+
|
100
|
+
function _arrayWithHoles(arr) {
|
101
|
+
if (Array.isArray(arr)) return arr;
|
102
|
+
}
|
103
|
+
|
104
|
+
function _iterableToArrayLimit(arr, i) {
|
105
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
106
|
+
var _arr = [];
|
107
|
+
var _n = true;
|
108
|
+
var _d = false;
|
109
|
+
var _e = undefined;
|
110
|
+
|
111
|
+
try {
|
112
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
113
|
+
_arr.push(_s.value);
|
114
|
+
|
115
|
+
if (i && _arr.length === i) break;
|
116
|
+
}
|
117
|
+
} catch (err) {
|
118
|
+
_d = true;
|
119
|
+
_e = err;
|
120
|
+
} finally {
|
121
|
+
try {
|
122
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
123
|
+
} finally {
|
124
|
+
if (_d) throw _e;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
return _arr;
|
129
|
+
}
|
130
|
+
|
131
|
+
function _arrayLikeToArray(arr, len) {
|
132
|
+
if (len == null || len > arr.length) len = arr.length;
|
133
|
+
|
134
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
135
|
+
arr2[i] = arr[i];
|
136
|
+
}
|
137
|
+
|
138
|
+
return arr2;
|
139
|
+
}
|
140
|
+
|
141
|
+
function _unsupportedIterableToArray(o, minLen) {
|
142
|
+
if (!o) return;
|
143
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
144
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
145
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
146
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
147
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
148
|
+
}
|
149
|
+
|
150
|
+
function _nonIterableRest() {
|
151
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
152
|
+
}
|
153
|
+
|
154
|
+
function _slicedToArray(arr, i) {
|
155
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
156
|
+
}
|
157
|
+
|
158
|
+
var styles$1 = {"sliderStart":"BeforeAfter-module_sliderStart__2C5cN","container":"BeforeAfter-module_container__2Lm06","wiggle":"BeforeAfter-module_wiggle__3nVSe","SliderLeftRightShake":"BeforeAfter-module_SliderLeftRightShake__2mcn5","BeforeImageLeftRightShake":"BeforeAfter-module_BeforeImageLeftRightShake__38m9V","AfterImageLeftRightShake":"BeforeAfter-module_AfterImageLeftRightShake__3WMf1"};
|
159
|
+
|
160
|
+
var placeholderForBeforeImage = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQwIiBoZWlnaHQ9IjQwMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KIDwhLS0gQ3JlYXRlZCB3aXRoIE1ldGhvZCBEcmF3IC0gaHR0cDovL2dpdGh1Yi5jb20vZHVvcGl4ZWwvTWV0aG9kLURyYXcvIC0tPgogPGc+CiAgPHRpdGxlPmJhY2tncm91bmQ8L3RpdGxlPgogIDxyZWN0IGZpbGw9IiMzZDVhODAiIGlkPSJjYW52YXNfYmFja2dyb3VuZCIgaGVpZ2h0PSI0MDUiIHdpZHRoPSI2NDIiIHk9Ii0xIiB4PSItMSIvPgogIDxnIGRpc3BsYXk9Im5vbmUiIG92ZXJmbG93PSJ2aXNpYmxlIiB5PSIwIiB4PSIwIiBoZWlnaHQ9IjEwMCUiIHdpZHRoPSIxMDAlIiBpZD0iY2FudmFzR3JpZCI+CiAgIDxyZWN0IGZpbGw9InVybCgjZ3JpZHBhdHRlcm4pIiBzdHJva2Utd2lkdGg9IjAiIHk9IjAiIHg9IjAiIGhlaWdodD0iMTAwJSIgd2lkdGg9IjEwMCUiLz4KICA8L2c+CiA8L2c+CiA8Zz4KICA8dGl0bGU+TGF5ZXIgMTwvdGl0bGU+CiA8L2c+Cjwvc3ZnPg==';
|
161
|
+
var placeholderForAfterImage = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQwIiBoZWlnaHQ9IjQwMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KIDwhLS0gQ3JlYXRlZCB3aXRoIE1ldGhvZCBEcmF3IC0gaHR0cDovL2dpdGh1Yi5jb20vZHVvcGl4ZWwvTWV0aG9kLURyYXcvIC0tPgogPGc+CiAgPHRpdGxlPmJhY2tncm91bmQ8L3RpdGxlPgogIDxyZWN0IGZpbGw9IiM5OGMxZDkiIGlkPSJjYW52YXNfYmFja2dyb3VuZCIgaGVpZ2h0PSI0MDUiIHdpZHRoPSI2NDIiIHk9Ii0xIiB4PSItMSIvPgogIDxnIGRpc3BsYXk9Im5vbmUiIG92ZXJmbG93PSJ2aXNpYmxlIiB5PSIwIiB4PSIwIiBoZWlnaHQ9IjEwMCUiIHdpZHRoPSIxMDAlIiBpZD0iY2FudmFzR3JpZCI+CiAgIDxyZWN0IGZpbGw9InVybCgjZ3JpZHBhdHRlcm4pIiBzdHJva2Utd2lkdGg9IjAiIHk9IjAiIHg9IjAiIGhlaWdodD0iMTAwJSIgd2lkdGg9IjEwMCUiLz4KICA8L2c+CiA8L2c+CiA8Zz4KICA8dGl0bGU+TGF5ZXIgMTwvdGl0bGU+CiA8L2c+Cjwvc3ZnPg==';
|
162
|
+
var placeholderFile = {
|
163
|
+
width: 640,
|
164
|
+
height: 403
|
165
|
+
};
|
166
|
+
function BeforeAfter(_ref) {
|
167
|
+
var _cx;
|
168
|
+
|
169
|
+
var isActive = _ref.isActive,
|
170
|
+
isPrepared = _ref.isPrepared,
|
171
|
+
position = _ref.position,
|
172
|
+
before_id = _ref.before_id,
|
173
|
+
before_label = _ref.before_label,
|
174
|
+
after_id = _ref.after_id,
|
175
|
+
after_label = _ref.after_label,
|
176
|
+
initial_slider_position = _ref.initial_slider_position,
|
177
|
+
slider = _ref.slider,
|
178
|
+
slider_color = _ref.slider_color,
|
179
|
+
slider_handle = _ref.slider_handle;
|
180
|
+
var beforeAfterRef = useRef();
|
181
|
+
var current = beforeAfterRef.current;
|
182
|
+
|
183
|
+
var _useState = useState(false),
|
184
|
+
_useState2 = _slicedToArray(_useState, 2),
|
185
|
+
wiggled = _useState2[0],
|
186
|
+
setWiggled = _useState2[1];
|
187
|
+
|
188
|
+
var _useState3 = useState(false),
|
189
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
190
|
+
wiggle = _useState4[0],
|
191
|
+
setWiggle = _useState4[1];
|
192
|
+
|
193
|
+
useEffect(function () {
|
194
|
+
var node = current;
|
195
|
+
|
196
|
+
if (node) {
|
197
|
+
// Only wiggle once per element, when it is active for the first
|
198
|
+
// time
|
199
|
+
var shouldWiggle = !wiggled && isActive;
|
200
|
+
setWiggle(shouldWiggle); // If wiggle was just set, mark this element as one that already
|
201
|
+
// wiggled
|
202
|
+
|
203
|
+
!wiggled && setWiggled(shouldWiggle);
|
204
|
+
}
|
205
|
+
}, [isActive, current]);
|
206
|
+
var beforeImage = useFile({
|
207
|
+
collectionName: 'imageFiles',
|
208
|
+
permaId: before_id
|
209
|
+
});
|
210
|
+
var afterImage = useFile({
|
211
|
+
collectionName: 'imageFiles',
|
212
|
+
permaId: after_id
|
213
|
+
});
|
214
|
+
|
215
|
+
var _useContentElementEdi = useContentElementEditorState(),
|
216
|
+
isSelected = _useContentElementEdi.isSelected;
|
217
|
+
|
218
|
+
var beforeImageUrl = beforeImage && beforeImage.urls.large;
|
219
|
+
var beforeImageAlt = beforeImage && beforeImage.configuration.alt;
|
220
|
+
var afterImageUrl = afterImage && afterImage.urls.large;
|
221
|
+
var afterImageAlt = afterImage && afterImage.configuration.alt;
|
222
|
+
var initialSliderPos = initial_slider_position / 100;
|
223
|
+
var opts = {}; // Transform slider-related props into the format that
|
224
|
+
// react-compare-image needs
|
225
|
+
|
226
|
+
if (!slider) {
|
227
|
+
opts = _objectSpread2(_objectSpread2({}, opts), {}, {
|
228
|
+
sliderLineWidth: 0,
|
229
|
+
handle:
|
230
|
+
/*#__PURE__*/
|
231
|
+
React.createElement(React.Fragment, null)
|
232
|
+
});
|
233
|
+
}
|
234
|
+
|
235
|
+
if (slider) {
|
236
|
+
if (!slider_handle) {
|
237
|
+
opts = _objectSpread2(_objectSpread2({}, opts), {}, {
|
238
|
+
handle:
|
239
|
+
/*#__PURE__*/
|
240
|
+
React.createElement(React.Fragment, null)
|
241
|
+
});
|
242
|
+
}
|
243
|
+
|
244
|
+
if (slider_color) {
|
245
|
+
opts = _objectSpread2(_objectSpread2({}, opts), {}, {
|
246
|
+
sliderLineColor: slider_color
|
247
|
+
});
|
248
|
+
}
|
249
|
+
} //Since the slider wiggle only the first time, set the variable once for performance purpose.
|
250
|
+
|
251
|
+
|
252
|
+
useEffect(function () {
|
253
|
+
if (beforeAfterRef.current) {
|
254
|
+
// Compute initial slider coordinate and pass it as a CSS
|
255
|
+
// variable, so that before/after images can wiggle together with
|
256
|
+
// the slider
|
257
|
+
var containerWidth = beforeAfterRef.current.getBoundingClientRect().width;
|
258
|
+
var initialRectWidth = initialSliderPos * containerWidth;
|
259
|
+
beforeAfterRef.current.style.setProperty('--initial-rect-width', initialRectWidth + 'px');
|
260
|
+
}
|
261
|
+
}, [wiggled, initialSliderPos]);
|
262
|
+
return (
|
263
|
+
/*#__PURE__*/
|
264
|
+
React.createElement(ViewportDependentPillarBoxes, {
|
265
|
+
file: beforeImage || afterImage || placeholderFile,
|
266
|
+
position: position
|
267
|
+
},
|
268
|
+
/*#__PURE__*/
|
269
|
+
React.createElement("div", {
|
270
|
+
ref: beforeAfterRef,
|
271
|
+
className: classNames((_cx = {}, _defineProperty(_cx, styles$1.selected, isSelected), _defineProperty(_cx, styles$1.wiggle, wiggle), _cx), styles$1.container)
|
272
|
+
},
|
273
|
+
/*#__PURE__*/
|
274
|
+
React.createElement(InitialSliderPositionIndicator, {
|
275
|
+
parentSelected: isSelected,
|
276
|
+
position: initial_slider_position
|
277
|
+
}), renderCompareImage()))
|
278
|
+
);
|
279
|
+
|
280
|
+
function renderCompareImage() {
|
281
|
+
if (!isPrepared) {
|
282
|
+
return null;
|
283
|
+
}
|
284
|
+
|
285
|
+
return (
|
286
|
+
/*#__PURE__*/
|
287
|
+
React.createElement(ReactCompareImage, Object.assign({
|
288
|
+
leftImage: beforeImage ? beforeImageUrl : placeholderForBeforeImage,
|
289
|
+
rightImage: afterImage ? afterImageUrl : placeholderForAfterImage,
|
290
|
+
leftImageLabel: before_label,
|
291
|
+
rightImageLabel: after_label,
|
292
|
+
leftImageAlt: beforeImageAlt,
|
293
|
+
rightImageAlt: afterImageAlt,
|
294
|
+
sliderPositionPercentage: initialSliderPos,
|
295
|
+
onSliderPositionChange: function onSliderPositionChange() {
|
296
|
+
return setWiggle(false);
|
297
|
+
}
|
298
|
+
}, opts))
|
299
|
+
);
|
300
|
+
}
|
301
|
+
}
|
302
|
+
|
303
|
+
function InitialSliderPositionIndicator(_ref2) {
|
304
|
+
var parentSelected = _ref2.parentSelected,
|
305
|
+
position = _ref2.position;
|
306
|
+
var indicatorWidth = '2px';
|
307
|
+
var indicatorStyles = {
|
308
|
+
left: "calc(".concat(position, "% - ").concat(indicatorWidth, "/2)"),
|
309
|
+
width: "".concat(indicatorWidth),
|
310
|
+
height: '100%',
|
311
|
+
borderLeft: '1px solid black',
|
312
|
+
borderRight: '1px solid black'
|
313
|
+
}; // In case this element is selected, and its initial slider position
|
314
|
+
// is not in the middle, we show InitialSliderPositionIndicator
|
315
|
+
|
316
|
+
return parentSelected && position !== 50 ?
|
317
|
+
/*#__PURE__*/
|
318
|
+
React.createElement("div", {
|
319
|
+
className: styles$1.sliderStart,
|
320
|
+
style: indicatorStyles
|
321
|
+
}) : '';
|
322
|
+
}
|
323
|
+
|
324
|
+
function InlineBeforeAfter(props) {
|
325
|
+
var _useContentElementLif = useContentElementLifecycle(),
|
326
|
+
isActive = _useContentElementLif.isActive,
|
327
|
+
isPrepared = _useContentElementLif.isPrepared;
|
328
|
+
|
329
|
+
return (
|
330
|
+
/*#__PURE__*/
|
331
|
+
React.createElement(BeforeAfter, Object.assign({}, props.configuration, {
|
332
|
+
isPrepared: isPrepared,
|
333
|
+
isActive: isActive
|
334
|
+
}))
|
335
|
+
);
|
336
|
+
}
|
337
|
+
|
338
|
+
frontend.contentElementTypes.register('inlineBeforeAfter', {
|
339
|
+
component: InlineBeforeAfter,
|
340
|
+
lifecycle: true
|
341
|
+
});
|
342
|
+
|
343
|
+
function InlineImage(_ref) {
|
344
|
+
var configuration = _ref.configuration;
|
345
|
+
|
346
|
+
var _useContentElementLif = useContentElementLifecycle(),
|
347
|
+
isPrepared = _useContentElementLif.isPrepared;
|
348
|
+
|
349
|
+
var imageFile = useFile({
|
350
|
+
collectionName: 'imageFiles',
|
351
|
+
permaId: configuration.id
|
352
|
+
});
|
353
|
+
return (
|
354
|
+
/*#__PURE__*/
|
355
|
+
React.createElement(Figure, {
|
356
|
+
caption: configuration.caption
|
357
|
+
},
|
358
|
+
/*#__PURE__*/
|
359
|
+
React.createElement(ViewportDependentPillarBoxes, {
|
360
|
+
file: imageFile,
|
361
|
+
aspectRatio: imageFile ? undefined : 0.75,
|
362
|
+
position: configuration.position,
|
363
|
+
opaque: !!configuration.caption
|
364
|
+
},
|
365
|
+
/*#__PURE__*/
|
366
|
+
React.createElement(Image, Object.assign({}, configuration, {
|
367
|
+
isPrepared: isPrepared,
|
368
|
+
structuredData: true,
|
369
|
+
variant: configuration.position === 'full' ? 'large' : 'medium'
|
370
|
+
}))))
|
371
|
+
);
|
372
|
+
}
|
373
|
+
|
374
|
+
frontend.contentElementTypes.register('inlineImage', {
|
375
|
+
component: InlineImage,
|
376
|
+
lifecycle: true
|
377
|
+
});
|
378
|
+
|
379
|
+
function InlineVideo(_ref) {
|
380
|
+
var sectionProps = _ref.sectionProps,
|
381
|
+
configuration = _ref.configuration;
|
382
|
+
|
383
|
+
var _usePlayerState = usePlayerState(),
|
384
|
+
_usePlayerState2 = _slicedToArray(_usePlayerState, 2),
|
385
|
+
playerState = _usePlayerState2[0],
|
386
|
+
playerActions = _usePlayerState2[1];
|
387
|
+
|
388
|
+
var _useContentElementEdi = useContentElementEditorState(),
|
389
|
+
isEditable = _useContentElementEdi.isEditable,
|
390
|
+
isSelected = _useContentElementEdi.isSelected;
|
391
|
+
|
392
|
+
var _useContentElementLif = useContentElementLifecycle({
|
393
|
+
onActivate: function onActivate() {
|
394
|
+
if (configuration.autoplay) {
|
395
|
+
playerActions.play();
|
396
|
+
}
|
397
|
+
},
|
398
|
+
onDeactivate: function onDeactivate() {
|
399
|
+
playerActions.fadeOutAndPause(400);
|
400
|
+
}
|
401
|
+
}),
|
402
|
+
isPrepared = _useContentElementLif.isPrepared;
|
403
|
+
|
404
|
+
var onPlayerClick = function onPlayerClick() {
|
405
|
+
if (isEditable && !isSelected) {
|
406
|
+
return;
|
407
|
+
}
|
408
|
+
|
409
|
+
if (!playerState.shouldPlay || media.muted) {
|
410
|
+
playerActions.playBlessed();
|
411
|
+
} else {
|
412
|
+
playerActions.pause();
|
413
|
+
}
|
414
|
+
};
|
415
|
+
|
416
|
+
return (
|
417
|
+
/*#__PURE__*/
|
418
|
+
React.createElement(Figure, {
|
419
|
+
caption: configuration.caption
|
420
|
+
},
|
421
|
+
/*#__PURE__*/
|
422
|
+
React.createElement(MediaInteractionTracking, {
|
423
|
+
playerState: playerState,
|
424
|
+
playerActions: playerActions
|
425
|
+
},
|
426
|
+
/*#__PURE__*/
|
427
|
+
React.createElement(VideoPlayer, {
|
428
|
+
isPrepared: isPrepared,
|
429
|
+
position: configuration.position,
|
430
|
+
controls: configuration.controls,
|
431
|
+
playerState: playerState,
|
432
|
+
playerActions: playerActions,
|
433
|
+
id: configuration.id,
|
434
|
+
posterId: configuration.posterId,
|
435
|
+
defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
|
436
|
+
quality: 'high',
|
437
|
+
playsInline: true,
|
438
|
+
atmoDuringPlayback: configuration.atmoDuringPlayback,
|
439
|
+
onClick: onPlayerClick
|
440
|
+
}),
|
441
|
+
/*#__PURE__*/
|
442
|
+
React.createElement(VideoPlayerControls, {
|
443
|
+
videoFilePermaId: configuration.id,
|
444
|
+
defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
|
445
|
+
playerState: playerState,
|
446
|
+
playerActions: playerActions,
|
447
|
+
configuration: configuration,
|
448
|
+
sectionProps: sectionProps
|
449
|
+
})))
|
450
|
+
);
|
451
|
+
}
|
452
|
+
|
453
|
+
frontend.contentElementTypes.register('inlineVideo', {
|
454
|
+
component: InlineVideo,
|
455
|
+
lifecycle: true
|
456
|
+
});
|
457
|
+
|
458
|
+
function InlineAudio(_ref) {
|
459
|
+
var sectionProps = _ref.sectionProps,
|
460
|
+
configuration = _ref.configuration;
|
461
|
+
|
462
|
+
var _usePlayerState = usePlayerState(),
|
463
|
+
_usePlayerState2 = _slicedToArray(_usePlayerState, 2),
|
464
|
+
playerState = _usePlayerState2[0],
|
465
|
+
playerActions = _usePlayerState2[1];
|
466
|
+
|
467
|
+
var _useContentElementEdi = useContentElementEditorState(),
|
468
|
+
isEditable = _useContentElementEdi.isEditable,
|
469
|
+
isSelected = _useContentElementEdi.isSelected;
|
470
|
+
|
471
|
+
var _useContentElementLif = useContentElementLifecycle({
|
472
|
+
onActivate: function onActivate() {
|
473
|
+
if (configuration.autoplay && !media.muted) {
|
474
|
+
playerActions.play();
|
475
|
+
}
|
476
|
+
},
|
477
|
+
onDeactivate: function onDeactivate() {
|
478
|
+
playerActions.pause();
|
479
|
+
}
|
480
|
+
}),
|
481
|
+
isPrepared = _useContentElementLif.isPrepared;
|
482
|
+
|
483
|
+
var onPlayerClick = function onPlayerClick() {
|
484
|
+
if (isEditable && !isSelected) {
|
485
|
+
return;
|
486
|
+
}
|
487
|
+
|
488
|
+
if (playerState.shouldPlay) {
|
489
|
+
playerActions.pause();
|
490
|
+
} else {
|
491
|
+
playerActions.playBlessed();
|
492
|
+
}
|
493
|
+
};
|
494
|
+
|
495
|
+
return (
|
496
|
+
/*#__PURE__*/
|
497
|
+
React.createElement(Figure, {
|
498
|
+
caption: configuration.caption
|
499
|
+
},
|
500
|
+
/*#__PURE__*/
|
501
|
+
React.createElement(AudioPlayer, {
|
502
|
+
isPrepared: isPrepared,
|
503
|
+
position: configuration.position,
|
504
|
+
controls: configuration.controls,
|
505
|
+
playerState: playerState,
|
506
|
+
playerActions: playerActions,
|
507
|
+
id: configuration.id,
|
508
|
+
posterId: configuration.posterId,
|
509
|
+
defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
|
510
|
+
quality: 'high',
|
511
|
+
playsInline: true,
|
512
|
+
atmoDuringPlayback: configuration.atmoDuringPlayback,
|
513
|
+
onClick: onPlayerClick
|
514
|
+
}),
|
515
|
+
/*#__PURE__*/
|
516
|
+
React.createElement(AudioPlayerControls, {
|
517
|
+
audioFilePermaId: configuration.id,
|
518
|
+
defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
|
519
|
+
playerState: playerState,
|
520
|
+
playerActions: playerActions,
|
521
|
+
configuration: configuration,
|
522
|
+
sectionProps: sectionProps
|
523
|
+
}))
|
524
|
+
);
|
525
|
+
}
|
526
|
+
|
527
|
+
frontend.contentElementTypes.register('inlineAudio', {
|
528
|
+
component: InlineAudio,
|
529
|
+
lifecycle: true
|
530
|
+
});
|
531
|
+
|
532
|
+
var styles$2 = {"soundDisclaimer":"SoundDisclaimer-module_soundDisclaimer__31hWh"};
|
533
|
+
|
534
|
+
function SoundDisclaimer() {
|
535
|
+
var _useI18n = useI18n(),
|
536
|
+
t = _useI18n.t;
|
537
|
+
|
538
|
+
return (
|
539
|
+
/*#__PURE__*/
|
540
|
+
React.createElement("div", {
|
541
|
+
className: classNames(styles$2.soundDisclaimer),
|
542
|
+
onClick: function onClick() {
|
543
|
+
return media.mute(false);
|
544
|
+
}
|
545
|
+
},
|
546
|
+
/*#__PURE__*/
|
547
|
+
React.createElement("p", {
|
548
|
+
dangerouslySetInnerHTML: {
|
549
|
+
__html: t('pageflow_scrolled.public.sound_disclaimer.help_text')
|
550
|
+
}
|
551
|
+
}))
|
552
|
+
);
|
553
|
+
}
|
554
|
+
|
555
|
+
frontend.contentElementTypes.register('soundDisclaimer', {
|
556
|
+
component: SoundDisclaimer
|
557
|
+
});
|
558
|
+
|
559
|
+
var styles$3 = {"text":"TextBlock-module_text__21Hk4"};
|
560
|
+
|
561
|
+
function TextBlock(props) {
|
562
|
+
var updateConfiguration = useContentElementConfigurationUpdate();
|
563
|
+
|
564
|
+
var _useI18n = useI18n({
|
565
|
+
locale: 'ui'
|
566
|
+
}),
|
567
|
+
t = _useI18n.t;
|
568
|
+
|
569
|
+
return (
|
570
|
+
/*#__PURE__*/
|
571
|
+
React.createElement("div", {
|
572
|
+
className: styles$3.text
|
573
|
+
},
|
574
|
+
/*#__PURE__*/
|
575
|
+
React.createElement(EditableText, {
|
576
|
+
value: props.configuration.value,
|
577
|
+
contentElementId: props.contentElementId,
|
578
|
+
placeholder: t('pageflow_scrolled.inline_editing.type_text'),
|
579
|
+
onChange: function onChange(value) {
|
580
|
+
return updateConfiguration({
|
581
|
+
value: value
|
582
|
+
});
|
583
|
+
}
|
584
|
+
}))
|
585
|
+
);
|
586
|
+
}
|
587
|
+
|
588
|
+
frontend.contentElementTypes.register('textBlock', {
|
589
|
+
component: TextBlock,
|
590
|
+
customSelectionRect: true
|
591
|
+
});
|
592
|
+
|
593
|
+
var styles$4 = {"VideoEmbed":"VideoEmbed-module_VideoEmbed__3BUjc","embedPlayer":"VideoEmbed-module_embedPlayer__54NKG"};
|
594
|
+
|
595
|
+
var aspectRatios = {
|
596
|
+
wide: 0.5625,
|
597
|
+
narrow: 0.75,
|
598
|
+
square: 1,
|
599
|
+
portrait: 1.7777
|
600
|
+
};
|
601
|
+
function VideoEmbed(_ref) {
|
602
|
+
var configuration = _ref.configuration;
|
603
|
+
|
604
|
+
var _useContentElementLif = useContentElementLifecycle(),
|
605
|
+
isPrepared = _useContentElementLif.isPrepared;
|
606
|
+
|
607
|
+
var _useContentElementEdi = useContentElementEditorState(),
|
608
|
+
isEditable = _useContentElementEdi.isEditable,
|
609
|
+
isSelected = _useContentElementEdi.isSelected; // base64-encoded configuration
|
610
|
+
// => make component re-render on configuration changes
|
611
|
+
|
612
|
+
|
613
|
+
function keyFromConfiguration(config) {
|
614
|
+
return btoa(JSON.stringify(config));
|
615
|
+
}
|
616
|
+
|
617
|
+
function renderPlayer() {
|
618
|
+
if (!isPrepared) {
|
619
|
+
return null;
|
620
|
+
}
|
621
|
+
|
622
|
+
return (
|
623
|
+
/*#__PURE__*/
|
624
|
+
React.createElement(ReactPlayer, {
|
625
|
+
className: styles$4.embedPlayer,
|
626
|
+
key: keyFromConfiguration(configuration),
|
627
|
+
url: configuration.videoSource,
|
628
|
+
playing: true,
|
629
|
+
light: true,
|
630
|
+
width: "100%",
|
631
|
+
height: "100%",
|
632
|
+
controls: !configuration.hideControls,
|
633
|
+
config: {
|
634
|
+
youtube: {
|
635
|
+
playerVars: {
|
636
|
+
showinfo: !configuration.hideInfo
|
637
|
+
}
|
638
|
+
},
|
639
|
+
vimeo: {
|
640
|
+
playerOptions: {
|
641
|
+
byline: !configuration.hideInfo
|
642
|
+
}
|
643
|
+
}
|
644
|
+
}
|
645
|
+
})
|
646
|
+
);
|
647
|
+
}
|
648
|
+
|
649
|
+
return (
|
650
|
+
/*#__PURE__*/
|
651
|
+
React.createElement("div", {
|
652
|
+
className: styles$4.VideoEmbed,
|
653
|
+
style: {
|
654
|
+
pointerEvents: isEditable && !isSelected ? 'none' : undefined
|
655
|
+
}
|
656
|
+
},
|
657
|
+
/*#__PURE__*/
|
658
|
+
React.createElement(Figure, {
|
659
|
+
caption: configuration.caption
|
660
|
+
},
|
661
|
+
/*#__PURE__*/
|
662
|
+
React.createElement(ViewportDependentPillarBoxes, {
|
663
|
+
aspectRatio: aspectRatios[configuration.aspectRatio || 'wide'],
|
664
|
+
position: configuration.position,
|
665
|
+
opaque: !!configuration.caption
|
666
|
+
}, renderPlayer())))
|
667
|
+
);
|
668
|
+
}
|
669
|
+
|
670
|
+
frontend.contentElementTypes.register('videoEmbed', {
|
671
|
+
component: VideoEmbed,
|
672
|
+
lifecycle: true
|
673
|
+
});
|
674
|
+
|
675
|
+
var styles$5 = {"hidden":"ExternalLink-module_hidden__3jer0","link_item":"ExternalLink-module_link_item__Blypv","invert":"ExternalLink-module_invert__1zrgN","layout_center":"ExternalLink-module_layout_center__3NRpQ","link_title":"ExternalLink-module_link_title__FZJ-0","link_thumbnail":"ExternalLink-module_link_thumbnail__2_BHq","link_details":"ExternalLink-module_link_details__lRhKU","link_desc":"ExternalLink-module_link_desc__3fSe1","tooltip":"ExternalLink-module_tooltip__18MpC"};
|
676
|
+
|
677
|
+
function ExternalLink(props) {
|
678
|
+
var _classNames2;
|
679
|
+
|
680
|
+
var _useState = useState(true),
|
681
|
+
_useState2 = _slicedToArray(_useState, 2),
|
682
|
+
hideTooltip = _useState2[0],
|
683
|
+
setHideTooltip = _useState2[1];
|
684
|
+
|
685
|
+
var layout = props.sectionProps.layout;
|
686
|
+
|
687
|
+
var _useI18n = useI18n({
|
688
|
+
locale: 'ui'
|
689
|
+
}),
|
690
|
+
t = _useI18n.t;
|
691
|
+
|
692
|
+
var _useContentElementEdi = useContentElementEditorState(),
|
693
|
+
isEditable = _useContentElementEdi.isEditable,
|
694
|
+
isSelected = _useContentElementEdi.isSelected;
|
695
|
+
|
696
|
+
var onClick = function onClick(event) {
|
697
|
+
if (isEditable) {
|
698
|
+
if (!props.open_in_new_tab || !isSelected) {
|
699
|
+
event.preventDefault();
|
700
|
+
}
|
701
|
+
|
702
|
+
if (!props.open_in_new_tab && isSelected) {
|
703
|
+
setHideTooltip(false);
|
704
|
+
}
|
705
|
+
}
|
706
|
+
};
|
707
|
+
|
708
|
+
var onMouseLeave = function onMouseLeave() {
|
709
|
+
setHideTooltip(true);
|
710
|
+
};
|
711
|
+
|
712
|
+
function renderNewTabTooltip() {
|
713
|
+
if (isEditable) {
|
714
|
+
var onTooltipClick = function onTooltipClick() {
|
715
|
+
window.open(props.url, '_blank');
|
716
|
+
setHideTooltip(true);
|
717
|
+
};
|
718
|
+
|
719
|
+
return (
|
720
|
+
/*#__PURE__*/
|
721
|
+
React.createElement("div", {
|
722
|
+
className: classNames(_defineProperty({}, styles$5.hidden, hideTooltip), styles$5.tooltip),
|
723
|
+
onClick: onTooltipClick
|
724
|
+
}, t('pageflow_scrolled.inline_editing.external_links.open_in_new_tab_message'),
|
725
|
+
/*#__PURE__*/
|
726
|
+
React.createElement("span", null, t('pageflow_scrolled.inline_editing.external_links.open_in_new_tab')))
|
727
|
+
);
|
728
|
+
}
|
729
|
+
}
|
730
|
+
|
731
|
+
return (
|
732
|
+
/*#__PURE__*/
|
733
|
+
React.createElement("a", {
|
734
|
+
className: classNames(styles$5.link_item, (_classNames2 = {}, _defineProperty(_classNames2, styles$5.invert, props.invert), _defineProperty(_classNames2, styles$5.layout_center, layout === 'center'), _classNames2)),
|
735
|
+
href: props.url || 'about:blank',
|
736
|
+
onClick: onClick,
|
737
|
+
onMouseLeave: onMouseLeave,
|
738
|
+
target: props.open_in_new_tab ? '_blank' : '_self'
|
739
|
+
},
|
740
|
+
/*#__PURE__*/
|
741
|
+
React.createElement("div", {
|
742
|
+
className: styles$5.link_thumbnail
|
743
|
+
},
|
744
|
+
/*#__PURE__*/
|
745
|
+
React.createElement(Image, {
|
746
|
+
id: props.thumbnail,
|
747
|
+
isPrepared: props.isPrepared,
|
748
|
+
variant: "linkThumbnailLarge"
|
749
|
+
})),
|
750
|
+
/*#__PURE__*/
|
751
|
+
React.createElement("div", {
|
752
|
+
className: styles$5.link_details
|
753
|
+
},
|
754
|
+
/*#__PURE__*/
|
755
|
+
React.createElement("p", {
|
756
|
+
className: styles$5.link_title
|
757
|
+
}, props.title),
|
758
|
+
/*#__PURE__*/
|
759
|
+
React.createElement("p", {
|
760
|
+
className: styles$5.link_desc
|
761
|
+
}, props.description)), renderNewTabTooltip())
|
762
|
+
);
|
763
|
+
}
|
764
|
+
|
765
|
+
var styles$6 = {"ext_links_container":"ExternalLinkList-module_ext_links_container__16IIo"};
|
766
|
+
|
767
|
+
function ExternalLinkList(props) {
|
768
|
+
var linkList = props.configuration.links || [];
|
769
|
+
|
770
|
+
var _useContentElementLif = useContentElementLifecycle(),
|
771
|
+
isPrepared = _useContentElementLif.isPrepared;
|
772
|
+
|
773
|
+
var darkBackground = useDarkBackground();
|
774
|
+
return (
|
775
|
+
/*#__PURE__*/
|
776
|
+
React.createElement("div", {
|
777
|
+
className: styles$6.ext_links_container
|
778
|
+
}, linkList.map(function (link, index) {
|
779
|
+
return (
|
780
|
+
/*#__PURE__*/
|
781
|
+
React.createElement(ExternalLink, Object.assign({}, link, {
|
782
|
+
key: link.id,
|
783
|
+
invert: !darkBackground,
|
784
|
+
sectionProps: props.sectionProps,
|
785
|
+
isPrepared: isPrepared
|
786
|
+
}))
|
787
|
+
);
|
788
|
+
}))
|
789
|
+
);
|
790
|
+
}
|
791
|
+
|
792
|
+
frontend.contentElementTypes.register('externalLinkList', {
|
793
|
+
component: ExternalLinkList,
|
794
|
+
lifecycle: true
|
795
|
+
});
|
796
|
+
|
797
|
+
function useIframeHeight(url) {
|
798
|
+
var _useState = useState('400px'),
|
799
|
+
_useState2 = _slicedToArray(_useState, 2),
|
800
|
+
height = _useState2[0],
|
801
|
+
setHeight = _useState2[1];
|
802
|
+
|
803
|
+
useEffect(function () {
|
804
|
+
window.addEventListener('message', receive);
|
805
|
+
|
806
|
+
function receive(event) {
|
807
|
+
if (typeof event.data['datawrapper-height'] !== 'undefined') {
|
808
|
+
for (var chartId in event.data['datawrapper-height']) {
|
809
|
+
if (url.indexOf(chartId) > -1) {
|
810
|
+
setHeight(event.data['datawrapper-height'][chartId] + 'px');
|
811
|
+
}
|
812
|
+
}
|
813
|
+
}
|
814
|
+
}
|
815
|
+
|
816
|
+
return function () {
|
817
|
+
return window.removeEventListener('message', receive);
|
818
|
+
};
|
819
|
+
}, [url]);
|
820
|
+
return height;
|
821
|
+
}
|
822
|
+
|
823
|
+
var styles$7 = {"container":"DataWrapperChart-module_container__2eZ15"};
|
824
|
+
|
825
|
+
function DataWrapperChart(_ref) {
|
826
|
+
var configuration = _ref.configuration;
|
827
|
+
|
828
|
+
var _useContentElementLif = useContentElementLifecycle(),
|
829
|
+
isPrepared = _useContentElementLif.isPrepared;
|
830
|
+
|
831
|
+
var _useContentElementEdi = useContentElementEditorState(),
|
832
|
+
isEditable = _useContentElementEdi.isEditable,
|
833
|
+
isSelected = _useContentElementEdi.isSelected;
|
834
|
+
|
835
|
+
var height = useIframeHeight(configuration.url); // remove url protocol, so that it is selected by the browser itself
|
836
|
+
|
837
|
+
var srcURL = '';
|
838
|
+
|
839
|
+
if (configuration.url && isPrepared) {
|
840
|
+
srcURL = configuration.url.replace(/http(s|):/, '');
|
841
|
+
}
|
842
|
+
|
843
|
+
return (
|
844
|
+
/*#__PURE__*/
|
845
|
+
React.createElement("div", {
|
846
|
+
className: styles$7.container,
|
847
|
+
style: {
|
848
|
+
pointerEvents: isEditable && !isSelected ? 'none' : undefined,
|
849
|
+
height: height
|
850
|
+
},
|
851
|
+
"data-percy": "hide"
|
852
|
+
}, renderIframe(srcURL))
|
853
|
+
);
|
854
|
+
}
|
855
|
+
|
856
|
+
function renderIframe(url) {
|
857
|
+
if (!url) {
|
858
|
+
return null;
|
859
|
+
}
|
860
|
+
|
861
|
+
return (
|
862
|
+
/*#__PURE__*/
|
863
|
+
React.createElement("iframe", {
|
864
|
+
src: url,
|
865
|
+
scrolling: "auto",
|
866
|
+
frameBorder: "0",
|
867
|
+
align: "aus",
|
868
|
+
allowFullScreen: true,
|
869
|
+
mozallowfullscreen: "true",
|
870
|
+
webkitallowfullscreen: "true"
|
871
|
+
})
|
872
|
+
);
|
873
|
+
}
|
874
|
+
|
875
|
+
frontend.contentElementTypes.register('dataWrapperChart', {
|
876
|
+
component: DataWrapperChart,
|
877
|
+
lifecycle: true
|
878
|
+
});
|