pageflow 16.0.0 → 16.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +86 -33
  3. data/README.md +6 -6
  4. data/Rakefile +1 -1
  5. data/admins/pageflow/entry.rb +0 -1
  6. data/admins/pageflow/sites.rb +3 -0
  7. data/app/assets/images/pageflow/admin/icons/published_with_noindex.svg +4 -0
  8. data/app/assets/javascripts/pageflow/dist/ui.js +299 -72
  9. data/app/assets/stylesheets/pageflow/admin/active_admin_patches.scss +1 -1
  10. data/app/assets/stylesheets/pageflow/admin/entries.scss +4 -0
  11. data/app/assets/stylesheets/pageflow/admin/permalink_input.scss +10 -0
  12. data/app/assets/stylesheets/pageflow/admin/publication_state_indicator.scss +4 -0
  13. data/app/assets/stylesheets/pageflow/editor/base.scss +0 -1
  14. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +61 -7
  15. data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +12 -1
  16. data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -0
  17. data/app/assets/stylesheets/pageflow/editor/help.scss +3 -3
  18. data/app/assets/stylesheets/pageflow/editor/info_box.scss +7 -0
  19. data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +0 -5
  20. data/app/assets/stylesheets/pageflow/ui/forms.scss +4 -4
  21. data/app/assets/stylesheets/pageflow/{editor/wysihtml5.scss → ui/input/text_area_input.scss} +13 -1
  22. data/app/assets/stylesheets/pageflow/ui.scss +1 -0
  23. data/app/controllers/pageflow/chapters_controller.rb +2 -2
  24. data/app/controllers/pageflow/editor/entry_publications_controller.rb +5 -1
  25. data/app/controllers/pageflow/editor/file_import_controller.rb +1 -1
  26. data/app/controllers/pageflow/editor/files_controller.rb +1 -1
  27. data/app/controllers/pageflow/entries_controller.rb +12 -2
  28. data/app/controllers/pageflow/feeds_controller.rb +18 -0
  29. data/app/controllers/pageflow/pages_controller.rb +2 -2
  30. data/app/controllers/pageflow/sitemaps_controller.rb +15 -0
  31. data/app/controllers/pageflow/storylines_controller.rb +2 -2
  32. data/app/helpers/pageflow/entries_helper.rb +4 -1
  33. data/app/helpers/pageflow/feeds_helper.rb +66 -0
  34. data/app/helpers/pageflow/meta_tags_helper.rb +2 -1
  35. data/app/helpers/pageflow/page_types_helper.rb +10 -10
  36. data/app/helpers/pageflow/revision_file_helper.rb +3 -3
  37. data/app/helpers/pageflow/social_share_helper.rb +2 -2
  38. data/app/inputs/pageflow_permalink_input.rb +15 -3
  39. data/app/models/concerns/pageflow/entry_publication_states.rb +9 -0
  40. data/app/models/concerns/pageflow/reusable_file.rb +3 -3
  41. data/app/models/concerns/pageflow/uploadable_file.rb +5 -0
  42. data/app/models/pageflow/account.rb +8 -0
  43. data/app/models/pageflow/audio_file_url_templates.rb +2 -1
  44. data/app/models/pageflow/draft_entry.rb +1 -1
  45. data/app/models/pageflow/entries_feed.rb +32 -0
  46. data/app/models/pageflow/entry.rb +7 -5
  47. data/app/models/pageflow/entry_at_revision.rb +2 -0
  48. data/app/models/pageflow/image_file.rb +34 -8
  49. data/app/models/pageflow/image_file_url_templates.rb +7 -1
  50. data/app/models/pageflow/membership.rb +3 -2
  51. data/app/models/pageflow/other_file.rb +5 -0
  52. data/app/models/pageflow/other_file_url_templates.rb +16 -0
  53. data/app/models/pageflow/published_entry.rb +6 -0
  54. data/app/models/pageflow/revision.rb +6 -0
  55. data/app/models/pageflow/site.rb +8 -0
  56. data/app/models/pageflow/sitemaps.rb +14 -0
  57. data/app/models/pageflow/used_file.rb +10 -2
  58. data/app/models/pageflow/video_file_url_templates.rb +3 -1
  59. data/app/models/pageflow/widget.rb +9 -1
  60. data/app/views/admin/entries/_permalink_inputs.html.erb +1 -2
  61. data/app/views/admin/sites/_attributes_table.html.arb +3 -0
  62. data/app/views/admin/sites/_fields.html.erb +6 -0
  63. data/app/views/components/pageflow/admin/extensible_attributes_table.rb +2 -2
  64. data/app/views/components/pageflow/admin/revisions_tab.rb +8 -0
  65. data/app/views/components/pageflow/admin/sites_tab.rb +3 -0
  66. data/app/views/pageflow/editor/config/_seeds.json.jbuilder +2 -0
  67. data/app/views/pageflow/editor/entries/_entry.json.jbuilder +1 -0
  68. data/app/views/pageflow/editor/entry_publications/check.json.jbuilder +1 -0
  69. data/app/views/pageflow/feeds/index.atom.builder +20 -0
  70. data/app/views/pageflow/image_files/_image_file.json.jbuilder +1 -0
  71. data/app/views/pageflow/meta_tags/_entry.html.erb +1 -0
  72. data/app/views/pageflow/sitemaps/index.xml.builder +9 -0
  73. data/config/initializers/features.rb +3 -0
  74. data/config/initializers/paperclip.rb +8 -0
  75. data/config/locales/de.yml +77 -6
  76. data/config/locales/en.yml +79 -4
  77. data/config/routes.rb +3 -0
  78. data/config/spring.rb +1 -1
  79. data/db/migrate/20230120092923_create_other_files.rb +23 -0
  80. data/db/migrate/20230323115745_add_feeds_enabled_to_sites.rb +5 -0
  81. data/db/migrate/20230323154323_add_sitemap_enabled_to_sites.rb +5 -0
  82. data/db/migrate/20230331103823_add_title_to_sites.rb +5 -0
  83. data/db/migrate/20230405103612_add_custom_feed_url_to_sites.rb +5 -0
  84. data/db/migrate/20231024062501_add_output_presences_to_image_files.rb +5 -0
  85. data/db/migrate/20231128124523_add_noindex_to_revisions.rb +5 -0
  86. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +710 -259
  87. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +34 -5
  88. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +1 -1
  89. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +1 -1
  90. data/entry_types/paged/app/controllers/pageflow_paged/editor/entries_controller.rb +0 -2
  91. data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +2 -1
  92. data/entry_types/paged/app/views/pageflow_paged/entries/show.html.erb +1 -0
  93. data/entry_types/paged/config/initializers/features.rb +0 -1
  94. data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -1
  95. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
  96. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +3 -4
  97. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +13 -6
  98. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +11 -3
  99. data/entry_types/scrolled/app/helpers/pageflow_scrolled/cache_helper.rb +11 -0
  100. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/entry_json_seed_helper.rb +42 -0
  101. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +8 -5
  102. data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +17 -12
  103. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +9 -1
  104. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +1 -1
  105. data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +23 -0
  106. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -1
  107. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -5
  108. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/sections/_section_with_content_elements.json.jbuilder +10 -0
  109. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +44 -41
  110. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_consent_vendors.json.jbuilder +16 -0
  111. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +7 -0
  112. data/entry_types/scrolled/config/initializers/features.rb +5 -0
  113. data/entry_types/scrolled/config/locales/consent_widget.de.yml +4 -0
  114. data/entry_types/scrolled/config/locales/consent_widget.en.yml +4 -0
  115. data/entry_types/scrolled/config/locales/de.yml +225 -8
  116. data/entry_types/scrolled/config/locales/en.yml +239 -2
  117. data/entry_types/scrolled/config/routes.rb +4 -0
  118. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +69 -44
  119. data/entry_types/scrolled/lib/pageflow_scrolled/additional_packs.rb +2 -1
  120. data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +1 -1
  121. data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +96 -0
  122. data/entry_types/scrolled/lib/pageflow_scrolled/content_element_consent_vendors.rb +38 -0
  123. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +13 -1
  124. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +30 -0
  125. data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +6 -1
  126. data/entry_types/scrolled/lib/pageflow_scrolled/web_app_manifest.rb +1 -1
  127. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/dummy.rake +1 -1
  128. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +1 -2
  129. data/entry_types/scrolled/package/config/webpack.js +26 -0
  130. data/entry_types/scrolled/package/contentElements-editor.js +330 -32
  131. data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
  132. data/entry_types/scrolled/package/contentElements-frontend.js +920 -145
  133. data/entry_types/scrolled/package/editor.js +819 -239
  134. data/entry_types/scrolled/package/frontend/{EditableInlineText.module-14c7b097.js → EditableInlineText.module-6ee0e024.js} +1975 -1792
  135. data/entry_types/scrolled/package/frontend/PhonePlatformContext-b28d991a.js +32 -0
  136. data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-8242f213.js +107 -0
  137. data/entry_types/scrolled/package/frontend/Viewer-32cd1ac1.js +154 -0
  138. data/entry_types/scrolled/package/frontend/{Viewer-b6becc57.js → Viewer-6e4d14ed.js} +32 -161
  139. data/entry_types/scrolled/package/frontend/arrowRight-e42e6011.js +77 -0
  140. data/entry_types/scrolled/package/frontend/{components-b3160dd7.js → components-24363f97.js} +188 -47
  141. data/entry_types/scrolled/package/frontend/{PhonePlatformContext-f6093cc6.js → i18n-71c39823.js} +191 -111
  142. data/entry_types/scrolled/package/frontend/index-fc4b13e6.js +118 -0
  143. data/entry_types/scrolled/package/frontend/index.css +1 -1
  144. data/entry_types/scrolled/package/frontend/index.js +252 -76
  145. data/entry_types/scrolled/package/frontend/useContentElementEditorState-245f1986.js +52 -0
  146. data/entry_types/scrolled/package/package.json +6 -4
  147. data/entry_types/scrolled/package/testHelpers.js +11 -2
  148. data/entry_types/scrolled/package/values/colors.module.css +15 -0
  149. data/entry_types/scrolled/package/widgets/consentBar.css +1 -0
  150. data/entry_types/scrolled/package/widgets/consentBar.js +426 -0
  151. data/entry_types/scrolled/package/widgets/defaultNavigation.css +2 -2
  152. data/entry_types/scrolled/package/widgets/defaultNavigation.js +39 -4
  153. data/entry_types/scrolled/package/widgets/iconInlineFileRights.css +1 -0
  154. data/entry_types/scrolled/package/widgets/iconInlineFileRights.js +49 -0
  155. data/entry_types/scrolled/package/widgets/textInlineFileRights.css +1 -0
  156. data/entry_types/scrolled/package/widgets/textInlineFileRights.js +37 -0
  157. data/lib/generators/pageflow/resque/resque_generator.rb +1 -1
  158. data/lib/generators/pageflow/resque/templates/resque.rake +1 -1
  159. data/lib/generators/pageflow/resque/templates/resque.rb +1 -1
  160. data/lib/generators/pageflow/routes/routes_generator.rb +1 -1
  161. data/lib/pageflow/ability_mixin.rb +5 -5
  162. data/lib/pageflow/active_admin_can_can_fix.rb +2 -2
  163. data/lib/pageflow/built_in_file_type.rb +7 -0
  164. data/lib/pageflow/configuration.rb +29 -1
  165. data/lib/pageflow/engine.rb +18 -40
  166. data/lib/pageflow/entry_export_import/revision_serialization.rb +1 -1
  167. data/lib/pageflow/file_type.rb +2 -2
  168. data/lib/pageflow/global_config_api.rb +2 -2
  169. data/lib/pageflow/nested_revision_component.rb +23 -5
  170. data/lib/pageflow/page_type.rb +1 -1
  171. data/lib/pageflow/paperclip_processors/webp.rb +63 -0
  172. data/lib/pageflow/rails_version.rb +19 -0
  173. data/lib/pageflow/seeds.rb +10 -7
  174. data/lib/pageflow/user_mixin.rb +1 -1
  175. data/lib/pageflow/version.rb +1 -1
  176. data/lib/pageflow/widget_types.rb +4 -0
  177. data/package/config/jest/index.js +3 -1
  178. data/package/config/webpack5.js +14 -0
  179. data/package/editor.js +410 -181
  180. data/package/frontend.js +34 -4
  181. data/package/testHelpers.js +1 -1
  182. data/package/ui.js +297 -71
  183. data/spec/factories/entries.rb +34 -3
  184. data/spec/factories/sites.rb +3 -0
  185. data/vendor/assets/javascripts/iscroll.js +4 -7
  186. metadata +118 -80
  187. data/app/helpers/pageflow/admin/permalinks_helper.rb +0 -15
  188. data/entry_types/scrolled/package/frontend/arrowRight-78a7cee4.js +0 -42
@@ -1,5 +1,5 @@
1
- import { useContentElementConfigurationUpdate, useI18n, withShadowClassName, Text, EditableInlineText, frontend, useFile, useContentElementEditorState, FitViewport, ContentElementBox, Figure, useContentElementLifecycle, usePortraitOrientation, Image, usePlayerState, MediaInteractionTracking, useAudioFocus, VideoPlayerControls, PlayerEventContextDataProvider, VideoPlayer, AudioPlayerControls, AudioPlayer, useMediaMuted, useDarkBackground, EditableText, ThirdPartyOptOutInfo, ThirdPartyOptIn, useAtmo, textColorForBackgroundColor, Panorama, utils, ThemeIcon } from 'pageflow-scrolled/frontend';
2
- import React, { useState, useEffect, useMemo, useRef, useCallback } from 'react';
1
+ import { useContentElementConfigurationUpdate, useI18n, useDarkBackground, useContentElementEditorState, useIsStaticPreview, useContentElementLifecycle, utils, contentElementWidths, withShadowClassName, paletteColor, Text, EditableInlineText, frontend, useFileWithInlineRights, FitViewport, ContentElementBox, ContentElementFigure, InlineFileRights, usePortraitOrientation, ExpandableImage, Image, usePlayerState, MediaInteractionTracking, useAudioFocus, VideoPlayerControls, PlayerEventContextDataProvider, VideoPlayer, AudioPlayerControls, AudioPlayer, useMediaMuted, useTheme, EditableText, ThirdPartyOptOutInfo, useFile, ThirdPartyOptIn, useAtmo, textColorForBackgroundColor, Panorama, ThemeIcon, useLocale, Figure, usePhonePlatform, FullscreenViewer, ToggleFullscreenCornerButton } from 'pageflow-scrolled/frontend';
2
+ import React, { useState, useRef, useEffect, useMemo, useCallback, forwardRef } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import ReactCompareImage from 'react-compare-image';
5
5
  import Measure from 'react-measure';
@@ -21,61 +21,6 @@ function _defineProperty(obj, key, value) {
21
21
  return obj;
22
22
  }
23
23
 
24
- var styles = {"root":"Heading-module_root__33TFw","right":"Heading-module_right__1TJKF","centerRagged":"Heading-module_centerRagged__388sq","center":"Heading-module_center__38lDY","forcePaddingTop":"Heading-module_forcePaddingTop__30Juh"};
25
-
26
- function Heading(_ref) {
27
- var configuration = _ref.configuration,
28
- sectionProps = _ref.sectionProps;
29
- var level = configuration.level || sectionProps.sectionIndex;
30
- var firstSectionInEntry = level === 0;
31
- var updateConfiguration = useContentElementConfigurationUpdate();
32
-
33
- var _useI18n = useI18n({
34
- locale: 'ui'
35
- }),
36
- t = _useI18n.t;
37
-
38
- var legacyValue = configuration.children;
39
- var Tag = firstSectionInEntry ? 'h1' : 'h2';
40
- var forcePaddingTop = firstSectionInEntry && !('marginTop' in configuration);
41
- return /*#__PURE__*/React.createElement(Tag, {
42
- className: classNames(styles.root, configuration.typographyVariant && "typography-heading-".concat(configuration.typographyVariant), _defineProperty({}, styles.forcePaddingTop, forcePaddingTop), _defineProperty({}, styles[sectionProps.layout], configuration.position === 'wide' || sectionProps.layout === 'centerRagged'), _defineProperty({}, withShadowClassName, !sectionProps.invert))
43
- }, /*#__PURE__*/React.createElement(Text, {
44
- scaleCategory: getScaleCategory(configuration, firstSectionInEntry),
45
- inline: true
46
- }, /*#__PURE__*/React.createElement(EditableInlineText, {
47
- value: configuration.value,
48
- defaultValue: legacyValue,
49
- hyphens: configuration.hyphens,
50
- placeholder: firstSectionInEntry ? t('pageflow_scrolled.inline_editing.type_title') : t('pageflow_scrolled.inline_editing.type_heading'),
51
- onChange: function onChange(value) {
52
- return updateConfiguration({
53
- value: value
54
- });
55
- }
56
- })));
57
- }
58
-
59
- function getScaleCategory(configuration, firstSectionInEntry) {
60
- switch (configuration.textSize) {
61
- case 'large':
62
- return 'heading-lg';
63
-
64
- case 'medium':
65
- return 'heading-md';
66
-
67
- case 'small':
68
- return 'heading-sm';
69
-
70
- default:
71
- return firstSectionInEntry ? 'heading-lg' : 'heading-sm';
72
- }
73
- }
74
-
75
- frontend.contentElementTypes.register('heading', {
76
- component: Heading
77
- });
78
-
79
24
  function _arrayWithHoles(arr) {
80
25
  if (Array.isArray(arr)) return arr;
81
26
  }
@@ -134,6 +79,139 @@ function _slicedToArray(arr, i) {
134
79
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
135
80
  }
136
81
 
82
+ var styles = {"darkContentTextColor":"var(--theme-dark-content-text-color, #222)","lightContentTextColor":"var(--theme-light-content-text-color, #fff)","root":"Heading-module_root__33TFw","animation-fadeIn":"Heading-module_animation-fadeIn__3jlOG","animation-fadeInFast":"Heading-module_animation-fadeInFast__b41KH Heading-module_animation-fadeIn__3jlOG","animation-fadeInSlow":"Heading-module_animation-fadeInSlow__1G1o5 Heading-module_animation-fadeIn__3jlOG","main":"Heading-module_main__35wWK","tagline":"Heading-module_tagline__pvHO5","subtitle":"Heading-module_subtitle__19eD8","animating":"Heading-module_animating__1ziJR","hasTagline":"Heading-module_hasTagline__Pgn8c","right":"Heading-module_right__1TJKF","light":"Heading-module_light__1TQE8","dark":"Heading-module_dark__18iWa","centerRagged":"Heading-module_centerRagged__388sq","center":"Heading-module_center__38lDY","forcePaddingTop":"Heading-module_forcePaddingTop__30Juh"};
83
+
84
+ function Heading(_ref) {
85
+ var configuration = _ref.configuration,
86
+ sectionProps = _ref.sectionProps,
87
+ contentElementWidth = _ref.contentElementWidth;
88
+ var level = configuration.level || sectionProps.sectionIndex;
89
+ var firstSectionInEntry = level === 0;
90
+ var updateConfiguration = useContentElementConfigurationUpdate();
91
+
92
+ var _useI18n = useI18n({
93
+ locale: 'ui'
94
+ }),
95
+ t = _useI18n.t;
96
+
97
+ var darkBackground = useDarkBackground();
98
+
99
+ var _useContentElementEdi = useContentElementEditorState(),
100
+ isSelected = _useContentElementEdi.isSelected,
101
+ isEditable = _useContentElementEdi.isEditable;
102
+
103
+ var legacyValue = configuration.children;
104
+ var Tag = firstSectionInEntry ? 'h1' : 'h2';
105
+ var forcePaddingTop = firstSectionInEntry && !('marginTop' in configuration);
106
+ var entranceAnimation = !useIsStaticPreview() && configuration.entranceAnimation || 'none';
107
+
108
+ var _useState = useState(false),
109
+ _useState2 = _slicedToArray(_useState, 2),
110
+ animating = _useState2[0],
111
+ setAnimating = _useState2[1];
112
+
113
+ useContentElementLifecycle({
114
+ onActivate: function onActivate() {
115
+ setAnimating(entranceAnimation !== 'none');
116
+ },
117
+ onInvisible: function onInvisible() {
118
+ if (isEditable) {
119
+ setAnimating(false);
120
+ }
121
+ }
122
+ });
123
+ var previousAnimation = useRef(entranceAnimation);
124
+ var previouslySelected = useRef(isSelected);
125
+ useEffect(function () {
126
+ if (isEditable && previousAnimation.current !== entranceAnimation) {
127
+ previousAnimation.current = entranceAnimation;
128
+ setAnimating(false);
129
+ setTimeout(function () {
130
+ return setAnimating(true);
131
+ }, 100);
132
+ }
133
+ }, [entranceAnimation, isEditable]);
134
+ useEffect(function () {
135
+ if (!previouslySelected.current && isSelected) {
136
+ setAnimating(true);
137
+ }
138
+
139
+ previouslySelected.current = isSelected;
140
+ }, [isSelected]);
141
+
142
+ function renderSubtitle(name) {
143
+ var value = configuration[name];
144
+
145
+ if (!isSelected && utils.isBlankEditableTextValue(value)) {
146
+ return null;
147
+ }
148
+
149
+ return /*#__PURE__*/React.createElement(Text, {
150
+ scaleCategory: getScaleCategory(configuration, firstSectionInEntry, name)
151
+ }, /*#__PURE__*/React.createElement("div", {
152
+ className: styles[name],
153
+ role: "doc-subtitle"
154
+ }, /*#__PURE__*/React.createElement(EditableInlineText, {
155
+ value: value,
156
+ hyphens: configuration.hyphens,
157
+ placeholder: t("pageflow_scrolled.inline_editing.type_".concat(name)),
158
+ onChange: function onChange(value) {
159
+ return updateConfiguration(_defineProperty({}, name, value));
160
+ }
161
+ })));
162
+ }
163
+
164
+ return /*#__PURE__*/React.createElement("header", {
165
+ className: classNames(styles.root, styles["animation-".concat(entranceAnimation)], _defineProperty({}, styles.animating, animating), _defineProperty({}, styles.hasTagline, !utils.isBlankEditableTextValue(configuration.tagline) || isSelected), _defineProperty({}, styles.forcePaddingTop, forcePaddingTop), _defineProperty({}, styles[sectionProps.layout], contentElementWidth > contentElementWidths.md || sectionProps.layout === 'centerRagged'), _defineProperty({}, withShadowClassName, !sectionProps.invert))
166
+ }, renderSubtitle('tagline'), /*#__PURE__*/React.createElement(Tag, {
167
+ className: classNames(styles.main, 'scope-headings', configuration.typographyVariant && "typography-heading-".concat(configuration.typographyVariant), darkBackground ? styles.light : styles.dark),
168
+ style: {
169
+ color: paletteColor(configuration.color)
170
+ }
171
+ }, /*#__PURE__*/React.createElement(Text, {
172
+ scaleCategory: getScaleCategory(configuration, firstSectionInEntry),
173
+ inline: true
174
+ }, /*#__PURE__*/React.createElement(EditableInlineText, {
175
+ value: configuration.value,
176
+ defaultValue: legacyValue,
177
+ hyphens: configuration.hyphens,
178
+ placeholder: firstSectionInEntry ? t('pageflow_scrolled.inline_editing.type_title') : t('pageflow_scrolled.inline_editing.type_heading'),
179
+ onChange: function onChange(value) {
180
+ return updateConfiguration({
181
+ value: value
182
+ });
183
+ }
184
+ }))), renderSubtitle('subtitle'));
185
+ }
186
+
187
+ function getScaleCategory(configuration, firstSectionInEntry) {
188
+ var suffix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
189
+ var base = "heading".concat(capitalize(suffix));
190
+
191
+ switch (configuration.textSize) {
192
+ case 'large':
193
+ return "".concat(base, "-lg");
194
+
195
+ case 'medium':
196
+ return "".concat(base, "-md");
197
+
198
+ case 'small':
199
+ return "".concat(base, "-sm");
200
+
201
+ default:
202
+ return firstSectionInEntry ? "".concat(base, "-lg") : "".concat(base, "-sm");
203
+ }
204
+ }
205
+
206
+ function capitalize(string) {
207
+ return string.charAt(0).toUpperCase() + string.slice(1);
208
+ }
209
+
210
+ frontend.contentElementTypes.register('heading', {
211
+ component: Heading,
212
+ lifecycle: true
213
+ });
214
+
137
215
  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"};
138
216
 
139
217
  var placeholderForBeforeImage = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQwIiBoZWlnaHQ9IjQwMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KIDwhLS0gQ3JlYXRlZCB3aXRoIE1ldGhvZCBEcmF3IC0gaHR0cDovL2dpdGh1Yi5jb20vZHVvcGl4ZWwvTWV0aG9kLURyYXcvIC0tPgogPGc+CiAgPHRpdGxlPmJhY2tncm91bmQ8L3RpdGxlPgogIDxyZWN0IGZpbGw9IiMzZDVhODAiIGlkPSJjYW52YXNfYmFja2dyb3VuZCIgaGVpZ2h0PSI0MDUiIHdpZHRoPSI2NDIiIHk9Ii0xIiB4PSItMSIvPgogIDxnIGRpc3BsYXk9Im5vbmUiIG92ZXJmbG93PSJ2aXNpYmxlIiB5PSIwIiB4PSIwIiBoZWlnaHQ9IjEwMCUiIHdpZHRoPSIxMDAlIiBpZD0iY2FudmFzR3JpZCI+CiAgIDxyZWN0IGZpbGw9InVybCgjZ3JpZHBhdHRlcm4pIiBzdHJva2Utd2lkdGg9IjAiIHk9IjAiIHg9IjAiIGhlaWdodD0iMTAwJSIgd2lkdGg9IjEwMCUiLz4KICA8L2c+CiA8L2c+CiA8Zz4KICA8dGl0bGU+TGF5ZXIgMTwvdGl0bGU+CiA8L2c+Cjwvc3ZnPg==';
@@ -142,17 +220,13 @@ var placeholderFile = {
142
220
  width: 640,
143
221
  height: 403
144
222
  };
145
- function BeforeAfter(_ref) {
146
- var isActive = _ref.isActive,
147
- load = _ref.load,
148
- caption = _ref.caption,
149
- position = _ref.position,
150
- before_id = _ref.before_id,
151
- before_label = _ref.before_label,
152
- after_id = _ref.after_id,
153
- after_label = _ref.after_label,
154
- initial_slider_position = _ref.initial_slider_position,
155
- slider_color = _ref.slider_color;
223
+ function BeforeAfter(configuration) {
224
+ var isActive = configuration.isActive,
225
+ load = configuration.load,
226
+ before_label = configuration.before_label,
227
+ after_label = configuration.after_label,
228
+ initial_slider_position = configuration.initial_slider_position,
229
+ slider_color = configuration.slider_color;
156
230
 
157
231
  var _useState = useState(false),
158
232
  _useState2 = _slicedToArray(_useState, 2),
@@ -171,13 +245,15 @@ function BeforeAfter(_ref) {
171
245
  return wiggle || isActive;
172
246
  });
173
247
  }, [isActive]);
174
- var beforeImage = useFile({
248
+ var beforeImage = useFileWithInlineRights({
249
+ configuration: configuration,
175
250
  collectionName: 'imageFiles',
176
- permaId: before_id
251
+ propertyName: 'before_id'
177
252
  });
178
- var afterImage = useFile({
253
+ var afterImage = useFileWithInlineRights({
254
+ configuration: configuration,
179
255
  collectionName: 'imageFiles',
180
- permaId: after_id
256
+ propertyName: 'after_id'
181
257
  });
182
258
 
183
259
  var _useContentElementEdi = useContentElementEditorState(),
@@ -188,17 +264,24 @@ function BeforeAfter(_ref) {
188
264
  var afterImageUrl = afterImage && afterImage.urls.large;
189
265
  var afterImageAlt = afterImage && afterImage.configuration.alt;
190
266
  var initialSliderPos = initial_slider_position / 100;
267
+ var inlineFileRightsItems = [{
268
+ file: beforeImage,
269
+ label: 'before'
270
+ }, {
271
+ file: afterImage,
272
+ label: 'after'
273
+ }];
191
274
  return /*#__PURE__*/React.createElement(FitViewport, {
192
275
  file: beforeImage || afterImage || placeholderFile
193
- }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
194
- caption: caption
276
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(ContentElementFigure, {
277
+ configuration: configuration
195
278
  }, /*#__PURE__*/React.createElement(FitViewport.Content, null, /*#__PURE__*/React.createElement(Measure, {
196
279
  bounds: true
197
- }, function (_ref2) {
280
+ }, function (_ref) {
198
281
  var _cx;
199
282
 
200
- var measureRef = _ref2.measureRef,
201
- contentRect = _ref2.contentRect;
283
+ var measureRef = _ref.measureRef,
284
+ contentRect = _ref.contentRect;
202
285
  var initialRectWidth = contentRect.bounds.width * initialSliderPos + 'px';
203
286
  return /*#__PURE__*/React.createElement("div", {
204
287
  ref: measureRef,
@@ -210,7 +293,13 @@ function BeforeAfter(_ref) {
210
293
  parentSelected: isSelected,
211
294
  position: initial_slider_position
212
295
  }), renderCompareImage());
213
- })))));
296
+ }), /*#__PURE__*/React.createElement(InlineFileRights, {
297
+ context: "insideElement",
298
+ items: inlineFileRightsItems
299
+ })))), /*#__PURE__*/React.createElement(InlineFileRights, {
300
+ context: "afterElement",
301
+ items: inlineFileRightsItems
302
+ }));
214
303
 
215
304
  function renderCompareImage() {
216
305
  if (!load) {
@@ -233,9 +322,9 @@ function BeforeAfter(_ref) {
233
322
  }
234
323
  }
235
324
 
236
- function InitialSliderPositionIndicator(_ref3) {
237
- var parentSelected = _ref3.parentSelected,
238
- position = _ref3.position;
325
+ function InitialSliderPositionIndicator(_ref2) {
326
+ var parentSelected = _ref2.parentSelected,
327
+ position = _ref2.position;
239
328
  var indicatorWidth = '2px';
240
329
  var indicatorStyles = {
241
330
  left: "calc(".concat(position, "% - ").concat(indicatorWidth, "/2)"),
@@ -269,14 +358,18 @@ frontend.contentElementTypes.register('inlineBeforeAfter', {
269
358
  });
270
359
 
271
360
  function InlineImage(_ref) {
272
- var configuration = _ref.configuration;
273
- var imageFile = useFile({
361
+ var contentElementId = _ref.contentElementId,
362
+ contentElementWidth = _ref.contentElementWidth,
363
+ configuration = _ref.configuration;
364
+ var imageFile = useFileWithInlineRights({
365
+ configuration: configuration,
274
366
  collectionName: 'imageFiles',
275
- permaId: configuration.id
367
+ propertyName: 'id'
276
368
  });
277
- var portraitImageFile = useFile({
369
+ var portraitImageFile = useFileWithInlineRights({
370
+ configuration: configuration,
278
371
  collectionName: 'imageFiles',
279
- permaId: configuration.portraitId
372
+ propertyName: 'portraitId'
280
373
  }); // Only render OrientationAwareInlineImage if a portrait image has
281
374
  // been selected. This prevents having the component rerender on
282
375
  // orientation changes even if it does not depend on orientation at
@@ -286,11 +379,15 @@ function InlineImage(_ref) {
286
379
  return /*#__PURE__*/React.createElement(OrientationAwareInlineImage, {
287
380
  landscapeImageFile: imageFile,
288
381
  portraitImageFile: portraitImageFile,
382
+ contentElementId: contentElementId,
383
+ contentElementWidth: contentElementWidth,
289
384
  configuration: configuration
290
385
  });
291
386
  } else {
292
387
  return /*#__PURE__*/React.createElement(ImageWithCaption, {
293
388
  imageFile: imageFile,
389
+ contentElementId: contentElementId,
390
+ contentElementWidth: contentElementWidth,
294
391
  configuration: configuration
295
392
  });
296
393
  }
@@ -299,35 +396,59 @@ function InlineImage(_ref) {
299
396
  function OrientationAwareInlineImage(_ref2) {
300
397
  var landscapeImageFile = _ref2.landscapeImageFile,
301
398
  portraitImageFile = _ref2.portraitImageFile,
399
+ contentElementId = _ref2.contentElementId,
400
+ contentElementWidth = _ref2.contentElementWidth,
302
401
  configuration = _ref2.configuration;
303
402
  var portraitOrientation = usePortraitOrientation();
304
403
  var imageFile = portraitOrientation && portraitImageFile ? portraitImageFile : landscapeImageFile;
305
404
  return /*#__PURE__*/React.createElement(ImageWithCaption, {
306
405
  imageFile: imageFile,
406
+ contentElementId: contentElementId,
407
+ contentElementWidth: contentElementWidth,
307
408
  configuration: configuration
308
409
  });
309
410
  }
310
411
 
311
412
  function ImageWithCaption(_ref3) {
312
413
  var imageFile = _ref3.imageFile,
414
+ contentElementId = _ref3.contentElementId,
415
+ contentElementWidth = _ref3.contentElementWidth,
313
416
  configuration = _ref3.configuration;
314
417
 
315
418
  var _useContentElementLif = useContentElementLifecycle(),
316
419
  shouldLoad = _useContentElementLif.shouldLoad;
317
420
 
421
+ var enableFullscreen = configuration.enableFullscreen;
422
+ var supportFullscreen = enableFullscreen && contentElementWidth < contentElementWidths.full;
318
423
  return /*#__PURE__*/React.createElement(FitViewport, {
319
424
  file: imageFile,
320
425
  aspectRatio: imageFile ? undefined : 0.75,
321
426
  opaque: !imageFile
322
- }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
323
- caption: configuration.caption
324
- }, /*#__PURE__*/React.createElement(FitViewport.Content, null, /*#__PURE__*/React.createElement(Image, {
427
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(ContentElementFigure, {
428
+ configuration: configuration
429
+ }, /*#__PURE__*/React.createElement(FitViewport.Content, null, /*#__PURE__*/React.createElement(ExpandableImage, {
430
+ enabled: supportFullscreen && shouldLoad,
431
+ imageFile: imageFile,
432
+ contentElementId: contentElementId
433
+ }, /*#__PURE__*/React.createElement(Image, {
325
434
  imageFile: imageFile,
326
435
  load: shouldLoad,
327
436
  structuredData: true,
328
- variant: configuration.position === 'full' ? 'large' : 'medium',
437
+ variant: contentElementWidth === contentElementWidths.full ? 'large' : 'medium',
329
438
  preferSvg: true
330
- })))));
439
+ })), /*#__PURE__*/React.createElement(InlineFileRights, {
440
+ context: "insideElement",
441
+ items: [{
442
+ file: imageFile,
443
+ label: 'image'
444
+ }]
445
+ })))), /*#__PURE__*/React.createElement(InlineFileRights, {
446
+ context: "afterElement",
447
+ items: [{
448
+ file: imageFile,
449
+ label: 'image'
450
+ }]
451
+ }));
331
452
  }
332
453
 
333
454
  frontend.contentElementTypes.register('inlineImage', {
@@ -439,22 +560,87 @@ function getPlayerClickHandler(_ref) {
439
560
 
440
561
  function InlineVideo(_ref) {
441
562
  var contentElementId = _ref.contentElementId,
442
- sectionProps = _ref.sectionProps,
443
563
  configuration = _ref.configuration;
444
- var videoFile = useFile({
564
+ var videoFile = useFileWithInlineRights({
565
+ configuration: configuration,
445
566
  collectionName: 'videoFiles',
446
- permaId: configuration.id
567
+ propertyName: 'id'
447
568
  });
448
- var posterImageFile = useFile({
569
+ var posterImageFile = useFileWithInlineRights({
570
+ configuration: configuration,
449
571
  collectionName: 'imageFiles',
450
- permaId: configuration.posterId
572
+ propertyName: 'posterId'
573
+ });
574
+ var portraitVideoFile = useFileWithInlineRights({
575
+ configuration: configuration,
576
+ collectionName: 'videoFiles',
577
+ propertyName: 'portraitId'
578
+ });
579
+ var portraitPosterImageFile = useFileWithInlineRights({
580
+ configuration: configuration,
581
+ collectionName: 'imageFiles',
582
+ propertyName: 'portraitPosterId'
583
+ }); // Only render OrientationAwareInlineImage if a portrait image has
584
+ // been selected. This prevents having the component rerender on
585
+ // orientation changes even if it does not depend on orientation at
586
+ // all.
587
+
588
+ if (portraitVideoFile) {
589
+ return /*#__PURE__*/React.createElement(OrientationAwareInlineVideo, {
590
+ landscapeVideoFile: videoFile,
591
+ portraitVideoFile: portraitVideoFile,
592
+ landscapePosterImageFile: posterImageFile,
593
+ portraitPosterImageFile: portraitPosterImageFile,
594
+ contentElementId: contentElementId,
595
+ configuration: configuration
596
+ });
597
+ } else {
598
+ return /*#__PURE__*/React.createElement(OrientationUnawareInlineVideo, {
599
+ videoFile: videoFile,
600
+ posterImageFile: posterImageFile,
601
+ contentElementId: contentElementId,
602
+ configuration: configuration
603
+ });
604
+ }
605
+ }
606
+
607
+ function OrientationAwareInlineVideo(_ref2) {
608
+ var landscapeVideoFile = _ref2.landscapeVideoFile,
609
+ portraitVideoFile = _ref2.portraitVideoFile,
610
+ landscapePosterImageFile = _ref2.landscapePosterImageFile,
611
+ portraitPosterImageFile = _ref2.portraitPosterImageFile,
612
+ contentElementId = _ref2.contentElementId,
613
+ configuration = _ref2.configuration;
614
+ var portraitOrientation = usePortraitOrientation();
615
+ var videoFile = portraitOrientation && portraitVideoFile ? portraitVideoFile : landscapeVideoFile;
616
+ var posterImageFile = portraitOrientation && portraitPosterImageFile ? portraitPosterImageFile : landscapePosterImageFile;
617
+ return /*#__PURE__*/React.createElement(OrientationUnawareInlineVideo, {
618
+ key: portraitOrientation,
619
+ videoFile: videoFile,
620
+ posterImageFile: posterImageFile,
621
+ contentElementId: contentElementId,
622
+ configuration: configuration
451
623
  });
624
+ }
625
+
626
+ function OrientationUnawareInlineVideo(_ref3) {
627
+ var videoFile = _ref3.videoFile,
628
+ posterImageFile = _ref3.posterImageFile,
629
+ contentElementId = _ref3.contentElementId,
630
+ configuration = _ref3.configuration;
452
631
 
453
632
  var _usePlayerState = usePlayerState(),
454
633
  _usePlayerState2 = _slicedToArray(_usePlayerState, 2),
455
634
  playerState = _usePlayerState2[0],
456
635
  playerActions = _usePlayerState2[1];
457
636
 
637
+ var inlineFileRightsItems = [{
638
+ label: 'video',
639
+ file: videoFile
640
+ }, {
641
+ label: 'poster',
642
+ file: posterImageFile
643
+ }];
458
644
  return /*#__PURE__*/React.createElement(MediaInteractionTracking, {
459
645
  playerState: playerState,
460
646
  playerActions: playerActions
@@ -462,30 +648,33 @@ function InlineVideo(_ref) {
462
648
  file: videoFile,
463
649
  aspectRatio: videoFile ? undefined : fallbackAspectRatio,
464
650
  opaque: !videoFile
465
- }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
466
- caption: configuration.caption
651
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(ContentElementFigure, {
652
+ configuration: configuration
467
653
  }, /*#__PURE__*/React.createElement(FitViewport.Content, null, /*#__PURE__*/React.createElement(MutedIndicator, {
468
654
  visible: media.muted && playerState.shouldPlay && !configuration.keepMuted
469
655
  }), /*#__PURE__*/React.createElement(Player, {
470
656
  key: configuration.playbackMode === 'loop',
471
657
  videoFile: videoFile,
472
658
  posterImageFile: posterImageFile,
659
+ inlineFileRightsItems: inlineFileRightsItems,
473
660
  playerState: playerState,
474
661
  playerActions: playerActions,
475
662
  contentElementId: contentElementId,
476
- sectionProps: sectionProps,
477
663
  configuration: configuration
478
- }))))));
664
+ })))), /*#__PURE__*/React.createElement(InlineFileRights, {
665
+ context: "afterElement",
666
+ items: inlineFileRightsItems
667
+ })));
479
668
  }
480
669
 
481
- function Player(_ref2) {
482
- var videoFile = _ref2.videoFile,
483
- posterImageFile = _ref2.posterImageFile,
484
- playerState = _ref2.playerState,
485
- playerActions = _ref2.playerActions,
486
- contentElementId = _ref2.contentElementId,
487
- sectionProps = _ref2.sectionProps,
488
- configuration = _ref2.configuration;
670
+ function Player(_ref4) {
671
+ var videoFile = _ref4.videoFile,
672
+ posterImageFile = _ref4.posterImageFile,
673
+ inlineFileRightsItems = _ref4.inlineFileRightsItems,
674
+ playerState = _ref4.playerState,
675
+ playerActions = _ref4.playerActions,
676
+ contentElementId = _ref4.contentElementId,
677
+ configuration = _ref4.configuration;
489
678
 
490
679
  var _useContentElementEdi = useContentElementEditorState(),
491
680
  isEditable = _useContentElementEdi.isEditable,
@@ -536,8 +725,8 @@ function Player(_ref2) {
536
725
  playerActions: playerActions,
537
726
  hideControlBar: configuration.hideControlBar || configuration.playbackMode === 'loop',
538
727
  hideBigPlayButton: configuration.playbackMode === 'loop',
728
+ inlineFileRightsItems: inlineFileRightsItems,
539
729
  configuration: configuration,
540
- sectionProps: sectionProps,
541
730
  onPlayerClick: onPlayerClick
542
731
  }, /*#__PURE__*/React.createElement(PlayerEventContextDataProvider, {
543
732
  playerDescription: "Inline Video",
@@ -565,15 +754,16 @@ frontend.contentElementTypes.register('inlineVideo', {
565
754
 
566
755
  function InlineAudio(_ref) {
567
756
  var contentElementId = _ref.contentElementId,
568
- sectionProps = _ref.sectionProps,
569
757
  configuration = _ref.configuration;
570
- var audioFile = useFile({
758
+ var audioFile = useFileWithInlineRights({
759
+ configuration: configuration,
571
760
  collectionName: 'audioFiles',
572
- permaId: configuration.id
761
+ propertyName: 'id'
573
762
  });
574
- var posterImageFile = useFile({
763
+ var posterImageFile = useFileWithInlineRights({
764
+ configuration: configuration,
575
765
  collectionName: 'imageFiles',
576
- permaId: configuration.posterId
766
+ propertyName: 'posterId'
577
767
  });
578
768
 
579
769
  var _usePlayerState = usePlayerState(),
@@ -618,18 +808,25 @@ function InlineAudio(_ref) {
618
808
  }
619
809
  };
620
810
 
811
+ var inlineFileRightsItems = [{
812
+ label: 'audio',
813
+ file: audioFile
814
+ }, {
815
+ label: 'image',
816
+ file: posterImageFile
817
+ }];
621
818
  return /*#__PURE__*/React.createElement(FitViewport, {
622
819
  file: posterImageFile
623
- }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
624
- caption: configuration.caption
820
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(ContentElementFigure, {
821
+ configuration: configuration
625
822
  }, /*#__PURE__*/React.createElement(FitViewport.Content, null, /*#__PURE__*/React.createElement(AudioPlayerControls, {
626
823
  audioFile: audioFile,
627
824
  defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
628
825
  playerState: playerState,
629
826
  playerActions: playerActions,
630
827
  standAlone: !posterImageFile,
828
+ inlineFileRightsItems: inlineFileRightsItems,
631
829
  configuration: configuration,
632
- sectionProps: sectionProps,
633
830
  onPlayerClick: onPlayerClick
634
831
  }, /*#__PURE__*/React.createElement(PlayerEventContextDataProvider, {
635
832
  playerDescription: "Inline Audio",
@@ -645,7 +842,10 @@ function InlineAudio(_ref) {
645
842
  quality: 'high',
646
843
  playsInline: true,
647
844
  atmoDuringPlayback: configuration.atmoDuringPlayback
648
- })))))));
845
+ })))))), /*#__PURE__*/React.createElement(InlineFileRights, {
846
+ context: "afterElement",
847
+ items: inlineFileRightsItems
848
+ }));
649
849
  }
650
850
 
651
851
  frontend.contentElementTypes.register('inlineAudio', {
@@ -793,18 +993,18 @@ frontend.contentElementTypes.register('soundDisclaimer', {
793
993
  component: SoundDisclaimer
794
994
  });
795
995
 
796
- var styles$4 = {"breakpoint-sm":"(min-width: 640px)","text":"TextBlock-module_text__21Hk4","darkBackground":"TextBlock-module_darkBackground__22pEl","layout-centerRagged":"TextBlock-module_layout-centerRagged__1tjoI"};
996
+ var styles$4 = {"contentLinkColor":"var(--content-link-color)","breakpoint-sm":"(min-width: 640px)","text":"TextBlock-module_text__21Hk4","quoteDesign-hanging":"TextBlock-module_quoteDesign-hanging__1c9AW","quoteDesign-largeHanging":"TextBlock-module_quoteDesign-largeHanging__2VkIW","layout-centerRagged":"TextBlock-module_layout-centerRagged__1tjoI"};
797
997
 
798
998
  function TextBlock(props) {
799
999
  var updateConfiguration = useContentElementConfigurationUpdate();
800
- var dark = useDarkBackground();
801
1000
 
802
1001
  var _useI18n = useI18n({
803
1002
  locale: 'ui'
804
1003
  }),
805
1004
  t = _useI18n.t;
806
1005
 
807
- var className = classNames(styles$4.text, _defineProperty({}, styles$4.darkBackground, dark), styles$4["layout-".concat(props.sectionProps.layout)]);
1006
+ var theme = useTheme();
1007
+ var className = classNames(styles$4.text, styles$4["quoteDesign-".concat(theme.options.quoteDesign || 'largeHanging')], styles$4["layout-".concat(props.sectionProps.layout)]);
808
1008
  return /*#__PURE__*/React.createElement(EditableText, {
809
1009
  value: props.configuration.value,
810
1010
  contentElementId: props.contentElementId,
@@ -871,8 +1071,8 @@ function VideoEmbed(_ref) {
871
1071
  }
872
1072
  }, /*#__PURE__*/React.createElement(FitViewport, {
873
1073
  aspectRatio: aspectRatios[configuration.aspectRatio || 'wide']
874
- }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
875
- caption: configuration.caption
1074
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(ContentElementFigure, {
1075
+ configuration: configuration
876
1076
  }, /*#__PURE__*/React.createElement(FitViewport.Content, null, shouldLoad && /*#__PURE__*/React.createElement(PreparedPlayer, {
877
1077
  playerState: playerState,
878
1078
  setPlayerState: setPlayerState,
@@ -881,8 +1081,7 @@ function VideoEmbed(_ref) {
881
1081
  providerName: providerName
882
1082
  })), /*#__PURE__*/React.createElement(ThirdPartyOptOutInfo, {
883
1083
  providerName: providerName,
884
- hide: playerState === 'playing',
885
- contentElementPosition: configuration.position
1084
+ hide: playerState === 'playing'
886
1085
  })))));
887
1086
  }
888
1087
 
@@ -1021,7 +1220,7 @@ frontend.contentElementTypes.register('videoEmbed', {
1021
1220
  }
1022
1221
  });
1023
1222
 
1024
- var styles$6 = {"darkContentSurfaceColor":"var(--theme-dark-content-surface-color, #101010)","lightContentSurfaceColor":"var(--theme-light-content-surface-color, #fff)","darkContentTextColor":"var(--theme-dark-content-text-color, #222)","lightContentTextColor":"var(--theme-light-content-text-color, #fff)","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"};
1223
+ var styles$6 = {"darkContentSurfaceColor":"var(--theme-dark-content-surface-color, #101010)","lightContentSurfaceColor":"var(--theme-light-content-surface-color, #fff)","darkContentTextColor":"var(--theme-dark-content-text-color, #222)","lightContentTextColor":"var(--theme-light-content-text-color, #fff)","breakpoint-sm":"(min-width: 640px)","hidden":"ExternalLink-module_hidden__3jer0","link_item":"ExternalLink-module_link_item__Blypv","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","invert":"ExternalLink-module_invert__1zrgN","tooltip":"ExternalLink-module_tooltip__18MpC"};
1025
1224
 
1026
1225
  function ExternalLink(props) {
1027
1226
  var _classNames2;
@@ -1111,7 +1310,7 @@ function ensureAbsolute(url) {
1111
1310
  }
1112
1311
  }
1113
1312
 
1114
- var styles$7 = {"ext_links_container":"ExternalLinkList-module_ext_links_container__16IIo scope-externalLinks"};
1313
+ var styles$7 = {"contentColorScope":"colors-module_contentColorScope__3zLO1","ext_links_container":"ExternalLinkList-module_ext_links_container__16IIo scope-externalLinks colors-module_contentColorScope__3zLO1"};
1115
1314
 
1116
1315
  function ExternalLinkList(props) {
1117
1316
  var linkList = props.configuration.links || [];
@@ -1187,8 +1386,8 @@ function DataWrapperChart(_ref) {
1187
1386
  }
1188
1387
 
1189
1388
  var backgroundColor = configuration.backgroundColor || '#323d4d';
1190
- return /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
1191
- caption: configuration.caption
1389
+ return /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(ContentElementFigure, {
1390
+ configuration: configuration
1192
1391
  }, /*#__PURE__*/React.createElement("div", {
1193
1392
  className: styles$8.container,
1194
1393
  style: {
@@ -1201,8 +1400,7 @@ function DataWrapperChart(_ref) {
1201
1400
  }, /*#__PURE__*/React.createElement(ThirdPartyOptIn, {
1202
1401
  providerName: "datawrapper"
1203
1402
  }, shouldLoad && renderIframe(srcURL, configuration.title || t('pageflow_scrolled.public.chart.default_title'))), /*#__PURE__*/React.createElement(DatawrapperOptOutInfo, {
1204
- providerName: "datawrapper",
1205
- contentElementPosition: configuration.position
1403
+ providerName: "datawrapper"
1206
1404
  }))));
1207
1405
  }
1208
1406
 
@@ -1295,7 +1493,8 @@ function useAutoCruising(_ref) {
1295
1493
  }
1296
1494
 
1297
1495
  function VrImage(_ref) {
1298
- var configuration = _ref.configuration;
1496
+ var configuration = _ref.configuration,
1497
+ contentElementWidth = _ref.contentElementWidth;
1299
1498
 
1300
1499
  var _useContentElementLif = useContentElementLifecycle(),
1301
1500
  shouldLoad = _useContentElementLif.shouldLoad;
@@ -1304,19 +1503,32 @@ function VrImage(_ref) {
1304
1503
  isEditable = _useContentElementEdi.isEditable,
1305
1504
  isSelected = _useContentElementEdi.isSelected;
1306
1505
 
1307
- var imageFile = useFile({
1506
+ var imageFile = useFileWithInlineRights({
1507
+ configuration: configuration,
1308
1508
  collectionName: 'imageFiles',
1309
- permaId: configuration.image
1509
+ propertyName: 'image'
1310
1510
  });
1311
1511
  return /*#__PURE__*/React.createElement("div", {
1312
1512
  style: {
1313
1513
  pointerEvents: isEditable && !isSelected ? 'none' : undefined
1314
1514
  }
1315
1515
  }, /*#__PURE__*/React.createElement(FitViewport, {
1316
- aspectRatio: configuration.position === 'full' ? 0.5 : 0.75
1317
- }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
1318
- caption: configuration.caption
1319
- }, /*#__PURE__*/React.createElement(FitViewport.Content, null, renderLazyPanorama(configuration, imageFile, shouldLoad))))));
1516
+ aspectRatio: contentElementWidth === contentElementWidths.full ? 0.5 : 0.75
1517
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(ContentElementFigure, {
1518
+ configuration: configuration
1519
+ }, /*#__PURE__*/React.createElement(FitViewport.Content, null, renderLazyPanorama(configuration, imageFile, shouldLoad), /*#__PURE__*/React.createElement(InlineFileRights, {
1520
+ context: "insideElement",
1521
+ items: [{
1522
+ file: imageFile,
1523
+ label: 'image'
1524
+ }]
1525
+ })))), /*#__PURE__*/React.createElement(InlineFileRights, {
1526
+ context: "afterElement",
1527
+ items: [{
1528
+ file: imageFile,
1529
+ label: 'image'
1530
+ }]
1531
+ })));
1320
1532
  }
1321
1533
 
1322
1534
  function renderLazyPanorama(configuration, imageFile, shouldLoad) {
@@ -1401,13 +1613,25 @@ function IframeEmbed(_ref) {
1401
1613
  }, /*#__PURE__*/React.createElement(FitViewport, {
1402
1614
  aspectRatio: aspectRatios$1[aspectRatio || 'wide'],
1403
1615
  opaque: utils.isBlank(configuration.source)
1404
- }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
1405
- caption: configuration.caption
1406
- }, /*#__PURE__*/React.createElement(FitViewport.Content, null, shouldLoad && /*#__PURE__*/React.createElement("iframe", {
1616
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(ContentElementFigure, {
1617
+ configuration: configuration
1618
+ }, /*#__PURE__*/React.createElement(FitViewport.Content, null, /*#__PURE__*/React.createElement(ThirdPartyOptIn, null, shouldLoad && /*#__PURE__*/React.createElement("iframe", {
1407
1619
  className: classNames(styles$9.iframe, styles$9["scale-".concat(configuration.scale)]),
1408
1620
  title: configuration.title,
1409
1621
  src: configuration.source
1410
- }))))));
1622
+ }))), /*#__PURE__*/React.createElement(OptOutInfo, {
1623
+ configuration: configuration
1624
+ })))));
1625
+ }
1626
+
1627
+ function OptOutInfo(_ref2) {
1628
+ var configuration = _ref2.configuration;
1629
+
1630
+ if (!configuration.requireConsent) {
1631
+ return null;
1632
+ }
1633
+
1634
+ return /*#__PURE__*/React.createElement(ThirdPartyOptOutInfo, null);
1411
1635
  }
1412
1636
 
1413
1637
  frontend.contentElementTypes.register('iframeEmbed', {
@@ -1519,8 +1743,7 @@ function TwitterEmbed(_ref) {
1519
1743
  })) : /*#__PURE__*/React.createElement(Placeholder, {
1520
1744
  minHeight: minHeight[key]
1521
1745
  }), /*#__PURE__*/React.createElement(ThirdPartyOptOutInfo, {
1522
- providerName: "twitter",
1523
- contentElementPosition: configuration.position
1746
+ providerName: "twitter"
1524
1747
  })));
1525
1748
  }
1526
1749
 
@@ -1597,7 +1820,7 @@ frontend.contentElementTypes.register('twitterEmbed', {
1597
1820
  }
1598
1821
  });
1599
1822
 
1600
- var styles$c = {"details":"Question-module_details__3FxH-","layout-centerRagged":"Question-module_layout-centerRagged__1hovs"};
1823
+ var styles$c = {"contentLinkColor":"var(--content-link-color)","details":"Question-module_details__3FxH-","answer":"Question-module_answer__2jMt6","layout-centerRagged":"Question-module_layout-centerRagged__1hovs"};
1601
1824
 
1602
1825
  function Question(_ref) {
1603
1826
  var configuration = _ref.configuration,
@@ -1637,6 +1860,7 @@ function Question(_ref) {
1637
1860
  }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(EditableText, {
1638
1861
  value: configuration.answer,
1639
1862
  contentElementId: contentElementId,
1863
+ className: styles$c.answer,
1640
1864
  onChange: function onChange(answer) {
1641
1865
  return updateConfiguration({
1642
1866
  answer: answer
@@ -1651,3 +1875,554 @@ function Question(_ref) {
1651
1875
  frontend.contentElementTypes.register('question', {
1652
1876
  component: Question
1653
1877
  });
1878
+
1879
+ var styles$d = {"contentLinkColor":"var(--content-link-color)","wrapper":"Counter-module_wrapper__3XTil","number":"Counter-module_number__1Y4AV","centerRagged":"Counter-module_centerRagged__3Va0Y","center":"Counter-module_center__1SCJY","animation-fadeIn":"Counter-module_animation-fadeIn__3Hyky","animation-fadeIn-active":"Counter-module_animation-fadeIn-active__16DIk","animation-fadeInFromBelow":"Counter-module_animation-fadeInFromBelow__3l1qX","animation-fadeInFromAbove":"Counter-module_animation-fadeInFromAbove__3iGf-","animation-fadeInFromAbove-active":"Counter-module_animation-fadeInFromAbove-active__37UsW","animation-fadeInFromBelow-active":"Counter-module_animation-fadeInFromBelow-active__2CSjv","animation-fadeInScaleUp":"Counter-module_animation-fadeInScaleUp__1ngk5","animation-fadeInScaleDown":"Counter-module_animation-fadeInScaleDown__SpNGu","animation-fadeInScaleUp-active":"Counter-module_animation-fadeInScaleUp-active__1GEXn","animation-fadeInScaleDown-active":"Counter-module_animation-fadeInScaleDown-active__3gaYM"};
1880
+
1881
+ function Counter(_ref) {
1882
+ var configuration = _ref.configuration,
1883
+ contentElementId = _ref.contentElementId,
1884
+ contentElementWidth = _ref.contentElementWidth,
1885
+ sectionProps = _ref.sectionProps;
1886
+ var updateConfiguration = useContentElementConfigurationUpdate();
1887
+ var locale = useLocale();
1888
+
1889
+ var _useI18n = useI18n({
1890
+ locale: 'ui'
1891
+ }),
1892
+ t = _useI18n.t;
1893
+
1894
+ var targetValue = configuration.targetValue || 0;
1895
+ var decimalPlaces = configuration.decimalPlaces || 0;
1896
+ var startValue = configuration.startValue || 0;
1897
+ var countingDuration = countingDurations[configuration.countingSpeed];
1898
+
1899
+ var _useState = useState(countingDuration > 0 ? startValue : targetValue),
1900
+ _useState2 = _slicedToArray(_useState, 2),
1901
+ currentValue = _useState2[0],
1902
+ setCurrentValue = _useState2[1];
1903
+
1904
+ var _useState3 = useState(false),
1905
+ _useState4 = _slicedToArray(_useState3, 2),
1906
+ animated = _useState4[0],
1907
+ setAnimated = _useState4[1];
1908
+
1909
+ var intervalRef = useRef();
1910
+ var timeoutRef = useRef();
1911
+
1912
+ var _useContentElementEdi = useContentElementEditorState(),
1913
+ isEditable = _useContentElementEdi.isEditable;
1914
+
1915
+ var animate = useCallback(function () {
1916
+ setAnimated(true);
1917
+
1918
+ if (!intervalRef.current && countingDuration > 0) {
1919
+ var startTime = new Date().getTime();
1920
+ var ease = configuration.entranceAnimation && configuration.entranceAnimation !== 'none' ? easeOut : easeInOut;
1921
+ intervalRef.current = setInterval(function () {
1922
+ var t = (new Date().getTime() - startTime) / countingDuration;
1923
+
1924
+ if (t < 1) {
1925
+ setCurrentValue(startValue + (targetValue - startValue) * ease(t));
1926
+ } else {
1927
+ clearInterval(intervalRef.current);
1928
+ setCurrentValue(targetValue);
1929
+ }
1930
+ }, 10);
1931
+ }
1932
+ }, [targetValue, startValue, countingDuration, configuration.entranceAnimation]);
1933
+ var resetAnimation = useCallback(function () {
1934
+ clearInterval(intervalRef.current);
1935
+ intervalRef.current = null;
1936
+ setCurrentValue(countingDuration > 0 ? startValue : targetValue);
1937
+ setAnimated(false);
1938
+ }, [startValue, targetValue, countingDuration]);
1939
+ useEffect(function () {
1940
+ if (isEditable) {
1941
+ resetAnimation();
1942
+ clearTimeout(timeoutRef.current);
1943
+ timeoutRef.current = setTimeout(animate, 500);
1944
+ }
1945
+ }, [animate, resetAnimation, isEditable]);
1946
+ useContentElementLifecycle({
1947
+ onActivate: function onActivate() {
1948
+ animate();
1949
+ },
1950
+ onInvisible: function onInvisible() {
1951
+ if (isEditable) {
1952
+ resetAnimation();
1953
+ }
1954
+ }
1955
+ });
1956
+
1957
+ function format(value) {
1958
+ var localeString = value.toLocaleString(locale, {
1959
+ minimumFractionDigits: decimalPlaces,
1960
+ maximumFractionDigits: decimalPlaces
1961
+ });
1962
+ var unit = configuration.unit || '';
1963
+ return configuration.unitPlacement === 'leading' ? "".concat(unit).concat(localeString) : "".concat(localeString).concat(unit);
1964
+ }
1965
+
1966
+ return /*#__PURE__*/React.createElement("div", {
1967
+ className: classNames(_defineProperty({}, styles$d.center, contentElementWidth > contentElementWidths.md))
1968
+ }, /*#__PURE__*/React.createElement("div", {
1969
+ className: classNames(styles$d.wrapper, _defineProperty({}, styles$d.centerRagged, sectionProps.layout === 'centerRagged'))
1970
+ }, /*#__PURE__*/React.createElement(Text, {
1971
+ scaleCategory: numberScaleCategories[configuration.textSize || 'medium']
1972
+ }, /*#__PURE__*/React.createElement("div", {
1973
+ className: classNames("typography-counter-".concat(configuration.typographyVariant), styles$d.number, styles$d["animation-".concat(configuration.entranceAnimation)], _defineProperty({}, styles$d["animation-".concat(configuration.entranceAnimation, "-active")], animated)),
1974
+ style: {
1975
+ '--counting-duration': "".concat(countingDuration || 1000, "ms"),
1976
+ '--palette-color': paletteColor(configuration.numberColor)
1977
+ }
1978
+ }, format(currentValue))), /*#__PURE__*/React.createElement(EditableText, {
1979
+ value: configuration.description,
1980
+ contentElementId: contentElementId,
1981
+ className: styles$d.description,
1982
+ onChange: function onChange(description) {
1983
+ return updateConfiguration({
1984
+ description: description
1985
+ });
1986
+ },
1987
+ onlyParagraphs: true,
1988
+ scaleCategory: "counterDescription",
1989
+ placeholder: t('pageflow_scrolled.inline_editing.type_description')
1990
+ })));
1991
+ }
1992
+ var numberScaleCategories = {
1993
+ verySmall: 'counterNumber-xs',
1994
+ small: 'counterNumber-sm',
1995
+ medium: 'counterNumber-md',
1996
+ large: 'counterNumber-lg'
1997
+ };
1998
+ var countingDurations = {
1999
+ none: 0,
2000
+ fast: 500,
2001
+ medium: 2000,
2002
+ slow: 5000
2003
+ };
2004
+
2005
+ function easeInOut(t) {
2006
+ t = t * 2;
2007
+ if (t < 1) return Math.pow(t, 2) / 2;
2008
+ t = t - 1;
2009
+ return t - Math.pow(t, 2) / 2 + 1 / 2;
2010
+ }
2011
+
2012
+ function easeOut(t) {
2013
+ return (t - Math.pow(t, 2) / 2) * 2;
2014
+ }
2015
+
2016
+ frontend.contentElementTypes.register('counter', {
2017
+ component: Counter,
2018
+ lifecycle: true
2019
+ });
2020
+
2021
+ var styles$e = {"breakpoint-sm":"(min-width: 640px)","contentLinkColor":"var(--content-link-color)","figure":"Quote-module_figure__1Q3tJ","design-largeCentered":"Quote-module_design-largeCentered__2f6qW","text":"Quote-module_text__C0md2","design-largeHanging":"Quote-module_design-largeHanging__1TVQh","design-hanging":"Quote-module_design-hanging__4aDVU","centerRagged":"Quote-module_centerRagged__1CeFH","maskedMark":"Quote-module_maskedMark__2n08e","attribution":"Quote-module_attribution__3iXxu"};
2022
+
2023
+ function Quote(_ref) {
2024
+ var _theme$options$proper, _theme$options$proper2;
2025
+
2026
+ var configuration = _ref.configuration,
2027
+ contentElementId = _ref.contentElementId,
2028
+ sectionProps = _ref.sectionProps;
2029
+ var updateConfiguration = useContentElementConfigurationUpdate();
2030
+
2031
+ var _useContentElementEdi = useContentElementEditorState(),
2032
+ isSelected = _useContentElementEdi.isSelected;
2033
+
2034
+ var theme = useTheme();
2035
+
2036
+ var _useI18n = useI18n({
2037
+ locale: 'ui'
2038
+ }),
2039
+ t = _useI18n.t;
2040
+
2041
+ var design = configuration.variant ? configuration.variant.split('-')[0] : theme.options.quoteDesign;
2042
+ return /*#__PURE__*/React.createElement("figure", {
2043
+ className: classNames(styles$e.figure, styles$e["design-".concat(design || 'largeHanging')], "scope-quote-".concat(configuration.variant), _defineProperty({}, styles$e.maskedMark, (_theme$options$proper = theme.options.properties) === null || _theme$options$proper === void 0 ? void 0 : (_theme$options$proper2 = _theme$options$proper.root) === null || _theme$options$proper2 === void 0 ? void 0 : _theme$options$proper2.quoteLeftMarkMaskImage), _defineProperty({}, styles$e.centerRagged, sectionProps.layout === 'centerRagged')),
2044
+ style: {
2045
+ '--palette-color': paletteColor(configuration.color)
2046
+ }
2047
+ }, /*#__PURE__*/React.createElement("blockquote", {
2048
+ className: styles$e.text
2049
+ }, /*#__PURE__*/React.createElement(EditableText, {
2050
+ value: configuration.text,
2051
+ contentElementId: contentElementId,
2052
+ onChange: function onChange(text) {
2053
+ return updateConfiguration({
2054
+ text: text
2055
+ });
2056
+ },
2057
+ onlyParagraphs: true,
2058
+ scaleCategory: getTextScaleCategory(configuration)
2059
+ })), (isSelected || !utils.isBlankEditableTextValue(configuration.attribution || [])) && /*#__PURE__*/React.createElement("figcaption", {
2060
+ className: styles$e.attribution
2061
+ }, /*#__PURE__*/React.createElement(EditableText, {
2062
+ value: configuration.attribution,
2063
+ contentElementId: contentElementId,
2064
+ onChange: function onChange(attribution) {
2065
+ return updateConfiguration({
2066
+ attribution: attribution
2067
+ });
2068
+ },
2069
+ onlyParagraphs: true,
2070
+ scaleCategory: "quoteAttribution",
2071
+ placeholder: t('pageflow_scrolled.inline_editing.type_attribution')
2072
+ })));
2073
+ }
2074
+
2075
+ function getTextScaleCategory(configuration) {
2076
+ switch (configuration.textSize) {
2077
+ case 'large':
2078
+ return 'quoteText-lg';
2079
+
2080
+ case 'small':
2081
+ return 'quoteText-sm';
2082
+
2083
+ case 'verySmall':
2084
+ return 'quoteText-xs';
2085
+
2086
+ default:
2087
+ return 'quoteText-md';
2088
+ }
2089
+ }
2090
+
2091
+ frontend.contentElementTypes.register('quote', {
2092
+ component: Quote
2093
+ });
2094
+
2095
+ function ownKeys(object, enumerableOnly) {
2096
+ var keys = Object.keys(object);
2097
+
2098
+ if (Object.getOwnPropertySymbols) {
2099
+ var symbols = Object.getOwnPropertySymbols(object);
2100
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
2101
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2102
+ });
2103
+ keys.push.apply(keys, symbols);
2104
+ }
2105
+
2106
+ return keys;
2107
+ }
2108
+
2109
+ function _objectSpread2(target) {
2110
+ for (var i = 1; i < arguments.length; i++) {
2111
+ var source = arguments[i] != null ? arguments[i] : {};
2112
+
2113
+ if (i % 2) {
2114
+ ownKeys(Object(source), true).forEach(function (key) {
2115
+ _defineProperty(target, key, source[key]);
2116
+ });
2117
+ } else if (Object.getOwnPropertyDescriptors) {
2118
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2119
+ } else {
2120
+ ownKeys(Object(source)).forEach(function (key) {
2121
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2122
+ });
2123
+ }
2124
+ }
2125
+
2126
+ return target;
2127
+ }
2128
+
2129
+ var styles$f = {"button":"ScrollButton-module_button__3DeL7","left":"ScrollButton-module_left__3uACk","right":"ScrollButton-module_right__25CLO","disabled":"ScrollButton-module_disabled__3fQR1","icon":"ScrollButton-module_icon__35w1l"};
2130
+
2131
+ var size = 40;
2132
+ function ScrollButton(_ref) {
2133
+ var direction = _ref.direction,
2134
+ disabled = _ref.disabled,
2135
+ onClick = _ref.onClick;
2136
+ return /*#__PURE__*/React.createElement("button", {
2137
+ className: classNames(styles$f.button, styles$f[direction], _defineProperty({}, styles$f.disabled, disabled)),
2138
+ onClick: onClick
2139
+ }, /*#__PURE__*/React.createElement("div", {
2140
+ className: styles$f.icon
2141
+ }, /*#__PURE__*/React.createElement(ThemeIcon, {
2142
+ name: direction === 'left' ? 'arrowLeft' : 'arrowRight',
2143
+ width: size,
2144
+ height: size
2145
+ })));
2146
+ }
2147
+
2148
+ function useIntersectionObserver(_ref) {
2149
+ var threshold = _ref.threshold,
2150
+ onVisibleIndexChange = _ref.onVisibleIndexChange;
2151
+ var containerRef = useRef();
2152
+ var childRefs = useRef([]);
2153
+ var observerRef = useRef();
2154
+ useEffect(function () {
2155
+ var observer = observerRef.current = new IntersectionObserver(function (entries) {
2156
+ var containerElement = containerRef.current;
2157
+ entries.forEach(function (entry) {
2158
+ var entryIndex = Array.from(containerElement.children).findIndex(function (child) {
2159
+ return child === entry.target;
2160
+ });
2161
+
2162
+ if (entry.isIntersecting) {
2163
+ onVisibleIndexChange(entryIndex);
2164
+ }
2165
+ });
2166
+ }, {
2167
+ root: containerRef.current,
2168
+ threshold: threshold
2169
+ });
2170
+ childRefs.current.forEach(function (child) {
2171
+ if (child) {
2172
+ observer.observe(child);
2173
+ }
2174
+ });
2175
+ return function () {
2176
+ observer.disconnect();
2177
+ };
2178
+ }, [threshold, onVisibleIndexChange]);
2179
+
2180
+ var setChildRef = function setChildRef(index) {
2181
+ return function (ref) {
2182
+ if (observerRef.current) {
2183
+ if (ref) {
2184
+ observerRef.current.observe(ref);
2185
+ } else {
2186
+ observerRef.current.unobserve(childRefs.current[index]);
2187
+ }
2188
+ }
2189
+
2190
+ childRefs.current[index] = ref;
2191
+ };
2192
+ };
2193
+
2194
+ return {
2195
+ containerRef: containerRef,
2196
+ setChildRef: setChildRef
2197
+ };
2198
+ }
2199
+
2200
+ var styles$g = {"lightContentTextColor":"var(--theme-light-content-text-color, #fff)","contentLinkColor":"var(--content-link-color)","wrapper":"ImageGallery-module_wrapper__2H9en","wide":"ImageGallery-module_wide__xGLuJ","customMargin":"ImageGallery-module_customMargin__1VxM6","button":"ImageGallery-module_button__35bDf","leftButton":"ImageGallery-module_leftButton__3V-J6 ImageGallery-module_button__35bDf","rightButton":"ImageGallery-module_rightButton__ba0q5 ImageGallery-module_button__35bDf","items":"ImageGallery-module_items__1q4QG","item":"ImageGallery-module_item__iqvfP","current":"ImageGallery-module_current__2Mm11","figure":"ImageGallery-module_figure__3zkJb","placeholder":"ImageGallery-module_placeholder__39Vq4"};
2201
+
2202
+ function ImageGallery(_ref) {
2203
+ var configuration = _ref.configuration,
2204
+ contentElementId = _ref.contentElementId,
2205
+ contentElementWidth = _ref.contentElementWidth,
2206
+ customMargin = _ref.customMargin;
2207
+
2208
+ var _useState = useState(-1),
2209
+ _useState2 = _slicedToArray(_useState, 2),
2210
+ visibleIndex = _useState2[0],
2211
+ setVisibleIndex = _useState2[1];
2212
+
2213
+ var isPhonePlatform = usePhonePlatform();
2214
+ return /*#__PURE__*/React.createElement(FullscreenViewer, {
2215
+ contentElementId: contentElementId,
2216
+ renderChildren: function renderChildren(_ref2) {
2217
+ var enterFullscreen = _ref2.enterFullscreen,
2218
+ isFullscreen = _ref2.isFullscreen;
2219
+ return /*#__PURE__*/React.createElement(Scroller, {
2220
+ customMargin: customMargin,
2221
+ configuration: configuration,
2222
+ contentElementWidth: contentElementWidth,
2223
+ controlled: isFullscreen,
2224
+ displayFullscreenToggle: !isPhonePlatform && contentElementWidth !== contentElementWidths.full && configuration.enableFullscreenOnDesktop,
2225
+ visibleIndex: visibleIndex,
2226
+ setVisibleIndex: setVisibleIndex,
2227
+ onFullscreenEnter: enterFullscreen
2228
+ });
2229
+ },
2230
+ renderFullscreenChildren: function renderFullscreenChildren(_ref3) {
2231
+ var exitFullscreen = _ref3.exitFullscreen;
2232
+ return /*#__PURE__*/React.createElement(Scroller, {
2233
+ configuration: configuration,
2234
+ contentElementWidth: contentElementWidth,
2235
+ visibleIndex: visibleIndex,
2236
+ setVisibleIndex: setVisibleIndex,
2237
+ displayFullscreenToggle: false,
2238
+ onBump: exitFullscreen,
2239
+ onFullscreenExit: exitFullscreen
2240
+ });
2241
+ }
2242
+ });
2243
+ }
2244
+
2245
+ function Scroller(_ref4) {
2246
+ var visibleIndex = _ref4.visibleIndex,
2247
+ setVisibleIndex = _ref4.setVisibleIndex,
2248
+ displayFullscreenToggle = _ref4.displayFullscreenToggle,
2249
+ customMargin = _ref4.customMargin,
2250
+ onFullscreenEnter = _ref4.onFullscreenEnter,
2251
+ onFullscreenExit = _ref4.onFullscreenExit,
2252
+ onBump = _ref4.onBump,
2253
+ configuration = _ref4.configuration,
2254
+ contentElementWidth = _ref4.contentElementWidth,
2255
+ controlled = _ref4.controlled;
2256
+ var lastVisibleIndex = useRef(null);
2257
+
2258
+ var _useContentElementEdi = useContentElementEditorState(),
2259
+ isSelected = _useContentElementEdi.isSelected,
2260
+ isEditable = _useContentElementEdi.isEditable;
2261
+
2262
+ var items = configuration.items || [];
2263
+
2264
+ if (!items.length && isEditable) {
2265
+ items = [{
2266
+ id: 1,
2267
+ placeholder: true
2268
+ }];
2269
+ }
2270
+
2271
+ var onVisibleIndexChange = useCallback(function (index) {
2272
+ if (!controlled) {
2273
+ lastVisibleIndex.current = index;
2274
+ setVisibleIndex(index);
2275
+ }
2276
+ }, [controlled, setVisibleIndex]);
2277
+
2278
+ var _useIntersectionObser = useIntersectionObserver({
2279
+ onVisibleIndexChange: onVisibleIndexChange,
2280
+ threshold: 0.7
2281
+ }),
2282
+ scrollerRef = _useIntersectionObser.containerRef,
2283
+ setChildRef = _useIntersectionObser.setChildRef;
2284
+
2285
+ useEffect(function () {
2286
+ if (lastVisibleIndex.current !== visibleIndex && visibleIndex >= 0 && (controlled || lastVisibleIndex.current === null)) {
2287
+ lastVisibleIndex.current = visibleIndex;
2288
+ var scroller = scrollerRef.current;
2289
+ var item = scroller.children[visibleIndex];
2290
+ scroller.style.scrollBehavior = 'auto';
2291
+ scroller.scrollTo(Math.abs(scroller.offsetLeft - item.offsetLeft), 0);
2292
+ scroller.style.scrollBehavior = null;
2293
+ }
2294
+ }, [visibleIndex, scrollerRef, controlled]);
2295
+
2296
+ function scrollBy(delta) {
2297
+ var scroller = scrollerRef.current;
2298
+ var child = scroller.children[visibleIndex + delta];
2299
+
2300
+ if (child) {
2301
+ scrollerRef.current.scrollTo(child.offsetLeft - scroller.offsetLeft, 0);
2302
+ }
2303
+ }
2304
+
2305
+ function handleClick(event) {
2306
+ if (isEditable && !isSelected) {
2307
+ return;
2308
+ }
2309
+
2310
+ var rect = scrollerRef.current.getBoundingClientRect();
2311
+
2312
+ if ((event.pageX - rect.x) / rect.width < 0.5) {
2313
+ if (visibleIndex > 0) {
2314
+ scrollBy(-1);
2315
+ } else if (onBump) {
2316
+ onBump();
2317
+ }
2318
+ } else {
2319
+ if (visibleIndex < items.length - 1) {
2320
+ scrollBy(1);
2321
+ } else if (onBump) {
2322
+ onBump();
2323
+ }
2324
+ }
2325
+ }
2326
+
2327
+ return /*#__PURE__*/React.createElement("div", {
2328
+ className: classNames(styles$g.wrapper, _defineProperty({}, styles$g.wide, contentElementWidth === contentElementWidths.lg || contentElementWidth === contentElementWidths.xl), _defineProperty({}, styles$g.customMargin, customMargin))
2329
+ }, /*#__PURE__*/React.createElement("div", {
2330
+ className: styles$g.leftButton
2331
+ }, /*#__PURE__*/React.createElement(ScrollButton, {
2332
+ direction: "left",
2333
+ disabled: visibleIndex <= 0,
2334
+ onClick: function onClick() {
2335
+ return scrollBy(-1);
2336
+ }
2337
+ })), /*#__PURE__*/React.createElement("div", {
2338
+ className: styles$g.rightButton
2339
+ }, /*#__PURE__*/React.createElement(ScrollButton, {
2340
+ direction: "right",
2341
+ disabled: visibleIndex >= items.length - 1,
2342
+ onClick: function onClick() {
2343
+ return scrollBy(1);
2344
+ }
2345
+ })), /*#__PURE__*/React.createElement("div", {
2346
+ className: styles$g.items,
2347
+ ref: scrollerRef
2348
+ }, items.map(function (item, index) {
2349
+ return /*#__PURE__*/React.createElement(Item, {
2350
+ key: item.id,
2351
+ ref: setChildRef(index),
2352
+ item: item,
2353
+ current: index === visibleIndex,
2354
+ captions: configuration.captions || {},
2355
+ onClick: handleClick
2356
+ }, displayFullscreenToggle && /*#__PURE__*/React.createElement(ToggleFullscreenCornerButton, {
2357
+ isFullscreen: false,
2358
+ onEnter: onFullscreenEnter
2359
+ }));
2360
+ })));
2361
+ }
2362
+
2363
+ var Item = forwardRef(function (_ref5, ref) {
2364
+ var _classNames3;
2365
+
2366
+ var item = _ref5.item,
2367
+ captions = _ref5.captions,
2368
+ current = _ref5.current,
2369
+ onClick = _ref5.onClick,
2370
+ children = _ref5.children;
2371
+ var updateConfiguration = useContentElementConfigurationUpdate();
2372
+
2373
+ var _useContentElementLif = useContentElementLifecycle(),
2374
+ shouldLoad = _useContentElementLif.shouldLoad;
2375
+
2376
+ var caption = captions[item.id];
2377
+ var imageFile = useFileWithInlineRights({
2378
+ configuration: item,
2379
+ collectionName: 'imageFiles',
2380
+ propertyName: 'image'
2381
+ });
2382
+
2383
+ var handleCaptionChange = function handleCaptionChange(caption) {
2384
+ updateConfiguration({
2385
+ captions: _objectSpread2(_objectSpread2({}, captions), {}, _defineProperty({}, item.id, caption))
2386
+ });
2387
+ };
2388
+
2389
+ return /*#__PURE__*/React.createElement("div", {
2390
+ className: classNames(styles$g.item, (_classNames3 = {}, _defineProperty(_classNames3, styles$g.current, current), _defineProperty(_classNames3, styles$g.placeholder, item.placeholder), _classNames3)),
2391
+ ref: ref
2392
+ }, /*#__PURE__*/React.createElement("div", {
2393
+ className: styles$g.figure
2394
+ }, /*#__PURE__*/React.createElement(FitViewport, {
2395
+ file: imageFile,
2396
+ aspectRatio: imageFile ? undefined : 0.75,
2397
+ scale: 0.8,
2398
+ opaque: !imageFile
2399
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
2400
+ caption: caption,
2401
+ onCaptionChange: handleCaptionChange,
2402
+ addCaptionButtonVisible: current && !item.placeholder,
2403
+ addCaptionButtonPosition: "inside"
2404
+ }, /*#__PURE__*/React.createElement(FitViewport.Content, null, /*#__PURE__*/React.createElement("div", {
2405
+ onClick: onClick
2406
+ }, /*#__PURE__*/React.createElement(Image, {
2407
+ imageFile: imageFile,
2408
+ load: shouldLoad
2409
+ })), children, /*#__PURE__*/React.createElement(InlineFileRights, {
2410
+ context: "insideElement",
2411
+ items: [{
2412
+ file: imageFile,
2413
+ label: 'image'
2414
+ }]
2415
+ })))), /*#__PURE__*/React.createElement(InlineFileRights, {
2416
+ context: "afterElement",
2417
+ items: [{
2418
+ file: imageFile,
2419
+ label: 'image'
2420
+ }]
2421
+ }))));
2422
+ });
2423
+
2424
+ frontend.contentElementTypes.register('imageGallery', {
2425
+ component: ImageGallery,
2426
+ lifecycle: true,
2427
+ customMargin: true
2428
+ });