pageflow 16.0.0 → 16.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +210 -33
- data/README.md +0 -1
- data/Rakefile +1 -1
- data/admins/pageflow/entry.rb +0 -1
- data/admins/pageflow/sites.rb +3 -0
- data/app/assets/javascripts/pageflow/dist/ui.js +298 -72
- data/app/assets/stylesheets/pageflow/admin/permalink_input.scss +10 -0
- data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +6 -1
- data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -0
- data/app/assets/stylesheets/pageflow/editor/help.scss +3 -3
- data/app/assets/stylesheets/pageflow/editor/info_box.scss +7 -0
- data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +0 -5
- data/app/assets/stylesheets/pageflow/ui/forms.scss +1 -1
- data/app/controllers/pageflow/chapters_controller.rb +2 -2
- data/app/controllers/pageflow/editor/files_controller.rb +1 -1
- data/app/controllers/pageflow/entries_controller.rb +10 -0
- data/app/controllers/pageflow/feeds_controller.rb +18 -0
- data/app/controllers/pageflow/pages_controller.rb +2 -2
- data/app/controllers/pageflow/sitemaps_controller.rb +15 -0
- data/app/controllers/pageflow/storylines_controller.rb +2 -2
- data/app/helpers/pageflow/entries_helper.rb +2 -1
- data/app/helpers/pageflow/feeds_helper.rb +66 -0
- data/app/helpers/pageflow/page_types_helper.rb +9 -9
- data/app/inputs/pageflow_permalink_input.rb +15 -3
- data/app/models/concerns/pageflow/reusable_file.rb +3 -3
- data/app/models/pageflow/account.rb +8 -0
- data/app/models/pageflow/audio_file_url_templates.rb +2 -1
- data/app/models/pageflow/draft_entry.rb +1 -1
- data/app/models/pageflow/entries_feed.rb +32 -0
- data/app/models/pageflow/image_file.rb +14 -3
- data/app/models/pageflow/membership.rb +3 -2
- data/app/models/pageflow/other_file.rb +5 -0
- data/app/models/pageflow/other_file_url_templates.rb +16 -0
- data/app/models/pageflow/published_entry.rb +6 -0
- data/app/models/pageflow/revision.rb +4 -0
- data/app/models/pageflow/site.rb +8 -0
- data/app/models/pageflow/sitemaps.rb +13 -0
- data/app/models/pageflow/used_file.rb +2 -2
- data/app/models/pageflow/video_file_url_templates.rb +3 -1
- data/app/models/pageflow/widget.rb +9 -1
- data/app/views/admin/entries/_permalink_inputs.html.erb +1 -2
- data/app/views/admin/sites/_attributes_table.html.arb +3 -0
- data/app/views/admin/sites/_fields.html.erb +6 -0
- data/app/views/components/pageflow/admin/extensible_attributes_table.rb +8 -2
- data/app/views/components/pageflow/admin/sites_tab.rb +3 -0
- data/app/views/pageflow/editor/config/_seeds.json.jbuilder +1 -0
- data/app/views/pageflow/feeds/index.atom.builder +20 -0
- data/app/views/pageflow/sitemaps/index.xml.builder +9 -0
- data/config/initializers/features.rb +1 -0
- data/config/initializers/paperclip.rb +4 -0
- data/config/locales/de.yml +27 -6
- data/config/locales/en.yml +30 -4
- data/config/routes.rb +3 -0
- data/config/spring.rb +1 -1
- data/db/migrate/20230120092923_create_other_files.rb +23 -0
- data/db/migrate/20230323115745_add_feeds_enabled_to_sites.rb +5 -0
- data/db/migrate/20230323154323_add_sitemap_enabled_to_sites.rb +5 -0
- data/db/migrate/20230331103823_add_title_to_sites.rb +5 -0
- data/db/migrate/20230405103612_add_custom_feed_url_to_sites.rb +5 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +445 -109
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +26 -3
- data/entry_types/paged/app/controllers/pageflow_paged/editor/entries_controller.rb +0 -2
- data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +1 -0
- data/entry_types/paged/app/views/pageflow_paged/entries/show.html.erb +1 -0
- data/entry_types/paged/config/initializers/features.rb +0 -1
- data/entry_types/paged/lib/pageflow_paged/engine.rb +17 -1
- 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 +3 -4
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +13 -6
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +2 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/cache_helper.rb +11 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/entry_json_seed_helper.rb +42 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +3 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +31 -10
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +9 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +3 -1
- data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +23 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +6 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -5
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/sections/_section_with_content_elements.json.jbuilder +10 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +44 -41
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_consent_vendors.json.jbuilder +16 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +3 -0
- data/entry_types/scrolled/config/initializers/features.rb +5 -0
- data/entry_types/scrolled/config/locales/consent_widget.de.yml +4 -0
- data/entry_types/scrolled/config/locales/consent_widget.en.yml +4 -0
- data/entry_types/scrolled/config/locales/de.yml +189 -8
- data/entry_types/scrolled/config/locales/en.yml +207 -2
- data/entry_types/scrolled/config/routes.rb +4 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +97 -5
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +1 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +96 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/content_element_consent_vendors.rb +38 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +17 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +24 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +6 -1
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +1 -2
- data/entry_types/scrolled/package/contentElements-editor.js +307 -22
- data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
- data/entry_types/scrolled/package/contentElements-frontend.js +690 -71
- data/entry_types/scrolled/package/editor.js +616 -220
- data/entry_types/scrolled/package/frontend/{EditableInlineText.module-14c7b097.js → EditableInlineText.module-fa9e3aff.js} +1669 -1674
- data/entry_types/scrolled/package/frontend/PhonePlatformContext-10a1d600.js +32 -0
- data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-727cce0d.js +107 -0
- data/entry_types/scrolled/package/frontend/Viewer-169e14ca.js +154 -0
- data/entry_types/scrolled/package/frontend/{Viewer-b6becc57.js → Viewer-ee1aa590.js} +32 -161
- data/entry_types/scrolled/package/frontend/arrowRight-92a34ccc.js +77 -0
- data/entry_types/scrolled/package/frontend/{components-b3160dd7.js → components-4a09bfa3.js} +185 -45
- data/entry_types/scrolled/package/frontend/{PhonePlatformContext-f6093cc6.js → i18n-ddd92820.js} +149 -107
- data/entry_types/scrolled/package/frontend/index-02378634.js +118 -0
- data/entry_types/scrolled/package/frontend/index.css +1 -1
- data/entry_types/scrolled/package/frontend/index.js +206 -54
- data/entry_types/scrolled/package/frontend/useContentElementEditorState-63045393.js +52 -0
- data/entry_types/scrolled/package/package.json +2 -1
- data/entry_types/scrolled/package/testHelpers.js +9 -2
- data/entry_types/scrolled/package/values/colors.module.css +15 -0
- data/entry_types/scrolled/package/widgets/consentBar.css +1 -0
- data/entry_types/scrolled/package/widgets/consentBar.js +426 -0
- data/entry_types/scrolled/package/widgets/defaultNavigation.css +1 -1
- data/lib/generators/pageflow/resque/resque_generator.rb +1 -1
- data/lib/pageflow/ability_mixin.rb +5 -5
- data/lib/pageflow/active_admin_can_can_fix.rb +2 -2
- data/lib/pageflow/built_in_file_type.rb +7 -0
- data/lib/pageflow/configuration.rb +21 -0
- data/lib/pageflow/engine.rb +60 -39
- data/lib/pageflow/entry_export_import/revision_serialization.rb +1 -1
- data/lib/pageflow/file_type.rb +2 -2
- data/lib/pageflow/global_config_api.rb +2 -2
- data/lib/pageflow/nested_revision_component.rb +23 -5
- data/lib/pageflow/rails_version.rb +19 -0
- data/lib/pageflow/seeds.rb +10 -7
- data/lib/pageflow/version.rb +1 -1
- data/lib/pageflow/widget_types.rb +4 -0
- data/package/config/webpack5.js +14 -0
- data/package/editor.js +141 -30
- data/package/frontend.js +26 -2
- data/package/testHelpers.js +1 -1
- data/package/ui.js +296 -71
- data/spec/factories/entries.rb +17 -3
- data/spec/factories/sites.rb +3 -0
- data/vendor/assets/javascripts/iscroll.js +4 -7
- metadata +65 -49
- data/app/helpers/pageflow/admin/permalinks_helper.rb +0 -15
- data/entry_types/scrolled/package/frontend/arrowRight-78a7cee4.js +0 -42
data/entry_types/scrolled/package/frontend/{PhonePlatformContext-f6093cc6.js → i18n-ddd92820.js}
RENAMED
@@ -1,9 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
import React, { useReducer, useMemo, useCallback, createContext as createContext$1, useContext, useState, useEffect } from 'react';
|
3
|
-
import I18n from 'i18n-js';
|
1
|
+
import React, { useReducer, useMemo, useCallback, createContext as createContext$1, useContext } from 'react';
|
4
2
|
import { createContext, useContextSelector } from 'use-context-selector';
|
5
3
|
import { createSelectorCreator, defaultMemoize, createSelector } from 'reselect';
|
6
4
|
import slugify from 'slugify';
|
5
|
+
import I18n from 'i18n-js';
|
7
6
|
|
8
7
|
function _arrayWithHoles(arr) {
|
9
8
|
if (Array.isArray(arr)) return arr;
|
@@ -112,6 +111,22 @@ function _objectSpread2(target) {
|
|
112
111
|
return target;
|
113
112
|
}
|
114
113
|
|
114
|
+
function _arrayWithoutHoles(arr) {
|
115
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
116
|
+
}
|
117
|
+
|
118
|
+
function _iterableToArray(iter) {
|
119
|
+
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
120
|
+
}
|
121
|
+
|
122
|
+
function _nonIterableSpread() {
|
123
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
124
|
+
}
|
125
|
+
|
126
|
+
function _toConsumableArray(arr) {
|
127
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
128
|
+
}
|
129
|
+
|
115
130
|
var PREFIX = 'PAGEFLOW_SCROLLED_COLLECTION';
|
116
131
|
var RESET = "".concat(PREFIX, "_RESET");
|
117
132
|
var ADD = "".concat(PREFIX, "_ADD");
|
@@ -215,6 +230,22 @@ function getItem(state, collectionName, key) {
|
|
215
230
|
return state[collectionName].items[key];
|
216
231
|
}
|
217
232
|
}
|
233
|
+
function createMultipleItemsSelector(collectionNames, filter) {
|
234
|
+
return createSelector.apply(void 0, _toConsumableArray(collectionNames.map(function (collectionName) {
|
235
|
+
return function (collections) {
|
236
|
+
return collections[collectionName];
|
237
|
+
};
|
238
|
+
})).concat([function () {
|
239
|
+
for (var _len = arguments.length, collections = new Array(_len), _key = 0; _key < _len; _key++) {
|
240
|
+
collections[_key] = arguments[_key];
|
241
|
+
}
|
242
|
+
|
243
|
+
return collectionNames.reduce(function (result, collectionName, index) {
|
244
|
+
result[collectionName] = toOrderedItems(collections[index]);
|
245
|
+
return result;
|
246
|
+
}, {});
|
247
|
+
}]));
|
248
|
+
}
|
218
249
|
function createItemsSelector(collectionName, filter) {
|
219
250
|
if (filter) {
|
220
251
|
var itemsSelector = createItemsSelector(collectionName);
|
@@ -227,17 +258,20 @@ function createItemsSelector(collectionName, filter) {
|
|
227
258
|
|
228
259
|
return createSelector(function (collections) {
|
229
260
|
return collections[collectionName];
|
230
|
-
},
|
231
|
-
if (collection) {
|
232
|
-
var items = collection.items;
|
233
|
-
return collection.order.map(function (key) {
|
234
|
-
return items[key];
|
235
|
-
});
|
236
|
-
} else {
|
237
|
-
return [];
|
238
|
-
}
|
239
|
-
});
|
261
|
+
}, toOrderedItems);
|
240
262
|
}
|
263
|
+
|
264
|
+
function toOrderedItems(collection) {
|
265
|
+
if (collection) {
|
266
|
+
var items = collection.items;
|
267
|
+
return collection.order.map(function (key) {
|
268
|
+
return items[key];
|
269
|
+
});
|
270
|
+
} else {
|
271
|
+
return [];
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
241
275
|
var createShallowEqualArraysSelector = createSelectorCreator(defaultMemoize, shallowEqualArrays);
|
242
276
|
|
243
277
|
function shallowEqualArrays(a, b) {
|
@@ -304,6 +338,14 @@ function useEntryStateCollectionItems(collectionName, filter) {
|
|
304
338
|
return itemsSelector(entryState.collections);
|
305
339
|
});
|
306
340
|
}
|
341
|
+
function useMultipleEntryStateCollectionItems(collectionNames) {
|
342
|
+
var multipleItemsSelector = useMemo(function () {
|
343
|
+
return createMultipleItemsSelector(collectionNames);
|
344
|
+
}, [collectionNames]);
|
345
|
+
return useEntryState(function (entryState) {
|
346
|
+
return multipleItemsSelector(entryState.collections);
|
347
|
+
});
|
348
|
+
}
|
307
349
|
|
308
350
|
/**
|
309
351
|
* Returns data generated by a Ruby lambda registered server
|
@@ -324,6 +366,15 @@ function useAdditionalSeedData(name) {
|
|
324
366
|
return config.additionalSeedData[name];
|
325
367
|
}
|
326
368
|
|
369
|
+
function useContentElementConsentVendor(_ref) {
|
370
|
+
var contentElementId = _ref.contentElementId;
|
371
|
+
var config = useEntryStateConfig();
|
372
|
+
var vendorName = config.contentElementConsentVendors[contentElementId];
|
373
|
+
return config.consentVendors.find(function (vendor) {
|
374
|
+
return vendor.name === vendorName;
|
375
|
+
});
|
376
|
+
}
|
377
|
+
|
327
378
|
/**
|
328
379
|
* Returns a nested data structure representing the metadata of the entry.
|
329
380
|
*
|
@@ -600,21 +651,52 @@ function sectionData(section) {
|
|
600
651
|
}
|
601
652
|
|
602
653
|
function useSectionContentElements(_ref2) {
|
603
|
-
var sectionId = _ref2.sectionId
|
654
|
+
var sectionId = _ref2.sectionId,
|
655
|
+
layout = _ref2.layout;
|
604
656
|
var filterBySectionId = useCallback(function (contentElement) {
|
605
657
|
return contentElement.sectionId === sectionId;
|
606
658
|
}, [sectionId]);
|
607
659
|
var contentElements = useEntryStateCollectionItems('contentElements', filterBySectionId);
|
608
|
-
return contentElements.map(function (
|
660
|
+
return contentElements.map(function (contentElement) {
|
661
|
+
var position = getPosition(contentElement, layout);
|
609
662
|
return {
|
610
|
-
id:
|
611
|
-
permaId:
|
612
|
-
type:
|
613
|
-
position:
|
614
|
-
|
663
|
+
id: contentElement.id,
|
664
|
+
permaId: contentElement.permaId,
|
665
|
+
type: contentElement.typeName,
|
666
|
+
position: position,
|
667
|
+
width: getWidth(contentElement, position),
|
668
|
+
props: contentElement.configuration
|
615
669
|
};
|
616
670
|
});
|
617
671
|
}
|
672
|
+
var supportedPositions = {
|
673
|
+
center: ['inline', 'left', 'right'],
|
674
|
+
centerRagged: ['inline', 'left', 'right'],
|
675
|
+
left: ['inline', 'sticky'],
|
676
|
+
right: ['inline', 'sticky']
|
677
|
+
};
|
678
|
+
|
679
|
+
function getPosition(contentElement, layout) {
|
680
|
+
var position = contentElement.configuration.position;
|
681
|
+
return supportedPositions[layout || 'left'].includes(position) ? position : 'inline';
|
682
|
+
}
|
683
|
+
|
684
|
+
var legacyPositionWidths = {
|
685
|
+
wide: 2,
|
686
|
+
full: 3
|
687
|
+
};
|
688
|
+
var clampedWidthPositions = ['sticky', 'left', 'right'];
|
689
|
+
|
690
|
+
function getWidth(contentElement, position) {
|
691
|
+
var width = typeof contentElement.configuration.width === 'number' ? contentElement.configuration.width : legacyPositionWidths[contentElement.configuration.position] || 0;
|
692
|
+
|
693
|
+
if (clampedWidthPositions.includes(position)) {
|
694
|
+
return Math.min(Math.max(width || 0, -2), 2);
|
695
|
+
} else {
|
696
|
+
return width;
|
697
|
+
}
|
698
|
+
}
|
699
|
+
|
618
700
|
function useChapter(_ref3) {
|
619
701
|
var permaId = _ref3.permaId;
|
620
702
|
var chapters = useChapters();
|
@@ -686,7 +768,7 @@ function expandUrls(collectionName, file, urlTemplates) {
|
|
686
768
|
throw new Error("No file url templates found for ".concat(collectionName));
|
687
769
|
}
|
688
770
|
|
689
|
-
var variants = file.variants
|
771
|
+
var variants = file.variants ? ['original'].concat(_toConsumableArray(file.variants)) : Object.keys(urlTemplates[collectionName]);
|
690
772
|
var urls = variants.reduce(function (result, variant) {
|
691
773
|
var url = getFileUrl(collectionName, file, variant, urlTemplates);
|
692
774
|
|
@@ -782,28 +864,31 @@ function getFileUrlTemplateHost(seed, collectionName, variant) {
|
|
782
864
|
|
783
865
|
/**
|
784
866
|
* Returns a string (comma-separated list) of copyrights of
|
785
|
-
* all
|
786
|
-
* If none of the
|
867
|
+
* all files used in the entry.
|
868
|
+
* If none of the files has a rights attribute configured,
|
787
869
|
* it falls back to the default file rights of the entry's account,
|
788
870
|
* otherwise returns an empty string
|
789
871
|
*
|
790
872
|
* @example
|
791
873
|
*
|
792
874
|
* const fileRights = useFileRights();
|
793
|
-
* fileRights // => "author of image 1, author of
|
875
|
+
* fileRights // => "author of image 1, author of video 2"
|
794
876
|
*/
|
795
877
|
|
796
878
|
function useFileRights() {
|
797
879
|
var _config$defaultFileRi;
|
798
880
|
|
799
881
|
var config = useEntryStateConfig();
|
800
|
-
var
|
882
|
+
var fileCollectionNames = Object.keys(config.fileModelTypes);
|
883
|
+
var files = useMultipleEntryStateCollectionItems(fileCollectionNames);
|
801
884
|
var defaultFileRights = (_config$defaultFileRi = config.defaultFileRights) === null || _config$defaultFileRi === void 0 ? void 0 : _config$defaultFileRi.trim();
|
802
|
-
return Array.from(new Set(
|
803
|
-
|
885
|
+
return Array.from(new Set(Object.keys(files).flatMap(function (key) {
|
886
|
+
return files[key].map(function (file) {
|
887
|
+
var _file$rights;
|
804
888
|
|
805
|
-
|
806
|
-
|
889
|
+
return ((_file$rights = file.rights) === null || _file$rights === void 0 ? void 0 : _file$rights.trim()) || defaultFileRights;
|
890
|
+
});
|
891
|
+
}))).sort().filter(Boolean).join(', ');
|
807
892
|
}
|
808
893
|
/**
|
809
894
|
* Returns a nested data structure representing the legal info of the entry.
|
@@ -854,22 +939,6 @@ function useCredits() {
|
|
854
939
|
return credits;
|
855
940
|
}
|
856
941
|
|
857
|
-
function _arrayWithoutHoles(arr) {
|
858
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
859
|
-
}
|
860
|
-
|
861
|
-
function _iterableToArray(iter) {
|
862
|
-
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
863
|
-
}
|
864
|
-
|
865
|
-
function _nonIterableSpread() {
|
866
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
867
|
-
}
|
868
|
-
|
869
|
-
function _toConsumableArray(arr) {
|
870
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
871
|
-
}
|
872
|
-
|
873
942
|
var qualities = ['medium', 'fullhd', '4k'];
|
874
943
|
function useAvailableQualities(file) {
|
875
944
|
if (!file) {
|
@@ -927,6 +996,40 @@ function updateContentElementConfiguration(_ref) {
|
|
927
996
|
});
|
928
997
|
}
|
929
998
|
|
999
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
1000
|
+
if (source == null) return {};
|
1001
|
+
var target = {};
|
1002
|
+
var sourceKeys = Object.keys(source);
|
1003
|
+
var key, i;
|
1004
|
+
|
1005
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
1006
|
+
key = sourceKeys[i];
|
1007
|
+
if (excluded.indexOf(key) >= 0) continue;
|
1008
|
+
target[key] = source[key];
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
return target;
|
1012
|
+
}
|
1013
|
+
|
1014
|
+
function _objectWithoutProperties(source, excluded) {
|
1015
|
+
if (source == null) return {};
|
1016
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
1017
|
+
var key, i;
|
1018
|
+
|
1019
|
+
if (Object.getOwnPropertySymbols) {
|
1020
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
1021
|
+
|
1022
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
1023
|
+
key = sourceSymbolKeys[i];
|
1024
|
+
if (excluded.indexOf(key) >= 0) continue;
|
1025
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
1026
|
+
target[key] = source[key];
|
1027
|
+
}
|
1028
|
+
}
|
1029
|
+
|
1030
|
+
return target;
|
1031
|
+
}
|
1032
|
+
|
930
1033
|
var LocaleContext = createContext$1('en');
|
931
1034
|
function setupI18n(_ref) {
|
932
1035
|
var defaultLocale = _ref.defaultLocale,
|
@@ -985,65 +1088,4 @@ function useI18n() {
|
|
985
1088
|
};
|
986
1089
|
}
|
987
1090
|
|
988
|
-
|
989
|
-
if (source == null) return {};
|
990
|
-
var target = {};
|
991
|
-
var sourceKeys = Object.keys(source);
|
992
|
-
var key, i;
|
993
|
-
|
994
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
995
|
-
key = sourceKeys[i];
|
996
|
-
if (excluded.indexOf(key) >= 0) continue;
|
997
|
-
target[key] = source[key];
|
998
|
-
}
|
999
|
-
|
1000
|
-
return target;
|
1001
|
-
}
|
1002
|
-
|
1003
|
-
function _objectWithoutProperties(source, excluded) {
|
1004
|
-
if (source == null) return {};
|
1005
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
1006
|
-
var key, i;
|
1007
|
-
|
1008
|
-
if (Object.getOwnPropertySymbols) {
|
1009
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
1010
|
-
|
1011
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
1012
|
-
key = sourceSymbolKeys[i];
|
1013
|
-
if (excluded.indexOf(key) >= 0) continue;
|
1014
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
1015
|
-
target[key] = source[key];
|
1016
|
-
}
|
1017
|
-
}
|
1018
|
-
|
1019
|
-
return target;
|
1020
|
-
}
|
1021
|
-
|
1022
|
-
var BrowserFeaturesAvailableContext = createContext$1(); // Browser feature detection is not available during server side
|
1023
|
-
// rendering. To prevent mismatches during hydration, we keep features
|
1024
|
-
// disabled in the initial render. Since hydration only starts after
|
1025
|
-
// feature detection has finished, we can immediately re-render once
|
1026
|
-
// the provider has mounted.
|
1027
|
-
|
1028
|
-
function BrowserFeaturesProvider(_ref) {
|
1029
|
-
var children = _ref.children;
|
1030
|
-
|
1031
|
-
var _useState = useState(false),
|
1032
|
-
_useState2 = _slicedToArray(_useState, 2),
|
1033
|
-
isAvailable = _useState2[0],
|
1034
|
-
setIsAvailable = _useState2[1];
|
1035
|
-
|
1036
|
-
useEffect(function () {
|
1037
|
-
return setIsAvailable(true);
|
1038
|
-
}, []);
|
1039
|
-
return /*#__PURE__*/React.createElement(BrowserFeaturesAvailableContext.Provider, {
|
1040
|
-
value: isAvailable
|
1041
|
-
}, children);
|
1042
|
-
}
|
1043
|
-
function useBrowserFeature(name) {
|
1044
|
-
return useContext(BrowserFeaturesAvailableContext) && browser.has(name);
|
1045
|
-
}
|
1046
|
-
|
1047
|
-
var PhonePlatformContext = React.createContext(false);
|
1048
|
-
|
1049
|
-
export { useShareProviders as A, BrowserFeaturesProvider as B, useShareUrl as C, updateContentElementConfiguration as D, EntryStateProvider as E, _unsupportedIterableToArray as F, LocaleProvider as L, PhonePlatformContext as P, _objectWithoutProperties as _, _objectSpread2 as a, _defineProperty as b, _slicedToArray as c, useLocale as d, useLegalInfo as e, useTheme as f, useEntryMetadata as g, useNestedFiles as h, useFile as i, _toConsumableArray as j, useSectionContentElements as k, useAdditionalSeedData as l, useSectionsWithChapter as m, useBrowserFeature as n, useEntryStateDispatch as o, useSection as p, useChapter as q, useEntryStructure as r, useWidget as s, getFileUrlTemplateHost as t, useI18n as u, useAvailableQualities as v, setupI18n as w, useChapters as x, useCredits as y, useFileRights as z };
|
1091
|
+
export { useShareUrl as A, useLocale as B, updateContentElementConfiguration as C, _unsupportedIterableToArray as D, EntryStateProvider as E, LocaleProvider as L, _slicedToArray as _, _objectSpread2 as a, _defineProperty as b, useEntryMetadata as c, useNestedFiles as d, _objectWithoutProperties as e, useFile as f, useTheme as g, useSectionContentElements as h, useAdditionalSeedData as i, useSectionsWithChapter as j, useContentElementConsentVendor as k, _toConsumableArray as l, useChapter as m, useEntryStateDispatch as n, useSection as o, useEntryStructure as p, useWidget as q, getFileUrlTemplateHost as r, useAvailableQualities as s, setupI18n as t, useI18n as u, useChapters as v, useCredits as w, useFileRights as x, useLegalInfo as y, useShareProviders as z };
|
@@ -0,0 +1,118 @@
|
|
1
|
+
import React, { useMemo, useEffect, useState, useCallback } from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
3
|
+
import { _ as _slicedToArray, b as _defineProperty } from './i18n-ddd92820.js';
|
4
|
+
import classNames from 'classnames';
|
5
|
+
import { u as useDelayedBoolean } from './useContentElementEditorState-63045393.js';
|
6
|
+
import { T as ToggleFullscreenCornerButton } from './ToggleFullscreenCornerButton-727cce0d.js';
|
7
|
+
|
8
|
+
var styles = {"wrapper":"Fullscreen-module_wrapper__2MP7f"};
|
9
|
+
|
10
|
+
function Fullscreen(_ref) {
|
11
|
+
var children = _ref.children;
|
12
|
+
var root = useMemo(function () {
|
13
|
+
return document.getElementById('fullscreenRoot');
|
14
|
+
}, []);
|
15
|
+
useEffect(function () {
|
16
|
+
var resetScrollbarPadding = adjustScrollbarPadding(function () {
|
17
|
+
document.getElementById('root').setAttribute('inert', true);
|
18
|
+
document.body.style.overflow = 'hidden';
|
19
|
+
});
|
20
|
+
return function () {
|
21
|
+
resetScrollbarPadding();
|
22
|
+
document.getElementById('root').removeAttribute('inert', true);
|
23
|
+
document.body.style.overflow = 'initial';
|
24
|
+
};
|
25
|
+
}, []);
|
26
|
+
return ReactDOM.createPortal( /*#__PURE__*/React.createElement("div", {
|
27
|
+
className: styles.wrapper
|
28
|
+
}, children), root);
|
29
|
+
} // Adapted from
|
30
|
+
// https://github.com/tailwindlabs/headlessui/blob/9dff5456fa196cdc304e2ed17ef47962a9364ce7/packages/%40headlessui-react/src/hooks/document-overflow/adjust-scrollbar-padding.ts
|
31
|
+
|
32
|
+
function adjustScrollbarPadding(hideScrollbar) {
|
33
|
+
var documentElement = document.documentElement;
|
34
|
+
var ownerWindow = document.defaultView || window;
|
35
|
+
var scrollbarWidthBefore = ownerWindow.innerWidth - documentElement.clientWidth;
|
36
|
+
hideScrollbar();
|
37
|
+
var scrollbarWidthAfter = documentElement.clientWidth - documentElement.offsetWidth;
|
38
|
+
var scrollbarWidth = scrollbarWidthBefore - scrollbarWidthAfter;
|
39
|
+
document.documentElement.style.paddingRight = "".concat(scrollbarWidth, "px");
|
40
|
+
return function () {
|
41
|
+
return document.documentElement.style.paddingRight = '0';
|
42
|
+
};
|
43
|
+
}
|
44
|
+
|
45
|
+
var styles$1 = {"wrapper":"index-module_wrapper__ilo7n","visible":"index-module_visible__6QUDn"};
|
46
|
+
|
47
|
+
function FullscreenViewer(_ref) {
|
48
|
+
var contentElementId = _ref.contentElementId,
|
49
|
+
renderChildren = _ref.renderChildren,
|
50
|
+
renderFullscreenChildren = _ref.renderFullscreenChildren;
|
51
|
+
|
52
|
+
var _useState = useState(false),
|
53
|
+
_useState2 = _slicedToArray(_useState, 2),
|
54
|
+
isFullscreen = _useState2[0],
|
55
|
+
setIsFullscreen = _useState2[1];
|
56
|
+
|
57
|
+
var isRendered = useDelayedBoolean(isFullscreen, {
|
58
|
+
fromTrueToFalse: 200
|
59
|
+
});
|
60
|
+
var isVisible = useDelayedBoolean(isFullscreen, {
|
61
|
+
fromFalseToTrue: 1
|
62
|
+
});
|
63
|
+
useEffect(function () {
|
64
|
+
function handlePopState() {
|
65
|
+
var _window$history$state;
|
66
|
+
|
67
|
+
setIsFullscreen(((_window$history$state = window.history.state) === null || _window$history$state === void 0 ? void 0 : _window$history$state.fullscreenContentElementId) === contentElementId);
|
68
|
+
}
|
69
|
+
|
70
|
+
window.addEventListener('popstate', handlePopState);
|
71
|
+
return function () {
|
72
|
+
return window.removeEventListener('popstate', handlePopState);
|
73
|
+
};
|
74
|
+
});
|
75
|
+
var enterFullscreen = useCallback(function () {
|
76
|
+
setIsFullscreen(true);
|
77
|
+
|
78
|
+
if (window.parent === window) {
|
79
|
+
window.history.pushState({
|
80
|
+
fullscreenContentElementId: contentElementId
|
81
|
+
}, '');
|
82
|
+
}
|
83
|
+
}, [contentElementId]);
|
84
|
+
var exitFullscreen = useCallback(function () {
|
85
|
+
var _window$history$state2;
|
86
|
+
|
87
|
+
setIsFullscreen(false);
|
88
|
+
|
89
|
+
if (((_window$history$state2 = window.history.state) === null || _window$history$state2 === void 0 ? void 0 : _window$history$state2.fullscreenContentElementId) === contentElementId && window.parent === window) {
|
90
|
+
window.history.back();
|
91
|
+
}
|
92
|
+
}, [contentElementId]);
|
93
|
+
useEffect(function () {
|
94
|
+
function handleKeyDown(event) {
|
95
|
+
if (event.key === 'Escape') {
|
96
|
+
exitFullscreen();
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
window.addEventListener('keydown', handleKeyDown);
|
101
|
+
return function () {
|
102
|
+
return window.removeEventListener('keydown', handleKeyDown);
|
103
|
+
};
|
104
|
+
}, [exitFullscreen]);
|
105
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderChildren({
|
106
|
+
enterFullscreen: enterFullscreen,
|
107
|
+
isFullscreen: isFullscreen
|
108
|
+
}), isRendered && /*#__PURE__*/React.createElement(Fullscreen, null, /*#__PURE__*/React.createElement("div", {
|
109
|
+
className: classNames(styles$1.wrapper, _defineProperty({}, styles$1.visible, isVisible))
|
110
|
+
}, renderFullscreenChildren({
|
111
|
+
exitFullscreen: exitFullscreen
|
112
|
+
}), /*#__PURE__*/React.createElement(ToggleFullscreenCornerButton, {
|
113
|
+
isFullscreen: true,
|
114
|
+
onExit: exitFullscreen
|
115
|
+
}))));
|
116
|
+
}
|
117
|
+
|
118
|
+
export { FullscreenViewer as F };
|