pageflow 17.0.5 → 17.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +362 -35
- data/README.md +0 -1
- data/admins/pageflow/accounts.rb +16 -14
- data/admins/pageflow/entry.rb +68 -20
- data/admins/pageflow/entry_templates.rb +10 -9
- data/admins/pageflow/folder.rb +1 -1
- data/admins/pageflow/membership.rb +4 -4
- data/admins/pageflow/revisions.rb +5 -5
- data/admins/pageflow/site_root_entry.rb +64 -0
- data/admins/pageflow/sites.rb +12 -3
- data/admins/pageflow/translations.rb +75 -0
- data/admins/pageflow/user.rb +21 -35
- data/app/assets/javascripts/pageflow/admin/entries.js +30 -5
- data/app/assets/javascripts/pageflow/dist/ui.js +2865 -257
- data/app/assets/stylesheets/pageflow/admin/entries/index_table.scss +2 -1
- data/app/assets/stylesheets/pageflow/admin/permalink_input.scss +2 -1
- data/app/assets/stylesheets/pageflow/editor/background_positioning.scss +6 -0
- data/app/assets/stylesheets/pageflow/editor/base.scss +2 -0
- data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +7 -1
- data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +5 -1
- data/app/assets/stylesheets/pageflow/editor/files.scss +28 -16
- data/app/assets/stylesheets/pageflow/editor/filtered_files.scss +24 -0
- data/app/assets/stylesheets/pageflow/editor/info_box.scss +11 -3
- data/app/assets/stylesheets/pageflow/editor/list.scss +6 -4
- data/app/assets/stylesheets/pageflow/editor/list_search_field.scss +52 -0
- data/app/assets/stylesheets/pageflow/editor/outline.scss +0 -13
- data/app/assets/stylesheets/pageflow/editor/select_button.scss +1 -1
- data/app/assets/stylesheets/pageflow/editor/sortable.scss +12 -0
- data/app/assets/stylesheets/pageflow/mixins/buttons.scss +4 -4
- data/app/assets/stylesheets/pageflow/ui/forms.scss +4 -0
- data/app/assets/stylesheets/pageflow/ui/input/color_input.scss +8 -0
- data/app/assets/stylesheets/pageflow/ui/input/file_name_input.scss +37 -0
- data/app/assets/stylesheets/pageflow/ui/properties.scss +5 -0
- data/app/assets/stylesheets/pageflow/ui.scss +1 -0
- data/app/controllers/concerns/pageflow/controller_delegation.rb +1 -1
- data/app/controllers/concerns/pageflow/edit_locking.rb +17 -10
- data/app/controllers/concerns/pageflow/entry_password_protection.rb +1 -0
- data/app/controllers/concerns/pageflow/public_https_mode.rb +2 -1
- data/app/controllers/concerns/pageflow/quota_verification.rb +5 -4
- data/app/controllers/pageflow/admin/initial_passwords_controller.rb +1 -0
- data/app/controllers/pageflow/application_controller.rb +19 -19
- data/app/controllers/pageflow/chapters_controller.rb +3 -2
- data/app/controllers/pageflow/edit_locks_controller.rb +3 -2
- data/app/controllers/pageflow/editor/encoding_confirmations_controller.rb +1 -0
- data/app/controllers/pageflow/editor/entries_controller.rb +2 -1
- data/app/controllers/pageflow/editor/entry_publications_controller.rb +1 -0
- data/app/controllers/pageflow/editor/file_import_controller.rb +3 -3
- data/app/controllers/pageflow/editor/files_controller.rb +7 -6
- data/app/controllers/pageflow/editor/widgets_controller.rb +1 -0
- data/app/controllers/pageflow/entries_controller.rb +77 -17
- data/app/controllers/pageflow/feeds_controller.rb +1 -1
- data/app/controllers/pageflow/files_controller.rb +1 -0
- data/app/controllers/pageflow/pages_controller.rb +4 -2
- data/app/controllers/pageflow/revisions_controller.rb +2 -1
- data/app/controllers/pageflow/sitemaps_controller.rb +1 -1
- data/app/controllers/pageflow/storylines_controller.rb +1 -0
- data/app/helpers/pageflow/admin/cutoff_modes_helper.rb +12 -0
- data/app/helpers/pageflow/admin/entries_helper.rb +1 -1
- data/app/helpers/pageflow/admin/entry_translations_helper.rb +18 -0
- data/app/helpers/pageflow/admin/features_helper.rb +1 -1
- data/app/helpers/pageflow/admin/form_helper.rb +3 -3
- data/app/helpers/pageflow/admin/locales_helper.rb +10 -2
- data/app/helpers/pageflow/admin/memberships_helper.rb +32 -32
- data/app/helpers/pageflow/admin/revisions_helper.rb +1 -1
- data/app/helpers/pageflow/admin/sites_helper.rb +22 -0
- data/app/helpers/pageflow/admin/users_helper.rb +7 -5
- data/app/helpers/pageflow/admin/widgets_helper.rb +3 -3
- data/app/helpers/pageflow/asset_urls_helper.rb +1 -1
- data/app/helpers/pageflow/audio_files_helper.rb +5 -2
- data/app/helpers/pageflow/background_image_helper.rb +7 -6
- data/app/helpers/pageflow/common_entry_seed_helper.rb +2 -4
- data/app/helpers/pageflow/editor/config_helper.rb +1 -1
- data/app/helpers/pageflow/editor/files_helper.rb +1 -1
- data/app/helpers/pageflow/embed_code_helper.rb +3 -3
- data/app/helpers/pageflow/entries_helper.rb +58 -34
- data/app/helpers/pageflow/entry_json_seed_helper.rb +3 -2
- data/app/helpers/pageflow/feeds_helper.rb +2 -2
- data/app/helpers/pageflow/file_background_images_helper.rb +2 -2
- data/app/helpers/pageflow/file_thumbnails_helper.rb +4 -3
- data/app/helpers/pageflow/files_helper.rb +5 -4
- data/app/helpers/pageflow/folders_helper.rb +8 -5
- data/app/helpers/pageflow/help_entries_helper.rb +2 -2
- data/app/helpers/pageflow/hreflang_links_helper.rb +37 -0
- data/app/helpers/pageflow/info_box_helper.rb +7 -11
- data/app/helpers/pageflow/media_query_helper.rb +3 -3
- data/app/helpers/pageflow/navigation_bar_helper.rb +1 -1
- data/app/helpers/pageflow/overview_helper.rb +1 -1
- data/app/helpers/pageflow/page_types_helper.rb +5 -5
- data/app/helpers/pageflow/pages_helper.rb +29 -15
- data/app/helpers/pageflow/public_i18n_helper.rb +1 -1
- data/app/helpers/pageflow/quota_helper.rb +4 -4
- data/app/helpers/pageflow/render_json_helper.rb +6 -3
- data/app/helpers/pageflow/revision_file_helper.rb +2 -1
- data/app/helpers/pageflow/sites_helper.rb +3 -3
- data/app/helpers/pageflow/social_share_helper.rb +24 -10
- data/app/helpers/pageflow/social_share_links_helper.rb +12 -9
- data/app/helpers/pageflow/structured_data_helper.rb +1 -1
- data/app/helpers/pageflow/stub_page_configuration.rb +7 -3
- data/app/helpers/pageflow/text_direction_helper.rb +1 -1
- data/app/helpers/pageflow/themes_helper.rb +1 -1
- data/app/helpers/pageflow/video_files_helper.rb +29 -13
- data/app/helpers/pageflow/widgets_helper.rb +7 -6
- data/app/inputs/pageflow_permalink_input.rb +3 -2
- data/app/jobs/pageflow/application_job.rb +1 -0
- data/app/jobs/pageflow/entry_export_import/upload_and_publish_file_job.rb +1 -1
- data/app/jobs/pageflow/poll_meta_data_from_zencoder_job.rb +1 -0
- data/app/jobs/pageflow/poll_zencoder_job.rb +3 -2
- data/app/jobs/pageflow/process_image_or_text_track_job.rb +1 -0
- data/app/jobs/pageflow/prune_auto_snapshots_job.rb +1 -0
- data/app/jobs/pageflow/request_meta_data_from_zencoder_job.rb +1 -0
- data/app/jobs/pageflow/submit_file_to_zencoder_job.rb +1 -0
- data/app/mailers/pageflow/user_mailer.rb +1 -0
- data/app/models/concerns/pageflow/auto_generated_perma_id.rb +13 -1
- data/app/models/concerns/pageflow/entry_publication_states.rb +7 -3
- data/app/models/concerns/pageflow/feature_target.rb +8 -4
- data/app/models/concerns/pageflow/output_source.rb +3 -3
- data/app/models/concerns/pageflow/permalinkable.rb +2 -1
- data/app/models/concerns/pageflow/reusable_file.rb +23 -23
- data/app/models/concerns/pageflow/serialization_blacklist.rb +1 -1
- data/app/models/concerns/pageflow/suspendable.rb +5 -3
- data/app/models/concerns/pageflow/theme_referencer.rb +1 -1
- data/app/models/concerns/pageflow/translatable.rb +62 -0
- data/app/models/concerns/pageflow/uploadable_file.rb +6 -6
- data/app/models/pageflow/account.rb +6 -5
- data/app/models/pageflow/account_member_query.rb +1 -1
- data/app/models/pageflow/account_role_query.rb +1 -1
- data/app/models/pageflow/application_query.rb +1 -1
- data/app/models/pageflow/application_record.rb +1 -1
- data/app/models/pageflow/audio_file.rb +4 -4
- data/app/models/pageflow/audio_file_url_templates.rb +1 -1
- data/app/models/pageflow/authentication_token.rb +2 -2
- data/app/models/pageflow/chapter.rb +6 -1
- data/app/models/pageflow/chapter_scaffold.rb +2 -4
- data/app/models/pageflow/cname_site_request_scope.rb +1 -1
- data/app/models/pageflow/customized_theme.rb +6 -6
- data/app/models/pageflow/draft_entry.rb +37 -9
- data/app/models/pageflow/edit_lock.rb +19 -21
- data/app/models/pageflow/encoding_confirmation.rb +2 -2
- data/app/models/pageflow/entries_feed.rb +2 -2
- data/app/models/pageflow/entry.rb +44 -30
- data/app/models/pageflow/entry_at_revision.rb +5 -1
- data/app/models/pageflow/entry_duplicate.rb +8 -5
- data/app/models/pageflow/entry_publication.rb +2 -2
- data/app/models/pageflow/entry_role_query.rb +4 -4
- data/app/models/pageflow/entry_template.rb +4 -4
- data/app/models/pageflow/entry_title_or_account_name_query.rb +2 -2
- data/app/models/pageflow/entry_translation_group.rb +42 -0
- data/app/models/pageflow/file_reuse.rb +2 -2
- data/app/models/pageflow/file_usage.rb +10 -3
- data/app/models/pageflow/folder.rb +2 -2
- data/app/models/pageflow/home_button.rb +7 -7
- data/app/models/pageflow/image_file.rb +20 -5
- data/app/models/pageflow/image_file_url_templates.rb +1 -1
- data/app/models/pageflow/invitation_form.rb +2 -1
- data/app/models/pageflow/managed_user_query.rb +1 -1
- data/app/models/pageflow/membership.rb +5 -5
- data/app/models/pageflow/nested_revision_component_copy.rb +263 -0
- data/app/models/pageflow/null_user.rb +1 -1
- data/app/models/pageflow/overview_button.rb +1 -1
- data/app/models/pageflow/page.rb +7 -3
- data/app/models/pageflow/permalink.rb +23 -2
- data/app/models/pageflow/permalink_directory.rb +7 -0
- data/app/models/pageflow/permalink_redirect.rb +7 -0
- data/app/models/pageflow/positioned_file.rb +5 -5
- data/app/models/pageflow/potential_entry_translations.rb +55 -0
- data/app/models/pageflow/potential_memberships.rb +5 -4
- data/app/models/pageflow/published_entry.rb +62 -11
- data/app/models/pageflow/revision.rb +24 -15
- data/app/models/pageflow/roles.rb +14 -18
- data/app/models/pageflow/site.rb +36 -3
- data/app/models/pageflow/site_root_entry_form.rb +27 -0
- data/app/models/pageflow/sitemaps.rb +10 -1
- data/app/models/pageflow/storyline.rb +5 -2
- data/app/models/pageflow/storyline_scaffold.rb +1 -1
- data/app/models/pageflow/text_track_file.rb +1 -1
- data/app/models/pageflow/text_track_file_url_templates.rb +1 -1
- data/app/models/pageflow/theme_customization_file.rb +3 -2
- data/app/models/pageflow/thumbnail_file_resolver.rb +1 -1
- data/app/models/pageflow/url_template.rb +1 -1
- data/app/models/pageflow/used_file.rb +7 -3
- data/app/models/pageflow/user_name_query.rb +2 -2
- data/app/models/pageflow/video_file.rb +22 -15
- data/app/models/pageflow/video_file_url_templates.rb +6 -4
- data/app/models/pageflow/widget.rb +4 -3
- data/app/models/pageflow/with_file_usage_extension.rb +1 -1
- data/app/models/pageflow/zencoder_attachment.rb +8 -8
- data/app/policies/pageflow/account_policy.rb +3 -1
- data/app/policies/pageflow/admin/admin_only_tab_policy.rb +1 -0
- data/app/policies/pageflow/admin/entry_tab_policy.rb +1 -0
- data/app/policies/pageflow/application_policy.rb +2 -0
- data/app/policies/pageflow/entry_policy.rb +7 -1
- data/app/policies/pageflow/entry_template_policy.rb +2 -1
- data/app/policies/pageflow/file_policy.rb +4 -7
- data/app/policies/pageflow/folder_policy.rb +18 -8
- data/app/policies/pageflow/membership_policy.rb +6 -4
- data/app/policies/pageflow/site_policy.rb +10 -3
- data/app/policies/pageflow/user_policy.rb +6 -4
- data/app/state_machines/pageflow/image_and_text_track_processing_state_machine.rb +3 -2
- data/app/state_machines/pageflow/media_encoding_state_machine.rb +5 -4
- data/app/views/admin/accounts/_entry_template_details.html.arb +2 -2
- data/app/views/admin/entries/_attributes_table.html.arb +6 -5
- data/app/views/admin/entries/_form.html.erb +2 -1
- data/app/views/admin/entries/_permalink_inputs.html.erb +9 -2
- data/app/views/admin/entry_templates/_form.html.erb +1 -3
- data/app/views/admin/site_root_entry/choose.html.erb +19 -0
- data/app/views/admin/sites/_fields.html.erb +14 -1
- data/app/views/admin/translations/_form.html.erb +31 -0
- data/app/views/admin/users/_attributes_table.html.arb +13 -0
- data/app/views/components/pageflow/admin/add_membership_button.rb +13 -12
- data/app/views/components/pageflow/admin/custom_scopes_renderer.rb +1 -0
- data/app/views/components/pageflow/admin/embed_code_field.rb +1 -0
- data/app/views/components/pageflow/admin/embedded_index_table.rb +9 -10
- data/app/views/components/pageflow/admin/entries_tab.rb +1 -0
- data/app/views/components/pageflow/admin/entry_publication_state_indicator.rb +6 -5
- data/app/views/components/pageflow/admin/entry_templates_tab.rb +2 -1
- data/app/views/components/pageflow/admin/entry_translations_tab.rb +102 -0
- data/app/views/components/pageflow/admin/entry_user_badge_list.rb +1 -0
- data/app/views/components/pageflow/admin/extensible_attributes_table.rb +9 -8
- data/app/views/components/pageflow/admin/features_tab.rb +1 -0
- data/app/views/components/pageflow/admin/grouped_folder_list.rb +1 -0
- data/app/views/components/pageflow/admin/icon_link_to.rb +1 -0
- data/app/views/components/pageflow/admin/members_tab.rb +4 -3
- data/app/views/components/pageflow/admin/membership_role_with_tooltip.rb +3 -2
- data/app/views/components/pageflow/admin/revisions_tab.rb +14 -10
- data/app/views/components/pageflow/admin/sites_tab.rb +1 -0
- data/app/views/components/pageflow/admin/tabs_view.rb +1 -0
- data/app/views/components/pageflow/admin/timestamp.rb +6 -5
- data/app/views/components/pageflow/admin/user_account_badge_list.rb +2 -3
- data/app/views/components/pageflow/admin/user_accounts_tab.rb +1 -0
- data/app/views/components/pageflow/admin/user_entries_tab.rb +1 -0
- data/app/views/components/pageflow/admin/users_tab.rb +1 -0
- data/app/views/pageflow/editor/config/_seeds.json.jbuilder +1 -1
- data/app/views/pageflow/editor/entries/index.json.jbuilder +1 -1
- data/app/views/pageflow/editor/entries/show.json.jbuilder +1 -1
- data/app/views/pageflow/editor/entry_publications/check.json.jbuilder +2 -2
- data/app/views/pageflow/editor/files/_file.json.jbuilder +5 -13
- data/app/views/pageflow/editor/files/create.json.jbuilder +1 -1
- data/app/views/pageflow/editor/files/index.json.jbuilder +1 -1
- data/app/views/pageflow/editor/sites/_site.json.jbuilder +1 -0
- data/app/views/pageflow/editor/video_files/_video_file.json.jbuilder +1 -3
- data/app/views/pageflow/entries/share_menu/_bluesky_link.html.erb +8 -0
- data/app/views/pageflow/entries/share_menu/_threads_link.html.erb +8 -0
- data/app/views/pageflow/files/_file.json.jbuilder +3 -3
- data/app/views/pageflow/sitemaps/index.xml.builder +9 -1
- data/app/views/pageflow/social_share/_entry_meta_tags.html.erb +1 -1
- data/app/views/pageflow/social_share/_page_meta_tags.html.erb +1 -1
- data/config/initializers/active_admin_patches.rb +3 -6
- data/config/initializers/admin_resource_tabs.rb +3 -0
- data/config/initializers/paperclip.rb +1 -0
- data/config/initializers/symmetric_encryption.rb +1 -1
- data/config/initializers/zencoder.rb +24 -13
- data/config/locales/de.yml +110 -4
- data/config/locales/en.yml +109 -7
- data/config/routes.rb +15 -13
- data/config/spring.rb +2 -1
- data/db/migrate/20140418225525_setup_schema.rb +2 -2
- data/db/migrate/20190306161431_copy_file_attributes_of_failed_uploads.rb +2 -2
- data/db/migrate/20190820152900_drop_accounts_themes.rb +2 -1
- data/db/migrate/20191202145757_create_pageflow_scrolled_sections.rb +11 -11
- data/db/migrate/20191202150657_create_pageflow_scrolled_chapters.rb +1 -1
- data/db/migrate/20191202154723_create_pageflow_scrolled_content_elements.rb +9 -9
- data/db/migrate/20191219143450_add_position_to_content_elements.rb +2 -1
- data/db/migrate/20200117133200_change_revision_appearance_option_default_and_null.rb +2 -1
- data/db/migrate/20200122115400_create_pageflow_entry_templates.rb +25 -25
- data/db/migrate/20200206134400_convert_legacy_scrolled_content_element_types.rb +3 -3
- data/db/migrate/20221215120856_associate_entry_templates_with_sites.rb +2 -2
- data/db/migrate/20230120092923_create_other_files.rb +2 -1
- data/db/migrate/20230419083307_create_pageflow_entry_translation_group.rb +9 -0
- data/db/migrate/20240612110434_add_cutoff_mode_name_to_sites.rb +5 -0
- data/db/migrate/20240918084059_create_pageflow_permalink_redirects.rb +14 -0
- data/db/migrate/20250508172234_ensure_scrolled_entries_have_main_storyline.rb +14 -0
- data/db/migrate/20250617090048_add_custom404_entry_to_sites.rb +5 -0
- data/db/migrate/20250617100000_add_perma_id_counter_to_entries.rb +28 -0
- data/db/migrate/20250722174123_add_perma_id_to_chapters.rb +10 -0
- data/db/migrate/20250725080603_add_perma_id_indexes_to_revision_components.rb +13 -0
- data/db/migrate/20250726000000_add_display_name_to_file_usages.rb +5 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +3912 -1486
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +468 -1161
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +28125 -22
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +26589 -19
- data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +1 -0
- data/entry_types/paged/app/helpers/pageflow_paged/page_background_asset_helper.rb +1 -1
- data/entry_types/paged/app/helpers/pageflow_paged/third_party_embed_consent_helper.rb +7 -7
- data/entry_types/paged/app/views/pageflow_paged/editor/entries/_seed.json.jbuilder +1 -0
- data/entry_types/paged/app/views/pageflow_paged/entries/show.html.erb +1 -0
- data/entry_types/paged/lib/pageflow_paged/plugin.rb +4 -0
- data/entry_types/paged/lib/pageflow_paged/react/page_type.rb +1 -1
- data/entry_types/paged/lib/pageflow_paged/react/widget_type.rb +3 -3
- data/entry_types/paged/lib/pageflow_paged.rb +1 -1
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +5 -3
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +2 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/cache_helper.rb +2 -2
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/entry_json_seed_helper.rb +1 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +2 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +60 -6
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +16 -2
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +21 -23
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +16 -1
- data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +15 -14
- data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +12 -0
- data/entry_types/scrolled/app/models/pageflow_scrolled/section.rb +12 -1
- data/entry_types/scrolled/app/models/pageflow_scrolled/storyline.rb +19 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/sections/_section_with_content_elements.json.jbuilder +2 -2
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +2 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +17 -9
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry_translations.json.jbuilder +14 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +25 -5
- data/entry_types/scrolled/app/views/pageflow_scrolled/storylines/_storyline.json.jbuilder +7 -0
- data/entry_types/scrolled/config/locales/de.yml +614 -45
- data/entry_types/scrolled/config/locales/en.yml +586 -47
- data/entry_types/scrolled/config/routes.rb +18 -8
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +11 -11
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDarkVariantDesktop.svg +56 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDarkVariantMobile.svg +22 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/themes_plugin.rb.tt +26 -11
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_packs.rb +27 -8
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +1 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_theme_assets.rb +27 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +16 -4
- data/entry_types/scrolled/lib/pageflow_scrolled/content_element_consent_vendors.rb +1 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +24 -4
- data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +24 -22
- data/entry_types/scrolled/lib/pageflow_scrolled.rb +1 -1
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +6 -5
- data/entry_types/scrolled/package/config/webpack.js +22 -0
- data/entry_types/scrolled/package/contentElements/hotspots-frontend.css +1 -0
- data/entry_types/scrolled/package/contentElements/hotspots-frontend.js +1529 -0
- data/entry_types/scrolled/package/contentElements/tikTokEmbed-frontend.css +1 -0
- data/entry_types/scrolled/package/contentElements/tikTokEmbed-frontend.js +59 -0
- data/entry_types/scrolled/package/contentElements-editor.js +2075 -321
- data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
- data/entry_types/scrolled/package/contentElements-frontend.js +1019 -643
- data/entry_types/scrolled/package/editor.js +2086 -1091
- data/entry_types/scrolled/package/frontend/{EditableInlineText.module-ebd22921.js → FloatingPortalRootProvider-51914be7.js} +1200 -1258
- data/entry_types/scrolled/package/frontend/{PhonePlatformContext-4ec6b2de.js → PhonePlatformContext-9f76033e.js} +7 -8
- data/entry_types/scrolled/package/frontend/ThemeIcon-81f2f066.js +1932 -0
- data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-788e9cdb.js +39 -0
- data/entry_types/scrolled/package/frontend/{Viewer-1bb5597c.js → Viewer-0345ce57.js} +36 -63
- data/entry_types/scrolled/package/frontend/{Viewer-1ecf3375.js → Viewer-cdc549cc.js} +15 -22
- data/entry_types/scrolled/package/frontend/{Wavesurfer-7d9cf1b7.js → Wavesurfer-1cdc3925.js} +54 -74
- data/entry_types/scrolled/package/frontend/{components-024a9893.js → components-96660ffd.js} +1791 -841
- data/entry_types/scrolled/package/frontend/{index-11f32f10.js → index-eb670c2f.js} +11 -18
- data/entry_types/scrolled/package/frontend/index.css +1 -1
- data/entry_types/scrolled/package/frontend/index.js +517 -903
- data/entry_types/scrolled/package/frontend/{createSuper-d0f30da3.js → inherits-539844a6.js} +40 -56
- data/entry_types/scrolled/package/frontend/{useContentElementEditorState-4f4c3cf6.js → useContentElementEditorState-77fe6c79.js} +7 -8
- data/entry_types/scrolled/package/frontend/usePhonePlatform-c2ba875d.js +8 -0
- data/entry_types/scrolled/package/frontend-server.js +0 -1
- data/entry_types/scrolled/package/package.json +18 -10
- data/entry_types/scrolled/package/testHelpers.js +306 -70
- data/entry_types/scrolled/package/values/widgets.module.css +18 -0
- data/entry_types/scrolled/package/widgets/consentBar.css +1 -1
- data/entry_types/scrolled/package/widgets/consentBar.js +47 -66
- data/entry_types/scrolled/package/widgets/defaultNavigation.css +2 -2
- data/entry_types/scrolled/package/widgets/defaultNavigation.js +177 -207
- data/entry_types/scrolled/package/widgets/excursionDialog.css +1 -0
- data/entry_types/scrolled/package/widgets/excursionDialog.js +109 -0
- data/entry_types/scrolled/package/widgets/excursionSheet.css +1 -0
- data/entry_types/scrolled/package/widgets/excursionSheet.js +262 -0
- data/entry_types/scrolled/package/widgets/iconInlineFileRights.css +1 -1
- data/entry_types/scrolled/package/widgets/iconInlineFileRights.js +6 -9
- data/entry_types/scrolled/package/widgets/iconScrollIndicator.css +1 -0
- data/entry_types/scrolled/package/widgets/iconScrollIndicator.js +48 -0
- data/entry_types/scrolled/package/widgets/mainStorylineSheet.css +1 -0
- data/entry_types/scrolled/package/widgets/mainStorylineSheet.js +144 -0
- data/entry_types/scrolled/package/widgets/textInlineFileRights.css +1 -1
- data/entry_types/scrolled/package/widgets/textInlineFileRights.js +26 -9
- data/entry_types/scrolled/package/widgets-server.js +1 -0
- data/entry_types/scrolled/spec/factories/chapters.rb +14 -1
- data/entry_types/scrolled/spec/factories/content_elements.rb +1 -1
- data/lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb +5 -3
- data/lib/generators/pageflow/assets/assets_generator.rb +7 -5
- data/lib/generators/pageflow/cancan/cancan_generator.rb +2 -1
- data/lib/generators/pageflow/cancan/templates/ability.rb +1 -1
- data/lib/generators/pageflow/error_pages/error_pages_generator.rb +2 -1
- data/lib/generators/pageflow/initializer/initializer_generator.rb +3 -2
- data/lib/generators/pageflow/install/install_generator.rb +2 -2
- data/lib/generators/pageflow/procfile/procfile_generator.rb +2 -1
- data/lib/generators/pageflow/resque/resque_generator.rb +6 -4
- data/lib/generators/pageflow/resque/templates/resque.rake +1 -1
- data/lib/generators/pageflow/routes/routes_generator.rb +4 -2
- data/lib/generators/pageflow/seeds/seeds_generator.rb +3 -2
- data/lib/generators/pageflow/seeds/templates/seeds.rb +6 -6
- data/lib/generators/pageflow/theme/theme_generator.rb +2 -1
- data/lib/generators/pageflow/user/user_generator.rb +2 -1
- data/lib/pageflow/ability_mixin.rb +25 -15
- data/lib/pageflow/active_admin_patches/views/attributes_table.rb +1 -0
- data/lib/pageflow/active_admin_patches/views/pages/base.rb +3 -2
- data/lib/pageflow/active_admin_patches/views/table_for.rb +1 -0
- data/lib/pageflow/additional_headers.rb +27 -0
- data/lib/pageflow/admin/attributes_table_rows.rb +3 -3
- data/lib/pageflow/admin/tabs.rb +1 -1
- data/lib/pageflow/built_in_file_type.rb +1 -1
- data/lib/pageflow/built_in_page_types_plugin.rb +1 -1
- data/lib/pageflow/built_in_widget_type.rb +2 -2
- data/lib/pageflow/built_in_widget_types_plugin.rb +2 -1
- data/lib/pageflow/configuration.rb +141 -18
- data/lib/pageflow/cutoff_modes.rb +39 -0
- data/lib/pageflow/editor_controller.rb +6 -10
- data/lib/pageflow/engine.rb +4 -5
- data/lib/pageflow/entry_export_import/attachment_files.rb +1 -1
- data/lib/pageflow/entry_export_import/entry_serialization.rb +5 -4
- data/lib/pageflow/entry_export_import/file_mappings.rb +1 -0
- data/lib/pageflow/entry_export_import/revision_serialization/import.rb +1 -1
- data/lib/pageflow/entry_export_import.rb +3 -3
- data/lib/pageflow/entry_types.rb +2 -2
- data/lib/pageflow/feature.rb +1 -1
- data/lib/pageflow/features.rb +4 -6
- data/lib/pageflow/file_importers.rb +4 -4
- data/lib/pageflow/file_type.rb +3 -3
- data/lib/pageflow/file_types.rb +3 -3
- data/lib/pageflow/global_config_api.rb +5 -6
- data/lib/pageflow/help_entries.rb +7 -7
- data/lib/pageflow/help_entry.rb +1 -1
- data/lib/pageflow/hooks.rb +1 -1
- data/lib/pageflow/nested_revision_component.rb +9 -27
- data/lib/pageflow/news_item_api.rb +1 -1
- data/lib/pageflow/page_type.rb +2 -3
- data/lib/pageflow/page_types.rb +3 -3
- data/lib/pageflow/paperclip_interpolations/support.rb +1 -1
- data/lib/pageflow/paperclip_processors/vtt.rb +1 -0
- data/lib/pageflow/paperclip_processors/webp.rb +2 -2
- data/lib/pageflow/partial_editor_fragment_renderer.rb +2 -2
- data/lib/pageflow/plugin.rb +1 -2
- data/lib/pageflow/quota.rb +9 -5
- data/lib/pageflow/quotas.rb +1 -1
- data/lib/pageflow/rails_version.rb +1 -0
- data/lib/pageflow/react.rb +1 -1
- data/lib/pageflow/revision_component.rb +8 -40
- data/lib/pageflow/revision_components.rb +16 -6
- data/lib/pageflow/seeds.rb +12 -16
- data/lib/pageflow/theme.rb +1 -1
- data/lib/pageflow/theme_customizations.rb +10 -10
- data/lib/pageflow/themes.rb +3 -3
- data/lib/pageflow/user_mixin.rb +6 -6
- data/lib/pageflow/version.rb +1 -1
- data/lib/pageflow/widget_type.rb +4 -4
- data/lib/pageflow/widget_types.rb +9 -9
- data/lib/pageflow/zencoder_api.rb +32 -42
- data/lib/pageflow/zencoder_audio_output_definition.rb +14 -13
- data/lib/pageflow/zencoder_meta_data_output_definition.rb +3 -2
- data/lib/pageflow/zencoder_output_definition.rb +16 -14
- data/lib/pageflow/zencoder_video_output_definition.rb +140 -88
- data/lib/pageflow.rb +7 -2
- data/lib/tasks/pageflow_tasks.rake +1 -1
- data/package/editor.js +954 -868
- data/package/frontend.js +113 -387
- data/package/package.json +2 -1
- data/package/testHelpers.js +10 -56
- data/package/ui.js +209 -251
- data/spec/factories/accounts.rb +37 -22
- data/spec/factories/audio_files.rb +2 -2
- data/spec/factories/authentication_tokens.rb +4 -4
- data/spec/factories/chapters.rb +4 -4
- data/spec/factories/draft_entries.rb +14 -6
- data/spec/factories/edit_locks.rb +1 -1
- data/spec/factories/entries.rb +28 -19
- data/spec/factories/entry_translation_groups.rb +6 -0
- data/spec/factories/file_usages.rb +2 -1
- data/spec/factories/folders.rb +1 -1
- data/spec/factories/image_files.rb +2 -2
- data/spec/factories/pages.rb +3 -3
- data/spec/factories/published_entries.rb +26 -8
- data/spec/factories/revisions.rb +1 -1
- data/spec/factories/sites.rb +6 -0
- data/spec/factories/test_multi_attachment_files.rb +1 -1
- data/spec/factories/text_track_files.rb +1 -1
- data/spec/factories/uploadable_files.rb +1 -1
- data/spec/factories/users.rb +6 -6
- data/spec/factories/video_files.rb +2 -2
- data/spec/factories/widgets.rb +1 -1
- data/spec/fixtures/7x15_rotated.jpg +0 -0
- data/vendor/assets/javascripts/wysihtml-toolbar.js +19288 -0
- metadata +98 -45
- data/config/initializers/revision_components.rb +0 -5
- data/config/locales/twitter_to_x.de.yml +0 -6
- data/config/locales/twitter_to_x.en.yml +0 -6
- data/entry_types/scrolled/config/locales/twitter_to_x.de.yml +0 -12
- data/entry_types/scrolled/config/locales/twitter_to_x.en.yml +0 -12
- data/entry_types/scrolled/config/locales/vr_image_projection.de.yml +0 -24
- data/entry_types/scrolled/config/locales/vr_image_projection.en.yml +0 -24
- data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-b79159cc.js +0 -107
- data/entry_types/scrolled/package/frontend/arrowRight-62998af9.js +0 -77
- data/entry_types/scrolled/package/frontend/i18n-ce13a8bf.js +0 -1129
data/entry_types/scrolled/package/frontend/{components-024a9893.js → components-96660ffd.js}
RENAMED
@@ -1,11 +1,10 @@
|
|
1
|
-
import '
|
2
|
-
import { ae as ContentElementEditorCommandEmitterContext, b as usePostMessageListener, af as MotifAreaVisibilityProvider, ag as ForcePaddingContext, ah as ContentElementConfigurationUpdateContext, D as api, l as widths, ai as LayoutWithoutInlineEditing, ad as SectionThumbnail, aj as renderElement, ak as renderLeaf$1, H as useContentElementEditorCommandSubscription, a0 as Text$1, r as frontendStyles } from './EditableInlineText.module-ebd22921.js';
|
1
|
+
import { H as ContentElementEditorCommandEmitterContext, c as usePostMessageListener, aj as MotifAreaVisibilityProvider, ak as ForcePaddingContext, al as ContentElementConfigurationUpdateContext, x as api, k as widths, am as LayoutWithoutInlineEditing, Z as useFloatingPortalRoot, ai as SectionThumbnail, an as renderElement, ao as renderLeaf$1, G as useContentElementEditorCommandSubscription, T as Text$1, r as frontendStyles, ap as createRenderElement, aq as usePhoneLayout, ar as tableStyles, b as useScrollToTarget } from './FloatingPortalRootProvider-51914be7.js';
|
3
2
|
import 'pageflow/frontend';
|
4
3
|
import React, { useMemo, useState, useCallback, useContext, useRef, useEffect, createContext, memo } from 'react';
|
5
|
-
import { _ as _slicedToArray,
|
4
|
+
import { _ as _slicedToArray, r as useEntryStateDispatch, b as _defineProperty, e as _objectWithoutProperties, u as useI18n, K as updateContentElementConfiguration, p as useChapter, q as useDownloadableFile, a as _objectSpread2, o as _toConsumableArray, M as _unsupportedIterableToArray } from './ThemeIcon-81f2f066.js';
|
6
5
|
import classNames from 'classnames';
|
7
|
-
import { C as ContentElementEditorStateContext, a as useContentElementEditorState } from './useContentElementEditorState-
|
8
|
-
import './
|
6
|
+
import { C as ContentElementEditorStateContext, a as useContentElementEditorState } from './useContentElementEditorState-77fe6c79.js';
|
7
|
+
import './inherits-539844a6.js';
|
9
8
|
import BackboneEvents from 'backbone-events-standalone';
|
10
9
|
import 'use-context-selector';
|
11
10
|
import 'reselect';
|
@@ -13,20 +12,21 @@ import 'slugify';
|
|
13
12
|
import 'i18n-js';
|
14
13
|
import 'striptags';
|
15
14
|
import 'react-measure';
|
16
|
-
import { P as PhonePlatformContext } from './PhonePlatformContext-
|
15
|
+
import { P as PhonePlatformContext } from './PhonePlatformContext-9f76033e.js';
|
17
16
|
import { DndProvider, useDrop, useDrag } from 'react-dnd';
|
18
17
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
19
|
-
import { Range, Editor, Transforms, Node, Element, Path, Text, createEditor } from 'slate';
|
18
|
+
import { Range, Editor, Transforms, Node, Element as Element$1, Path, Text, createEditor } from 'slate';
|
20
19
|
import { useSlate, ReactEditor, withReact, Slate, Editable } from 'slate-react';
|
20
|
+
import { withHistory } from 'slate-history';
|
21
21
|
import debounce from 'debounce';
|
22
|
+
import { useFloating, offset, shift, arrow, inline, autoUpdate, FloatingPortal, FloatingArrow, hide } from '@floating-ui/react';
|
22
23
|
|
23
24
|
var Context = React.createContext({});
|
24
25
|
function EditorStateProvider(props) {
|
25
26
|
var _useState = useState(null),
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
28
|
+
selection = _useState2[0],
|
29
|
+
setSelectionState = _useState2[1];
|
30
30
|
var setSelection = useCallback(function (selection) {
|
31
31
|
if (window.parent !== window) {
|
32
32
|
window.parent.postMessage({
|
@@ -34,7 +34,6 @@ function EditorStateProvider(props) {
|
|
34
34
|
payload: selection || {}
|
35
35
|
}, window.location.origin);
|
36
36
|
}
|
37
|
-
|
38
37
|
setSelectionState(selection);
|
39
38
|
}, []);
|
40
39
|
var value = useMemo(function () {
|
@@ -49,9 +48,8 @@ function EditorStateProvider(props) {
|
|
49
48
|
}
|
50
49
|
function useEditorSelection(options) {
|
51
50
|
var _useContext = useContext(Context),
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
selection = _useContext.selection,
|
52
|
+
setSelection = _useContext.setSelection;
|
55
53
|
var resetSelection = useCallback(function () {
|
56
54
|
setSelection(null);
|
57
55
|
}, [setSelection]);
|
@@ -68,6 +66,11 @@ function useEditorSelection(options) {
|
|
68
66
|
}, [options, selection, setSelection, select, resetSelection]);
|
69
67
|
}
|
70
68
|
|
69
|
+
function EntryDecorator(_ref) {
|
70
|
+
var children = _ref.children;
|
71
|
+
return /*#__PURE__*/React.createElement(EditorStateProvider, null, children);
|
72
|
+
}
|
73
|
+
|
71
74
|
function useContentElementEditorCommandEmitter() {
|
72
75
|
return useMemo(function () {
|
73
76
|
return Object.assign({}, BackboneEvents);
|
@@ -75,12 +78,13 @@ function useContentElementEditorCommandEmitter() {
|
|
75
78
|
}
|
76
79
|
function ContentElementEditorCommandSubscriptionProvider(_ref) {
|
77
80
|
var emitter = _ref.emitter,
|
78
|
-
|
81
|
+
children = _ref.children;
|
79
82
|
return /*#__PURE__*/React.createElement(ContentElementEditorCommandEmitterContext.Provider, {
|
80
83
|
value: emitter
|
81
84
|
}, children);
|
82
85
|
}
|
83
86
|
|
87
|
+
// Scroll points are used to preserve scroll position when toggling
|
84
88
|
// the editor phone preview. Each ContentElementDecorator renders a
|
85
89
|
// `data-scrollpoint` attribute with a unique value on its wrapper
|
86
90
|
// div. Before toggling the phone preview mode, the `EntryPreviewView`
|
@@ -120,36 +124,28 @@ function ScrollPointMessageHandler() {
|
|
120
124
|
usePostMessageListener(receiveMessage);
|
121
125
|
return null;
|
122
126
|
}
|
123
|
-
|
124
127
|
function getCurrentScrollPoint() {
|
125
128
|
var scrollPointElement = getSelectionScrollPointElement() || getScrollPointElementWithMinimumTopPositionInViewport();
|
126
129
|
return scrollPointElement === null || scrollPointElement === void 0 ? void 0 : scrollPointElement.getAttribute('data-scrollpoint');
|
127
130
|
}
|
128
|
-
|
129
131
|
function getSelectionScrollPointElement() {
|
130
132
|
return document.querySelector('[data-scrollpoint=selection]');
|
131
133
|
}
|
132
|
-
|
133
134
|
function getScrollPointElementWithMinimumTopPositionInViewport() {
|
134
135
|
var minTop = Infinity;
|
135
136
|
var scrollPointElement;
|
136
137
|
var scrollPoints = document.querySelectorAll('[data-scrollpoint]');
|
137
|
-
|
138
138
|
for (var i = 0; i < scrollPoints.length; i++) {
|
139
139
|
var rect = scrollPoints[i].getBoundingClientRect();
|
140
|
-
|
141
140
|
if (rect.top > 0 && rect.top < minTop) {
|
142
141
|
minTop = rect.top;
|
143
142
|
scrollPointElement = scrollPoints[i];
|
144
143
|
}
|
145
144
|
}
|
146
|
-
|
147
145
|
return scrollPointElement;
|
148
146
|
}
|
149
|
-
|
150
147
|
function restoreScrollPoint(name) {
|
151
148
|
var element = document.querySelector("[data-scrollpoint=\"".concat(name, "\"]"));
|
152
|
-
|
153
149
|
if (element) {
|
154
150
|
window.scrollTo({
|
155
151
|
top: element.getBoundingClientRect().top + window.scrollY - 100,
|
@@ -160,7 +156,7 @@ function restoreScrollPoint(name) {
|
|
160
156
|
|
161
157
|
function ContentDecorator(props) {
|
162
158
|
var contentElementEditorCommandEmitter = useContentElementEditorCommandEmitter();
|
163
|
-
return /*#__PURE__*/React.createElement(
|
159
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MessageHandler, {
|
164
160
|
contentElementEditorCommandEmitter: contentElementEditorCommandEmitter
|
165
161
|
}), /*#__PURE__*/React.createElement(ScrollPointMessageHandler, null), /*#__PURE__*/React.createElement(ContentElementEditorCommandSubscriptionProvider, {
|
166
162
|
emitter: contentElementEditorCommandEmitter
|
@@ -168,13 +164,10 @@ function ContentDecorator(props) {
|
|
168
164
|
backend: HTML5Backend
|
169
165
|
}, props.children)));
|
170
166
|
}
|
171
|
-
|
172
167
|
function MessageHandler(_ref) {
|
173
168
|
var contentElementEditorCommandEmitter = _ref.contentElementEditorCommandEmitter;
|
174
|
-
|
175
169
|
var _useEditorSelection = useEditorSelection(),
|
176
|
-
|
177
|
-
|
170
|
+
select = _useEditorSelection.select;
|
178
171
|
var dispatch = useEntryStateDispatch();
|
179
172
|
var receiveMessage = useCallback(function (data) {
|
180
173
|
if (data.type === 'ACTION') {
|
@@ -196,26 +189,30 @@ function MessageHandler(_ref) {
|
|
196
189
|
return null;
|
197
190
|
}
|
198
191
|
|
199
|
-
var styles = {"wrapper":"SectionDecorator-module_wrapper__3sTk3","selected":"SectionDecorator-module_selected__1gcmF","transitionSelected":"SectionDecorator-module_transitionSelected__Wklk6","controls":"SectionDecorator-module_controls__LVEJG","transitionToolbar-after":"SectionDecorator-module_transitionToolbar-after__2_DVO SectionDecorator-module_toolbar__2Va1D","toolbar":"SectionDecorator-module_toolbar__2Va1D","transitionToolbar-before":"SectionDecorator-module_transitionToolbar-before__KipOO SectionDecorator-module_toolbar__2Va1D"};
|
192
|
+
var styles = {"wrapper":"SectionDecorator-module_wrapper__3sTk3","highlighted":"SectionDecorator-module_highlighted__18FyB","lineAbove":"SectionDecorator-module_lineAbove__BZqEr","lineBelow":"SectionDecorator-module_lineBelow__1RbG-","selected":"SectionDecorator-module_selected__1gcmF","transitionSelected":"SectionDecorator-module_transitionSelected__Wklk6","controls":"SectionDecorator-module_controls__LVEJG","transitionToolbar-after":"SectionDecorator-module_transitionToolbar-after__2_DVO SectionDecorator-module_toolbar__2Va1D","toolbar":"SectionDecorator-module_toolbar__2Va1D","transitionToolbar-before":"SectionDecorator-module_transitionToolbar-before__KipOO SectionDecorator-module_toolbar__2Va1D"};
|
193
|
+
|
194
|
+
var styles$1 = {"wrapper":"BackdropDecorator-module_wrapper__X-h1o","visible":"BackdropDecorator-module_visible__3VqiR","inner":"BackdropDecorator-module_inner__14JfF"};
|
200
195
|
|
201
|
-
var styles$
|
196
|
+
var styles$2 = {"wrapper":"ContentElementDecorator-module_wrapper__NQgFN"};
|
202
197
|
|
203
|
-
var styles$
|
198
|
+
var styles$3 = {"wrapper":"WidgetSelectionRect-module_wrapper__1ktq9","selected":"WidgetSelectionRect-module_selected__2nm_L"};
|
199
|
+
|
200
|
+
var styles$4 = {"Toolbar":"Toolbar-module_Toolbar__1INSj","button":"Toolbar-module_button__de5BW","activeButton":"Toolbar-module_activeButton__2sOLP","collapsible":"Toolbar-module_collapsible__3sivb"};
|
204
201
|
|
205
202
|
function Toolbar(_ref) {
|
206
203
|
var buttons = _ref.buttons,
|
207
|
-
|
208
|
-
|
209
|
-
|
204
|
+
onButtonClick = _ref.onButtonClick,
|
205
|
+
iconSize = _ref.iconSize,
|
206
|
+
collapsible = _ref.collapsible;
|
210
207
|
return /*#__PURE__*/React.createElement("div", {
|
211
|
-
className: classNames(styles$
|
208
|
+
className: classNames(styles$4.Toolbar, _defineProperty({}, styles$4.collapsible, collapsible)),
|
212
209
|
contentEditable: false
|
213
210
|
}, buttons.map(function (button) {
|
214
211
|
var Icon = button.icon;
|
215
212
|
return /*#__PURE__*/React.createElement("button", {
|
216
213
|
key: button.name,
|
217
214
|
title: button.text,
|
218
|
-
className: classNames(styles$
|
215
|
+
className: classNames(styles$4.button, _defineProperty({}, styles$4.activeButton, button.active)),
|
219
216
|
onMouseDown: function onMouseDown(event) {
|
220
217
|
event.preventDefault();
|
221
218
|
event.stopPropagation();
|
@@ -231,28 +228,25 @@ Toolbar.defaultProps = {
|
|
231
228
|
iconSize: 15
|
232
229
|
};
|
233
230
|
|
231
|
+
var _excluded = ["styles"];
|
234
232
|
function _extends() {
|
235
|
-
_extends = Object.assign
|
233
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
236
234
|
for (var i = 1; i < arguments.length; i++) {
|
237
235
|
var source = arguments[i];
|
238
|
-
|
239
236
|
for (var key in source) {
|
240
237
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
241
238
|
target[key] = source[key];
|
242
239
|
}
|
243
240
|
}
|
244
241
|
}
|
245
|
-
|
246
242
|
return target;
|
247
243
|
};
|
248
|
-
|
249
244
|
return _extends.apply(this, arguments);
|
250
245
|
}
|
251
246
|
var transitionIcon = (function (_ref) {
|
252
247
|
var _ref$styles = _ref.styles,
|
253
|
-
|
254
|
-
|
255
|
-
|
248
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
249
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
256
250
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
257
251
|
"aria-hidden": "true",
|
258
252
|
"data-prefix": "fas",
|
@@ -267,23 +261,33 @@ var transitionIcon = (function (_ref) {
|
|
267
261
|
});
|
268
262
|
|
269
263
|
function SectionDecorator(_ref) {
|
270
|
-
var
|
271
|
-
|
272
|
-
|
273
|
-
|
264
|
+
var _backdrop$contentElem;
|
265
|
+
var backdrop = _ref.backdrop,
|
266
|
+
section = _ref.section,
|
267
|
+
contentElements = _ref.contentElements,
|
268
|
+
transitions = _ref.transitions,
|
269
|
+
children = _ref.children;
|
274
270
|
var _useI18n = useI18n({
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
271
|
+
locale: 'ui'
|
272
|
+
}),
|
273
|
+
t = _useI18n.t;
|
279
274
|
var _useEditorSelection = useEditorSelection({
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
275
|
+
id: section.id,
|
276
|
+
type: 'sectionSettings'
|
277
|
+
}),
|
278
|
+
isSelected = _useEditorSelection.isSelected,
|
279
|
+
select = _useEditorSelection.select,
|
280
|
+
resetSelection = _useEditorSelection.resetSelection;
|
281
|
+
var _useEditorSelection2 = useEditorSelection({
|
282
|
+
id: (_backdrop$contentElem = backdrop.contentElement) === null || _backdrop$contentElem === void 0 ? void 0 : _backdrop$contentElem.id,
|
283
|
+
type: 'contentElement'
|
284
|
+
}),
|
285
|
+
isBackdropElementSelected = _useEditorSelection2.isSelected;
|
286
|
+
var _useEditorSelection3 = useEditorSelection({
|
287
|
+
id: section.id,
|
288
|
+
type: 'section'
|
289
|
+
}),
|
290
|
+
isHighlighted = _useEditorSelection3.isSelected;
|
287
291
|
var transitionSelection = useEditorSelection({
|
288
292
|
id: section.id,
|
289
293
|
type: 'sectionTransition'
|
@@ -293,22 +297,19 @@ function SectionDecorator(_ref) {
|
|
293
297
|
type: 'sectionTransition'
|
294
298
|
});
|
295
299
|
var lastContentElement = contentElements[contentElements.length - 1];
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
isLastContentElementSelected = _useEditorSelection2.isSelected;
|
302
|
-
|
300
|
+
var _useEditorSelection4 = useEditorSelection({
|
301
|
+
id: lastContentElement && lastContentElement.id,
|
302
|
+
type: 'contentElement'
|
303
|
+
}),
|
304
|
+
isLastContentElementSelected = _useEditorSelection4.isSelected;
|
303
305
|
function selectIfOutsideContentItem(event) {
|
304
|
-
if (!event.target.closest(".".concat(styles$1.wrapper)) && !event.target.closest('#fullscreenRoot')) {
|
306
|
+
if (!event.target.closest(".".concat(styles$2.wrapper)) && !event.target.closest(".".concat(styles$1.wrapper)) && !event.target.closest(".".concat(styles$3.wrapper)) && !event.target.closest('#fullscreenRoot') && !event.target.closest('[data-floating-ui-portal]')) {
|
305
307
|
isSelected ? resetSelection() : select();
|
306
308
|
}
|
307
309
|
}
|
308
|
-
|
309
310
|
return /*#__PURE__*/React.createElement("div", {
|
310
311
|
"aria-label": t('pageflow_scrolled.inline_editing.select_section'),
|
311
|
-
className: className(isSelected, transitionSelection),
|
312
|
+
className: className(isSelected, transitionSelection, isHighlighted, isBackdropElementSelected, transitions),
|
312
313
|
onMouseDown: selectIfOutsideContentItem
|
313
314
|
}, /*#__PURE__*/React.createElement("div", {
|
314
315
|
className: styles.controls
|
@@ -326,22 +327,16 @@ function SectionDecorator(_ref) {
|
|
326
327
|
value: isLastContentElementSelected || isSelected
|
327
328
|
}, children)));
|
328
329
|
}
|
329
|
-
|
330
|
-
|
331
|
-
var _classNames;
|
332
|
-
|
333
|
-
return classNames(styles.wrapper, (_classNames = {}, _defineProperty(_classNames, styles.selected, isSectionSelected), _defineProperty(_classNames, styles.transitionSelected, transitionSelection.isSelected), _classNames));
|
330
|
+
function className(isSectionSelected, transitionSelection, isHighlighted, isBackdropElementSelected, transitions) {
|
331
|
+
return classNames(styles.wrapper, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.selected, isSectionSelected), styles.highlighted, isHighlighted), styles.lineAbove, isBackdropElementSelected && transitions[0].startsWith('fade')), styles.lineBelow, isBackdropElementSelected && transitions[1].startsWith('fade')), styles.transitionSelected, transitionSelection.isSelected));
|
334
332
|
}
|
335
|
-
|
336
333
|
function renderEditTransitionButton(_ref2) {
|
337
334
|
var id = _ref2.id,
|
338
|
-
|
339
|
-
|
340
|
-
|
335
|
+
position = _ref2.position,
|
336
|
+
selection = _ref2.selection;
|
341
337
|
if (!id) {
|
342
338
|
return null;
|
343
339
|
}
|
344
|
-
|
345
340
|
return /*#__PURE__*/React.createElement("div", {
|
346
341
|
className: styles["transitionToolbar-".concat(position)]
|
347
342
|
}, /*#__PURE__*/React.createElement(EditTransitionButton, {
|
@@ -350,17 +345,14 @@ function renderEditTransitionButton(_ref2) {
|
|
350
345
|
position: position
|
351
346
|
}));
|
352
347
|
}
|
353
|
-
|
354
348
|
function EditTransitionButton(_ref3) {
|
355
349
|
var id = _ref3.id,
|
356
|
-
|
357
|
-
|
358
|
-
|
350
|
+
position = _ref3.position,
|
351
|
+
selection = _ref3.selection;
|
359
352
|
var _useI18n2 = useI18n({
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
353
|
+
locale: 'ui'
|
354
|
+
}),
|
355
|
+
t = _useI18n2.t;
|
364
356
|
return /*#__PURE__*/React.createElement(EditSectionButton, {
|
365
357
|
id: id,
|
366
358
|
selection: selection,
|
@@ -368,12 +360,11 @@ function EditTransitionButton(_ref3) {
|
|
368
360
|
icon: transitionIcon
|
369
361
|
});
|
370
362
|
}
|
371
|
-
|
372
363
|
function EditSectionButton(_ref4) {
|
373
364
|
var id = _ref4.id,
|
374
|
-
|
375
|
-
|
376
|
-
|
365
|
+
selection = _ref4.selection,
|
366
|
+
icon = _ref4.icon,
|
367
|
+
text = _ref4.text;
|
377
368
|
return /*#__PURE__*/React.createElement(Toolbar, {
|
378
369
|
buttons: [{
|
379
370
|
name: 'button',
|
@@ -388,29 +379,26 @@ function EditSectionButton(_ref4) {
|
|
388
379
|
});
|
389
380
|
}
|
390
381
|
|
391
|
-
var styles$
|
382
|
+
var styles$5 = {"selectionWidth":"1px","selectionPadding":"-6px","selectionPadding2":"-0.5em","main":"SelectionRect-module_main__3AOhG","draggable":"SelectionRect-module_draggable__3Qp53","full":"SelectionRect-module_full__3tsQF","inset":"SelectionRect-module_inset__3den3","selected":"SelectionRect-module_selected__1PhM6","toolbar":"SelectionRect-module_toolbar__3nPrd","insert":"SelectionRect-module_insert__w0Tl0","insertHovered":"SelectionRect-module_insertHovered__VTsDD","start":"SelectionRect-module_start__3_nAf","insert-before":"SelectionRect-module_insert-before__2Tyq5 SelectionRect-module_insert__w0Tl0","end":"SelectionRect-module_end__3qOoK","insert-after":"SelectionRect-module_insert-after__3FJ4R SelectionRect-module_insert__w0Tl0","insertButton":"SelectionRect-module_insertButton__1g-ZG","dragHandle":"SelectionRect-module_dragHandle__2vVhP"};
|
392
383
|
|
384
|
+
var _excluded$1 = ["styles"];
|
393
385
|
function _extends$1() {
|
394
|
-
_extends$1 = Object.assign
|
386
|
+
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
395
387
|
for (var i = 1; i < arguments.length; i++) {
|
396
388
|
var source = arguments[i];
|
397
|
-
|
398
389
|
for (var key in source) {
|
399
390
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
400
391
|
target[key] = source[key];
|
401
392
|
}
|
402
393
|
}
|
403
394
|
}
|
404
|
-
|
405
395
|
return target;
|
406
396
|
};
|
407
|
-
|
408
397
|
return _extends$1.apply(this, arguments);
|
409
398
|
}
|
410
399
|
var PlusIcon = (function (_ref) {
|
411
400
|
var _ref$styles = _ref.styles,
|
412
|
-
|
413
|
-
|
401
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
414
402
|
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
415
403
|
xmlns: "http://www.w3.org/2000/svg",
|
416
404
|
viewBox: "0 0 512 512"
|
@@ -419,28 +407,25 @@ var PlusIcon = (function (_ref) {
|
|
419
407
|
}));
|
420
408
|
});
|
421
409
|
|
410
|
+
var _excluded$2 = ["styles"];
|
422
411
|
function _extends$2() {
|
423
|
-
_extends$2 = Object.assign
|
412
|
+
_extends$2 = Object.assign ? Object.assign.bind() : function (target) {
|
424
413
|
for (var i = 1; i < arguments.length; i++) {
|
425
414
|
var source = arguments[i];
|
426
|
-
|
427
415
|
for (var key in source) {
|
428
416
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
429
417
|
target[key] = source[key];
|
430
418
|
}
|
431
419
|
}
|
432
420
|
}
|
433
|
-
|
434
421
|
return target;
|
435
422
|
};
|
436
|
-
|
437
423
|
return _extends$2.apply(this, arguments);
|
438
424
|
}
|
439
425
|
var MoveIcon = (function (_ref) {
|
440
426
|
var _ref$styles = _ref.styles,
|
441
|
-
|
442
|
-
|
443
|
-
|
427
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
428
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
444
429
|
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
445
430
|
"aria-hidden": "true",
|
446
431
|
"data-prefix": "fas",
|
@@ -455,10 +440,8 @@ var MoveIcon = (function (_ref) {
|
|
455
440
|
});
|
456
441
|
|
457
442
|
function SelectionRect(props) {
|
458
|
-
var _classNames;
|
459
|
-
|
460
443
|
return /*#__PURE__*/React.createElement("div", {
|
461
|
-
className: classNames(styles$
|
444
|
+
className: classNames(styles$5.main, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles$5.full, props.full), styles$5.inset, props.inset), styles$5.selected, props.selected), styles$5.draggable, props.drag), styles$5.start, props.selected && props.start), styles$5.end, props.selected && props.end)),
|
462
445
|
"aria-label": props.ariaLabel,
|
463
446
|
"data-scrollpoint": props.scrollPoint ? 'selection' : undefined,
|
464
447
|
onClick: props.onClick
|
@@ -468,19 +451,20 @@ function SelectionRect(props) {
|
|
468
451
|
at: "after"
|
469
452
|
})));
|
470
453
|
}
|
471
|
-
|
472
454
|
function InsertButton(props) {
|
473
455
|
var _useState = useState(false),
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
456
|
+
_useState2 = _slicedToArray(_useState, 2),
|
457
|
+
insertHovered = _useState2[0],
|
458
|
+
setInsertHovered = _useState2[1];
|
478
459
|
return /*#__PURE__*/React.createElement("div", {
|
479
|
-
className: classNames(styles$
|
460
|
+
className: classNames(styles$5["insert-".concat(props.at)], _defineProperty({}, styles$5.insertHovered, insertHovered)),
|
480
461
|
contentEditable: false
|
481
462
|
}, /*#__PURE__*/React.createElement("button", {
|
482
|
-
className: styles$
|
463
|
+
className: styles$5.insertButton,
|
483
464
|
title: props.insertButtonTitles && props.insertButtonTitles[props.at],
|
465
|
+
onMouseDown: function onMouseDown(event) {
|
466
|
+
return event.preventDefault();
|
467
|
+
},
|
484
468
|
onClick: function onClick() {
|
485
469
|
return props.onInsertButtonClick(props.at);
|
486
470
|
},
|
@@ -496,30 +480,25 @@ function InsertButton(props) {
|
|
496
480
|
fill: "currentColor"
|
497
481
|
})));
|
498
482
|
}
|
499
|
-
|
500
483
|
function renderDragHandle(_ref) {
|
501
484
|
var drag = _ref.drag,
|
502
|
-
|
503
|
-
|
485
|
+
dragHandleTitle = _ref.dragHandleTitle;
|
504
486
|
if (!drag) {
|
505
487
|
return null;
|
506
488
|
}
|
507
|
-
|
508
489
|
return /*#__PURE__*/React.createElement("div", {
|
509
490
|
ref: drag,
|
510
|
-
className: styles$
|
491
|
+
className: styles$5.dragHandle,
|
511
492
|
title: dragHandleTitle
|
512
493
|
}, /*#__PURE__*/React.createElement(MoveIcon, null));
|
513
494
|
}
|
514
|
-
|
515
495
|
function renderToolbar(_ref2) {
|
516
496
|
var toolbarButtons = _ref2.toolbarButtons,
|
517
|
-
|
518
|
-
|
519
|
-
|
497
|
+
onToolbarButtonClick = _ref2.onToolbarButtonClick,
|
498
|
+
start = _ref2.start;
|
520
499
|
if (toolbarButtons && start) {
|
521
500
|
return /*#__PURE__*/React.createElement("div", {
|
522
|
-
className: styles$
|
501
|
+
className: styles$5.toolbar
|
523
502
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
524
503
|
buttons: toolbarButtons,
|
525
504
|
collapsible: true,
|
@@ -527,91 +506,87 @@ function renderToolbar(_ref2) {
|
|
527
506
|
}));
|
528
507
|
}
|
529
508
|
}
|
530
|
-
|
531
509
|
SelectionRect.defaultProps = {
|
532
510
|
start: true,
|
533
511
|
end: true
|
534
512
|
};
|
535
513
|
|
536
|
-
var styles$
|
514
|
+
var styles$6 = {"target":"DropTargets-module_target__Z2N2d","isOver":"DropTargets-module_isOver__3ksFy","before":"DropTargets-module_before__cAXo1 DropTargets-module_target__Z2N2d","after":"DropTargets-module_after__2Q8QU DropTargets-module_target__Z2N2d"};
|
537
515
|
|
538
516
|
function DropTargets(_ref) {
|
539
517
|
var accept = _ref.accept,
|
540
|
-
|
541
|
-
|
542
|
-
|
518
|
+
_canDrop = _ref.canDrop,
|
519
|
+
onDrop = _ref.onDrop;
|
543
520
|
var _useDrop = useDrop({
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
521
|
+
accept: accept,
|
522
|
+
canDrop: function canDrop(item) {
|
523
|
+
return _canDrop({
|
524
|
+
at: 'before',
|
525
|
+
id: item.id
|
526
|
+
});
|
527
|
+
},
|
528
|
+
collect: function collect(monitor) {
|
529
|
+
return {
|
530
|
+
canDropBefore: monitor.canDrop(),
|
531
|
+
isBefore: monitor.isOver() && monitor.canDrop()
|
532
|
+
};
|
533
|
+
},
|
534
|
+
drop: function drop(item) {
|
535
|
+
return onDrop({
|
536
|
+
at: 'before',
|
537
|
+
id: item.id,
|
538
|
+
range: item.range
|
539
|
+
});
|
540
|
+
}
|
541
|
+
}),
|
542
|
+
_useDrop2 = _slicedToArray(_useDrop, 2),
|
543
|
+
_useDrop2$ = _useDrop2[0],
|
544
|
+
canDropBefore = _useDrop2$.canDropBefore,
|
545
|
+
isBefore = _useDrop2$.isBefore,
|
546
|
+
dropBefore = _useDrop2[1];
|
571
547
|
var _useDrop3 = useDrop({
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
548
|
+
accept: accept,
|
549
|
+
canDrop: function canDrop(item) {
|
550
|
+
return _canDrop({
|
551
|
+
at: 'after',
|
552
|
+
id: item.id
|
553
|
+
});
|
554
|
+
},
|
555
|
+
collect: function collect(monitor) {
|
556
|
+
return {
|
557
|
+
canDropAfter: monitor.canDrop(),
|
558
|
+
isAfter: monitor.isOver() && monitor.canDrop()
|
559
|
+
};
|
560
|
+
},
|
561
|
+
drop: function drop(item) {
|
562
|
+
return onDrop({
|
563
|
+
at: 'after',
|
564
|
+
id: item.id,
|
565
|
+
range: item.range
|
566
|
+
});
|
567
|
+
}
|
568
|
+
}),
|
569
|
+
_useDrop4 = _slicedToArray(_useDrop3, 2),
|
570
|
+
_useDrop4$ = _useDrop4[0],
|
571
|
+
canDropAfter = _useDrop4$.canDropAfter,
|
572
|
+
isAfter = _useDrop4$.isAfter,
|
573
|
+
dropAfter = _useDrop4[1];
|
599
574
|
return /*#__PURE__*/React.createElement(React.Fragment, null, canDropBefore && /*#__PURE__*/React.createElement("div", {
|
600
575
|
ref: dropBefore,
|
601
576
|
"data-testid": "drop-before",
|
602
|
-
className: classNames(styles$
|
577
|
+
className: classNames(styles$6.before, _defineProperty({}, styles$6.isOver, isBefore))
|
603
578
|
}), canDropAfter && /*#__PURE__*/React.createElement("div", {
|
604
579
|
ref: dropAfter,
|
605
580
|
"data-testid": "drop-after",
|
606
581
|
title: "bar",
|
607
|
-
className: classNames(styles$
|
582
|
+
className: classNames(styles$6.after, _defineProperty({}, styles$6.isOver, isAfter))
|
608
583
|
}));
|
609
584
|
}
|
610
585
|
|
611
586
|
function postInsertContentElementMessage(_ref) {
|
612
587
|
var id = _ref.id,
|
613
|
-
|
614
|
-
|
588
|
+
at = _ref.at,
|
589
|
+
splitPoint = _ref.splitPoint;
|
615
590
|
window.parent.postMessage({
|
616
591
|
type: 'INSERT_CONTENT_ELEMENT',
|
617
592
|
payload: {
|
@@ -623,8 +598,8 @@ function postInsertContentElementMessage(_ref) {
|
|
623
598
|
}
|
624
599
|
function postMoveContentElementMessage(_ref2) {
|
625
600
|
var id = _ref2.id,
|
626
|
-
|
627
|
-
|
601
|
+
range = _ref2.range,
|
602
|
+
to = _ref2.to;
|
628
603
|
window.parent.postMessage({
|
629
604
|
type: 'MOVE_CONTENT_ELEMENT',
|
630
605
|
payload: {
|
@@ -636,7 +611,7 @@ function postMoveContentElementMessage(_ref2) {
|
|
636
611
|
}
|
637
612
|
function postUpdateContentElementMessage(_ref3) {
|
638
613
|
var id = _ref3.id,
|
639
|
-
|
614
|
+
configuration = _ref3.configuration;
|
640
615
|
window.parent.postMessage({
|
641
616
|
type: 'UPDATE_CONTENT_ELEMENT',
|
642
617
|
payload: {
|
@@ -647,7 +622,7 @@ function postUpdateContentElementMessage(_ref3) {
|
|
647
622
|
}
|
648
623
|
function postUpdateTransientContentElementStateMessage(_ref4) {
|
649
624
|
var id = _ref4.id,
|
650
|
-
|
625
|
+
state = _ref4.state;
|
651
626
|
window.parent.postMessage({
|
652
627
|
type: 'UPDATE_TRANSIENT_CONTENT_ELEMENT_STATE',
|
653
628
|
payload: {
|
@@ -664,8 +639,8 @@ function postSelectLinkDestinationMessage() {
|
|
664
639
|
|
665
640
|
function ContentElementConfigurationUpdateProvider(_ref) {
|
666
641
|
var id = _ref.id,
|
667
|
-
|
668
|
-
|
642
|
+
permaId = _ref.permaId,
|
643
|
+
children = _ref.children;
|
669
644
|
var dispatch = useEntryStateDispatch();
|
670
645
|
var update = useCallback(function (configuration) {
|
671
646
|
postUpdateContentElementMessage({
|
@@ -685,16 +660,16 @@ function ContentElementConfigurationUpdateProvider(_ref) {
|
|
685
660
|
|
686
661
|
function ContentElementEditorStateProvider(_ref) {
|
687
662
|
var id = _ref.id,
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
663
|
+
children = _ref.children;
|
664
|
+
var _useEditorSelection = useEditorSelection(useMemo(function () {
|
665
|
+
return {
|
666
|
+
id: id,
|
667
|
+
type: 'contentElement'
|
668
|
+
};
|
669
|
+
}, [id])),
|
670
|
+
isSelected = _useEditorSelection.isSelected,
|
671
|
+
select = _useEditorSelection.select,
|
672
|
+
range = _useEditorSelection.range;
|
698
673
|
var previousTransientState = useRef({});
|
699
674
|
var setTransientState = useCallback(function (state) {
|
700
675
|
if (!shallowEqual(state, previousTransientState.current)) {
|
@@ -718,7 +693,6 @@ function ContentElementEditorStateProvider(_ref) {
|
|
718
693
|
value: value
|
719
694
|
}, children);
|
720
695
|
}
|
721
|
-
|
722
696
|
function shallowEqual(obj1, obj2) {
|
723
697
|
return Object.keys(obj1).length === Object.keys(obj2).length && Object.keys(obj1).every(function (key) {
|
724
698
|
return Object.prototype.hasOwnProperty.call(obj2, key) && obj1[key] === obj2[key];
|
@@ -727,7 +701,7 @@ function shallowEqual(obj1, obj2) {
|
|
727
701
|
|
728
702
|
function ContentElementDecorator(props) {
|
729
703
|
return /*#__PURE__*/React.createElement("div", {
|
730
|
-
className: styles$
|
704
|
+
className: styles$2.wrapper,
|
731
705
|
"data-scrollpoint": props.id
|
732
706
|
}, /*#__PURE__*/React.createElement(ContentElementEditorStateProvider, {
|
733
707
|
id: props.id
|
@@ -736,44 +710,39 @@ function ContentElementDecorator(props) {
|
|
736
710
|
permaId: props.permaId
|
737
711
|
}, props.children))));
|
738
712
|
}
|
739
|
-
|
740
713
|
function OptionalSelectionRect(props) {
|
741
714
|
var _ref = api.contentElementTypes.getOptions(props.type) || {},
|
742
|
-
|
743
|
-
|
715
|
+
customSelectionRect = _ref.customSelectionRect;
|
744
716
|
if (customSelectionRect) {
|
745
717
|
return props.children;
|
746
718
|
} else {
|
747
719
|
return /*#__PURE__*/React.createElement(DefaultSelectionRect, props, props.children);
|
748
720
|
}
|
749
721
|
}
|
750
|
-
|
751
722
|
function DefaultSelectionRect(props) {
|
752
723
|
var _useContentElementEdi = useContentElementEditorState(),
|
753
|
-
|
754
|
-
|
755
|
-
|
724
|
+
isSelected = _useContentElementEdi.isSelected,
|
725
|
+
select = _useContentElementEdi.select;
|
756
726
|
var _useI18n = useI18n({
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
727
|
+
locale: 'ui'
|
728
|
+
}),
|
729
|
+
t = _useI18n.t;
|
761
730
|
var _useDrag = useDrag({
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
731
|
+
item: {
|
732
|
+
type: 'contentElement',
|
733
|
+
id: props.id
|
734
|
+
}
|
735
|
+
}),
|
736
|
+
_useDrag2 = _slicedToArray(_useDrag, 3),
|
737
|
+
drag = _useDrag2[1],
|
738
|
+
preview = _useDrag2[2];
|
771
739
|
return /*#__PURE__*/React.createElement(SelectionRect, {
|
772
740
|
selected: isSelected,
|
773
741
|
scrollPoint: isSelected,
|
774
742
|
drag: drag,
|
775
743
|
dragHandleTitle: t('pageflow_scrolled.inline_editing.drag_content_element'),
|
776
744
|
full: props.width === widths.full || props.customMargin,
|
745
|
+
inset: props.position === 'backdrop',
|
777
746
|
ariaLabel: t('pageflow_scrolled.inline_editing.select_content_element'),
|
778
747
|
insertButtonTitles: t('pageflow_scrolled.inline_editing.insert_content_element'),
|
779
748
|
onClick: function onClick() {
|
@@ -795,8 +764,8 @@ function DefaultSelectionRect(props) {
|
|
795
764
|
},
|
796
765
|
onDrop: function onDrop(_ref3) {
|
797
766
|
var id = _ref3.id,
|
798
|
-
|
799
|
-
|
767
|
+
range = _ref3.range,
|
768
|
+
at = _ref3.at;
|
800
769
|
return postMoveContentElementMessage({
|
801
770
|
id: id,
|
802
771
|
range: range,
|
@@ -809,25 +778,22 @@ function DefaultSelectionRect(props) {
|
|
809
778
|
}));
|
810
779
|
}
|
811
780
|
|
812
|
-
var styles$
|
781
|
+
var styles$7 = {"container":"ContentElementInsertButton-module_container__3dvUS","hovered":"ContentElementInsertButton-module_hovered__3Pggi","button":"ContentElementInsertButton-module_button__2-eE2"};
|
813
782
|
|
814
783
|
function ContentElementInsertButton(_ref) {
|
815
784
|
var onClick = _ref.onClick;
|
816
|
-
|
817
785
|
var _useState = useState(),
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
786
|
+
_useState2 = _slicedToArray(_useState, 2),
|
787
|
+
hovered = _useState2[0],
|
788
|
+
setHovered = _useState2[1];
|
822
789
|
var _useI18n = useI18n({
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
790
|
+
locale: 'ui'
|
791
|
+
}),
|
792
|
+
t = _useI18n.t;
|
827
793
|
return /*#__PURE__*/React.createElement("div", {
|
828
|
-
className: classNames(styles$
|
794
|
+
className: classNames(styles$7.container, _defineProperty({}, styles$7.hovered, hovered))
|
829
795
|
}, /*#__PURE__*/React.createElement("button", {
|
830
|
-
className: styles$
|
796
|
+
className: styles$7.button,
|
831
797
|
title: t('pageflow_scrolled.inline_editing.add_content_element'),
|
832
798
|
onClick: onClick,
|
833
799
|
onMouseDown: function onMouseDown(event) {
|
@@ -848,17 +814,15 @@ function ContentElementInsertButton(_ref) {
|
|
848
814
|
|
849
815
|
function LayoutWithPlaceholder(props) {
|
850
816
|
var _useEditorSelection = useEditorSelection({
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
817
|
+
id: props.sectionId,
|
818
|
+
type: 'section'
|
819
|
+
}),
|
820
|
+
isSelected = _useEditorSelection.isSelected;
|
856
821
|
var _useEditorSelection2 = useEditorSelection({
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
822
|
+
id: props.sectionId,
|
823
|
+
type: 'sectionSettings'
|
824
|
+
}),
|
825
|
+
settingsSelected = _useEditorSelection2.isSelected;
|
862
826
|
var placeholder = isSelected || settingsSelected ? /*#__PURE__*/React.createElement(ContentElementInsertButton, {
|
863
827
|
onClick: function onClick() {
|
864
828
|
return postInsertContentElementMessage({
|
@@ -874,17 +838,15 @@ function LayoutWithPlaceholder(props) {
|
|
874
838
|
|
875
839
|
function useCachedValue(value) {
|
876
840
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
841
|
+
defaultValue = _ref.defaultValue,
|
842
|
+
onReset = _ref.onReset,
|
843
|
+
onDebouncedChange = _ref.onDebouncedChange,
|
844
|
+
_ref$delay = _ref.delay,
|
845
|
+
delay = _ref$delay === void 0 ? 2000 : _ref$delay;
|
883
846
|
var _useState = useState(value || defaultValue),
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
847
|
+
_useState2 = _slicedToArray(_useState, 2),
|
848
|
+
cachedValue = _useState2[0],
|
849
|
+
setCachedValue = _useState2[1];
|
888
850
|
var previousValue = useRef(value);
|
889
851
|
useEffect(function () {
|
890
852
|
if (previousValue.current !== value && value !== cachedValue) {
|
@@ -901,13 +863,13 @@ function useCachedValue(value) {
|
|
901
863
|
if (previousValue !== value) {
|
902
864
|
debouncedHandler(value);
|
903
865
|
}
|
904
|
-
|
905
866
|
return value;
|
906
867
|
});
|
907
868
|
}, [debouncedHandler]);
|
908
869
|
return [cachedValue, setValue];
|
909
|
-
}
|
870
|
+
}
|
910
871
|
|
872
|
+
// Debounce callback even if the callback function changes across renders.
|
911
873
|
function useDebouncedCallback(callback, delay) {
|
912
874
|
var mostRecentCallback = useRef(null);
|
913
875
|
var debouncedHandler = useRef(null);
|
@@ -929,19 +891,17 @@ function useDebouncedCallback(callback, delay) {
|
|
929
891
|
}, []);
|
930
892
|
}
|
931
893
|
|
932
|
-
var styles$
|
894
|
+
var styles$8 = {"placeholder":"TextPlaceholder-module_placeholder__sgVwx"};
|
933
895
|
|
934
896
|
function TextPlaceholder(_ref) {
|
935
897
|
var text = _ref.text,
|
936
|
-
|
937
|
-
|
938
|
-
|
898
|
+
visible = _ref.visible,
|
899
|
+
className = _ref.className;
|
939
900
|
if (!text || !visible) {
|
940
901
|
return null;
|
941
902
|
}
|
942
|
-
|
943
903
|
return /*#__PURE__*/React.createElement("div", {
|
944
|
-
className: styles$
|
904
|
+
className: styles$8.placeholder
|
945
905
|
}, /*#__PURE__*/React.createElement("div", {
|
946
906
|
className: className
|
947
907
|
}, text));
|
@@ -949,22 +909,18 @@ function TextPlaceholder(_ref) {
|
|
949
909
|
|
950
910
|
function withCustomInsertBreak(editor) {
|
951
911
|
var insertBreak = editor.insertBreak;
|
952
|
-
|
953
912
|
editor.insertBreak = function () {
|
954
913
|
var selection = editor.selection;
|
955
|
-
|
956
914
|
if (selection && Range.isCollapsed(selection)) {
|
957
915
|
var match = Editor.above(editor, {
|
958
916
|
match: function match(n) {
|
959
917
|
return Editor.isBlock(editor, n);
|
960
918
|
}
|
961
919
|
});
|
962
|
-
|
963
920
|
if (match) {
|
964
921
|
var _match = _slicedToArray(match, 2),
|
965
|
-
|
966
|
-
|
967
|
-
|
922
|
+
block = _match[0],
|
923
|
+
path = _match[1];
|
968
924
|
if (Editor.isEnd(editor, selection.anchor, path) && block.type === 'heading') {
|
969
925
|
Transforms.insertNodes(editor, {
|
970
926
|
type: 'paragraph',
|
@@ -976,37 +932,32 @@ function withCustomInsertBreak(editor) {
|
|
976
932
|
}
|
977
933
|
}
|
978
934
|
}
|
979
|
-
|
980
935
|
insertBreak();
|
981
936
|
};
|
982
|
-
|
983
937
|
return editor;
|
984
938
|
}
|
985
939
|
|
986
|
-
var styles$
|
940
|
+
var styles$9 = {"linkTooltip":"LinkTooltip-module_linkTooltip__esBv0","thumbnail":"LinkTooltip-module_thumbnail__3Vzce","thumbnailClickMask":"LinkTooltip-module_thumbnailClickMask__3iSZw","newTab":"LinkTooltip-module_newTab__3uW7O","chapterNumber":"LinkTooltip-module_chapterNumber__YUvjI"};
|
987
941
|
|
942
|
+
var _excluded$3 = ["styles"];
|
988
943
|
function _extends$3() {
|
989
|
-
_extends$3 = Object.assign
|
944
|
+
_extends$3 = Object.assign ? Object.assign.bind() : function (target) {
|
990
945
|
for (var i = 1; i < arguments.length; i++) {
|
991
946
|
var source = arguments[i];
|
992
|
-
|
993
947
|
for (var key in source) {
|
994
948
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
995
949
|
target[key] = source[key];
|
996
950
|
}
|
997
951
|
}
|
998
952
|
}
|
999
|
-
|
1000
953
|
return target;
|
1001
954
|
};
|
1002
|
-
|
1003
955
|
return _extends$3.apply(this, arguments);
|
1004
956
|
}
|
1005
957
|
var ExternalLinkIcon = (function (_ref) {
|
1006
958
|
var _ref$styles = _ref.styles,
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
959
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
960
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
1010
961
|
return /*#__PURE__*/React.createElement("svg", _extends$3({
|
1011
962
|
"aria-hidden": "true",
|
1012
963
|
"data-prefix": "fas",
|
@@ -1021,32 +972,48 @@ var ExternalLinkIcon = (function (_ref) {
|
|
1021
972
|
});
|
1022
973
|
|
1023
974
|
var UpdateContext = createContext();
|
1024
|
-
function LinkTooltipProvider(
|
1025
|
-
var
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
975
|
+
function LinkTooltipProvider(props) {
|
976
|
+
var update = useContext(UpdateContext);
|
977
|
+
if (update) {
|
978
|
+
return props.children;
|
979
|
+
} else {
|
980
|
+
return /*#__PURE__*/React.createElement(LinkTooltipProviderInner, props);
|
981
|
+
}
|
982
|
+
}
|
983
|
+
function LinkTooltipProviderInner(_ref) {
|
984
|
+
var disabled = _ref.disabled,
|
985
|
+
position = _ref.position,
|
986
|
+
children = _ref.children,
|
987
|
+
_ref$align = _ref.align,
|
988
|
+
align = _ref$align === void 0 ? 'left' : _ref$align,
|
989
|
+
_ref$gap = _ref.gap,
|
990
|
+
gap = _ref$gap === void 0 ? 10 : _ref$gap;
|
1030
991
|
var _useState = useState(),
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
var
|
992
|
+
_useState2 = _slicedToArray(_useState, 2),
|
993
|
+
state = _useState2[0],
|
994
|
+
setState = _useState2[1];
|
995
|
+
var arrowRef = useRef();
|
996
|
+
var _useFloating = useFloating({
|
997
|
+
placement: "".concat(position === 'below' ? 'bottom' : 'top').concat(align === 'left' ? '-start' : ''),
|
998
|
+
middleware: [offset(gap), shift(), arrow({
|
999
|
+
element: arrowRef,
|
1000
|
+
padding: 10
|
1001
|
+
}), inline()],
|
1002
|
+
whileElementsMounted: autoUpdate
|
1003
|
+
}),
|
1004
|
+
refs = _useFloating.refs,
|
1005
|
+
floatingStyles = _useFloating.floatingStyles,
|
1006
|
+
floatingContext = _useFloating.context;
|
1036
1007
|
var update = useMemo(function () {
|
1037
1008
|
var timeout;
|
1038
1009
|
return {
|
1039
1010
|
activate: function activate(href, openInNewTab, linkRef) {
|
1040
1011
|
clearTimeout(timeout);
|
1041
1012
|
timeout = null;
|
1042
|
-
|
1043
|
-
var linkRect = linkRef.current.getBoundingClientRect();
|
1013
|
+
refs.setReference(linkRef.current);
|
1044
1014
|
setState({
|
1045
1015
|
href: href,
|
1046
|
-
openInNewTab: openInNewTab
|
1047
|
-
top: position === 'below' ? linkRect.bottom - outerRect.top + 10 : 'auto',
|
1048
|
-
bottom: position === 'above' ? outerRect.bottom - linkRect.top + 10 : 'auto',
|
1049
|
-
left: linkRect.left - outerRect.left
|
1016
|
+
openInNewTab: openInNewTab
|
1050
1017
|
});
|
1051
1018
|
},
|
1052
1019
|
keep: function keep() {
|
@@ -1062,71 +1029,71 @@ function LinkTooltipProvider(_ref) {
|
|
1062
1029
|
}
|
1063
1030
|
}
|
1064
1031
|
};
|
1065
|
-
}, [
|
1032
|
+
}, [refs]);
|
1066
1033
|
return /*#__PURE__*/React.createElement(UpdateContext.Provider, {
|
1067
1034
|
value: update
|
1068
|
-
}, /*#__PURE__*/React.createElement(
|
1069
|
-
|
1035
|
+
}, /*#__PURE__*/React.createElement(FloatingPortal, {
|
1036
|
+
root: useFloatingPortalRoot()
|
1070
1037
|
}, /*#__PURE__*/React.createElement(LinkTooltip, {
|
1071
|
-
editor: editor,
|
1072
1038
|
state: state,
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1039
|
+
setFloating: refs.setFloating,
|
1040
|
+
floatingStyles: floatingStyles,
|
1041
|
+
floatingContext: floatingContext,
|
1042
|
+
arrowRef: arrowRef,
|
1043
|
+
disabled: disabled
|
1044
|
+
})), children);
|
1076
1045
|
}
|
1077
1046
|
function LinkPreview(_ref2) {
|
1078
1047
|
var href = _ref2.href,
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1048
|
+
openInNewTab = _ref2.openInNewTab,
|
1049
|
+
children = _ref2.children,
|
1050
|
+
className = _ref2.className;
|
1082
1051
|
var _useContext = useContext(UpdateContext),
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1052
|
+
activate = _useContext.activate,
|
1053
|
+
deactivate = _useContext.deactivate;
|
1086
1054
|
var ref = useRef();
|
1087
1055
|
return /*#__PURE__*/React.createElement("span", {
|
1088
1056
|
ref: ref,
|
1057
|
+
className: className,
|
1089
1058
|
onMouseEnter: function onMouseEnter() {
|
1090
1059
|
return activate(href, openInNewTab, ref);
|
1091
1060
|
},
|
1092
|
-
onMouseLeave: deactivate
|
1093
|
-
onMouseDown: deactivate
|
1061
|
+
onMouseLeave: deactivate
|
1094
1062
|
}, children);
|
1095
1063
|
}
|
1096
1064
|
function LinkTooltip(_ref3) {
|
1097
|
-
var
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1065
|
+
var disabled = _ref3.disabled,
|
1066
|
+
setFloating = _ref3.setFloating,
|
1067
|
+
floatingStyles = _ref3.floatingStyles,
|
1068
|
+
floatingContext = _ref3.floatingContext,
|
1069
|
+
arrowRef = _ref3.arrowRef,
|
1070
|
+
state = _ref3.state;
|
1102
1071
|
var _useContext2 = useContext(UpdateContext),
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
if (disabled || !state || editor.selection && !Range.isCollapsed(editor.selection)) {
|
1072
|
+
keep = _useContext2.keep,
|
1073
|
+
deactivate = _useContext2.deactivate;
|
1074
|
+
if (disabled || !state || !state.href) {
|
1107
1075
|
return null;
|
1108
1076
|
}
|
1109
|
-
|
1110
1077
|
return /*#__PURE__*/React.createElement("div", {
|
1111
|
-
|
1078
|
+
ref: setFloating,
|
1079
|
+
className: classNames(styles$9.linkTooltip),
|
1080
|
+
onClick: function onClick(e) {
|
1081
|
+
return e.stopPropagation();
|
1082
|
+
},
|
1112
1083
|
onMouseEnter: keep,
|
1113
1084
|
onMouseLeave: deactivate,
|
1114
|
-
style:
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
}
|
1120
|
-
}, /*#__PURE__*/React.createElement(LinkDestination, {
|
1085
|
+
style: floatingStyles
|
1086
|
+
}, /*#__PURE__*/React.createElement(FloatingArrow, {
|
1087
|
+
ref: arrowRef,
|
1088
|
+
context: floatingContext
|
1089
|
+
}), /*#__PURE__*/React.createElement(LinkDestination, {
|
1121
1090
|
href: state.href,
|
1122
1091
|
openInNewTab: state.openInNewTab
|
1123
1092
|
}));
|
1124
1093
|
}
|
1125
|
-
|
1126
1094
|
function LinkDestination(_ref4) {
|
1127
1095
|
var href = _ref4.href,
|
1128
|
-
|
1129
|
-
|
1096
|
+
openInNewTab = _ref4.openInNewTab;
|
1130
1097
|
if (href === null || href === void 0 ? void 0 : href.chapter) {
|
1131
1098
|
return /*#__PURE__*/React.createElement(ChapterLinkDestination, {
|
1132
1099
|
permaId: href.chapter
|
@@ -1146,60 +1113,50 @@ function LinkDestination(_ref4) {
|
|
1146
1113
|
});
|
1147
1114
|
}
|
1148
1115
|
}
|
1149
|
-
|
1150
1116
|
function ChapterLinkDestination(_ref5) {
|
1151
1117
|
var permaId = _ref5.permaId;
|
1152
1118
|
var chapter = useChapter({
|
1153
1119
|
permaId: permaId
|
1154
1120
|
});
|
1155
|
-
|
1156
1121
|
var _useI18n = useI18n({
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1122
|
+
locale: 'ui'
|
1123
|
+
}),
|
1124
|
+
t = _useI18n.t;
|
1161
1125
|
if (!chapter) {
|
1162
1126
|
return /*#__PURE__*/React.createElement("span", null, t('pageflow_scrolled.inline_editing.link_tooltip.deleted_chapter'));
|
1163
1127
|
}
|
1164
|
-
|
1165
1128
|
return /*#__PURE__*/React.createElement("a", {
|
1166
1129
|
href: "#".concat(chapter.chapterSlug),
|
1167
1130
|
title: t('pageflow_scrolled.inline_editing.link_tooltip.visit_chapter')
|
1168
1131
|
}, /*#__PURE__*/React.createElement("span", {
|
1169
|
-
className: styles$
|
1132
|
+
className: styles$9.chapterNumber
|
1170
1133
|
}, t('pageflow_scrolled.inline_editing.link_tooltip.chapter_number', {
|
1171
1134
|
number: chapter.index + 1
|
1172
1135
|
})), " ", chapter.title);
|
1173
1136
|
}
|
1174
|
-
|
1175
1137
|
function SectionLinkDestination(_ref6) {
|
1176
1138
|
var permaId = _ref6.permaId;
|
1177
|
-
|
1178
1139
|
var _useI18n2 = useI18n({
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1140
|
+
locale: 'ui'
|
1141
|
+
}),
|
1142
|
+
t = _useI18n2.t;
|
1183
1143
|
return /*#__PURE__*/React.createElement("div", {
|
1184
|
-
className: styles$
|
1144
|
+
className: styles$9.thumbnail
|
1185
1145
|
}, /*#__PURE__*/React.createElement(SectionThumbnail, {
|
1186
1146
|
sectionPermaId: permaId
|
1187
1147
|
}), /*#__PURE__*/React.createElement("a", {
|
1188
1148
|
href: "#section-".concat(permaId),
|
1189
|
-
className: styles$
|
1149
|
+
className: styles$9.thumbnailClickMask,
|
1190
1150
|
title: t('pageflow_scrolled.inline_editing.link_tooltip.visit_section')
|
1191
1151
|
}));
|
1192
1152
|
}
|
1193
|
-
|
1194
1153
|
function ExternalLinkDestination(_ref7) {
|
1195
1154
|
var href = _ref7.href,
|
1196
|
-
|
1197
|
-
|
1155
|
+
openInNewTab = _ref7.openInNewTab;
|
1198
1156
|
var _useI18n3 = useI18n({
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1157
|
+
locale: 'ui'
|
1158
|
+
}),
|
1159
|
+
t = _useI18n3.t;
|
1203
1160
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", {
|
1204
1161
|
href: href,
|
1205
1162
|
target: "_blank",
|
@@ -1208,28 +1165,24 @@ function ExternalLinkDestination(_ref7) {
|
|
1208
1165
|
width: 10,
|
1209
1166
|
height: 10
|
1210
1167
|
})), /*#__PURE__*/React.createElement("div", {
|
1211
|
-
className: styles$
|
1168
|
+
className: styles$9.newTab
|
1212
1169
|
}, openInNewTab ? t('pageflow_scrolled.inline_editing.link_tooltip.opens_in_new_tab') : t('pageflow_scrolled.inline_editing.link_tooltip.opens_in_same_tab')));
|
1213
1170
|
}
|
1214
|
-
|
1215
1171
|
function FileLinkDestination(_ref8) {
|
1216
1172
|
var fileOptions = _ref8.fileOptions;
|
1217
|
-
var file =
|
1218
|
-
|
1173
|
+
var file = useDownloadableFile(fileOptions);
|
1219
1174
|
var _useI18n4 = useI18n({
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1175
|
+
locale: 'ui'
|
1176
|
+
}),
|
1177
|
+
t = _useI18n4.t;
|
1224
1178
|
if (!file) {
|
1225
1179
|
return /*#__PURE__*/React.createElement("span", null, t('pageflow_scrolled.inline_editing.link_tooltip.deleted_file'));
|
1226
1180
|
}
|
1227
|
-
|
1228
1181
|
return /*#__PURE__*/React.createElement("a", {
|
1229
|
-
href: file.urls.
|
1182
|
+
href: file.urls.download,
|
1230
1183
|
target: "_blank",
|
1231
1184
|
rel: "noopener noreferrer"
|
1232
|
-
}, file.
|
1185
|
+
}, file.displayName, /*#__PURE__*/React.createElement(ExternalLinkIcon, {
|
1233
1186
|
width: 10,
|
1234
1187
|
height: 10
|
1235
1188
|
}));
|
@@ -1237,24 +1190,26 @@ function FileLinkDestination(_ref8) {
|
|
1237
1190
|
|
1238
1191
|
function withLinks(editor) {
|
1239
1192
|
var isInline = editor.isInline;
|
1240
|
-
|
1241
1193
|
editor.isInline = function (element) {
|
1242
1194
|
return element.type === 'link' ? true : isInline(element);
|
1243
1195
|
};
|
1244
|
-
|
1245
1196
|
return editor;
|
1246
1197
|
}
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1198
|
+
var renderElementWithLinkPreview = wrapRenderElementWithLinkPreview(renderElement);
|
1199
|
+
function wrapRenderElementWithLinkPreview(renderElement) {
|
1200
|
+
return function (options) {
|
1201
|
+
if (options.element.type === 'link') {
|
1202
|
+
return /*#__PURE__*/React.createElement(LinkPreview, {
|
1203
|
+
href: options.element.href,
|
1204
|
+
openInNewTab: options.element.openInNewTab
|
1205
|
+
}, renderElement(options));
|
1206
|
+
} else {
|
1207
|
+
return renderElement(options);
|
1208
|
+
}
|
1209
|
+
};
|
1256
1210
|
}
|
1257
1211
|
|
1212
|
+
// Used to render drop targets between paragraphs only when a content
|
1258
1213
|
// element is currently being dragged over the element. `react-dnd`
|
1259
1214
|
// causes "Update on unmounted component warning" when dropping an
|
1260
1215
|
// element removes a drop target [1]. As a workaround, couple
|
@@ -1262,25 +1217,22 @@ function renderElementWithLinkPreview(options) {
|
|
1262
1217
|
// the drop target is only removed after element has been dropped.
|
1263
1218
|
//
|
1264
1219
|
// [1] https://github.com/react-dnd/react-dnd/issues/1573
|
1265
|
-
|
1266
1220
|
function useDropTargetsActive() {
|
1267
1221
|
var _useState = useState(false),
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1222
|
+
_useState2 = _slicedToArray(_useState, 2),
|
1223
|
+
dropTargetsActive = _useState2[0],
|
1224
|
+
setDropTargetsActive = _useState2[1];
|
1272
1225
|
var _useDrop = useDrop({
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1226
|
+
accept: 'contentElement',
|
1227
|
+
collect: function collect(monitor) {
|
1228
|
+
return {
|
1229
|
+
canDrop: monitor.canDrop() && monitor.isOver()
|
1230
|
+
};
|
1231
|
+
}
|
1232
|
+
}),
|
1233
|
+
_useDrop2 = _slicedToArray(_useDrop, 2),
|
1234
|
+
canDrop = _useDrop2[0].canDrop,
|
1235
|
+
drop = _useDrop2[1];
|
1284
1236
|
useEffect(function () {
|
1285
1237
|
if (canDrop) {
|
1286
1238
|
setDropTargetsActive(true);
|
@@ -1303,15 +1255,12 @@ function useSelectLinkDestination() {
|
|
1303
1255
|
if (abortPreviousCall) {
|
1304
1256
|
abortPreviousCall();
|
1305
1257
|
}
|
1306
|
-
|
1307
1258
|
abortPreviousCall = function abortPreviousCall() {
|
1308
1259
|
window.removeEventListener('message', receive);
|
1309
1260
|
reject();
|
1310
1261
|
};
|
1311
|
-
|
1312
1262
|
postSelectLinkDestinationMessage();
|
1313
1263
|
window.addEventListener('message', receive);
|
1314
|
-
|
1315
1264
|
function receive(message) {
|
1316
1265
|
if (window.location.href.indexOf(message.origin) === 0) {
|
1317
1266
|
if (message.data.type === 'LINK_DESTINATION_SELECTED') {
|
@@ -1325,28 +1274,45 @@ function useSelectLinkDestination() {
|
|
1325
1274
|
};
|
1326
1275
|
}
|
1327
1276
|
|
1277
|
+
var mutuallyExclusive = {
|
1278
|
+
sup: 'sub',
|
1279
|
+
sub: 'sup'
|
1280
|
+
};
|
1281
|
+
function toggleMark(editor, format) {
|
1282
|
+
var isActive = isMarkActive(editor, format);
|
1283
|
+
if (isActive) {
|
1284
|
+
Editor.removeMark(editor, format);
|
1285
|
+
} else {
|
1286
|
+
if (mutuallyExclusive[format] && isMarkActive(editor, mutuallyExclusive[format])) {
|
1287
|
+
Editor.removeMark(editor, mutuallyExclusive[format]);
|
1288
|
+
}
|
1289
|
+
Editor.addMark(editor, format, true);
|
1290
|
+
}
|
1291
|
+
}
|
1292
|
+
function isMarkActive(editor, format) {
|
1293
|
+
var marks = Editor.marks(editor);
|
1294
|
+
return marks ? marks[format] === true : false;
|
1295
|
+
}
|
1296
|
+
|
1297
|
+
var _excluded$4 = ["styles"];
|
1328
1298
|
function _extends$4() {
|
1329
|
-
_extends$4 = Object.assign
|
1299
|
+
_extends$4 = Object.assign ? Object.assign.bind() : function (target) {
|
1330
1300
|
for (var i = 1; i < arguments.length; i++) {
|
1331
1301
|
var source = arguments[i];
|
1332
|
-
|
1333
1302
|
for (var key in source) {
|
1334
1303
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1335
1304
|
target[key] = source[key];
|
1336
1305
|
}
|
1337
1306
|
}
|
1338
1307
|
}
|
1339
|
-
|
1340
1308
|
return target;
|
1341
1309
|
};
|
1342
|
-
|
1343
1310
|
return _extends$4.apply(this, arguments);
|
1344
1311
|
}
|
1345
1312
|
var BoldIcon = (function (_ref) {
|
1346
1313
|
var _ref$styles = _ref.styles,
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1314
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
1315
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
1350
1316
|
return /*#__PURE__*/React.createElement("svg", _extends$4({
|
1351
1317
|
"aria-hidden": "true",
|
1352
1318
|
"data-prefix": "fas",
|
@@ -1360,28 +1326,25 @@ var BoldIcon = (function (_ref) {
|
|
1360
1326
|
}));
|
1361
1327
|
});
|
1362
1328
|
|
1329
|
+
var _excluded$5 = ["styles"];
|
1363
1330
|
function _extends$5() {
|
1364
|
-
_extends$5 = Object.assign
|
1331
|
+
_extends$5 = Object.assign ? Object.assign.bind() : function (target) {
|
1365
1332
|
for (var i = 1; i < arguments.length; i++) {
|
1366
1333
|
var source = arguments[i];
|
1367
|
-
|
1368
1334
|
for (var key in source) {
|
1369
1335
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1370
1336
|
target[key] = source[key];
|
1371
1337
|
}
|
1372
1338
|
}
|
1373
1339
|
}
|
1374
|
-
|
1375
1340
|
return target;
|
1376
1341
|
};
|
1377
|
-
|
1378
1342
|
return _extends$5.apply(this, arguments);
|
1379
1343
|
}
|
1380
1344
|
var UnderlineIcon = (function (_ref) {
|
1381
1345
|
var _ref$styles = _ref.styles,
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1346
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
1347
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
1385
1348
|
return /*#__PURE__*/React.createElement("svg", _extends$5({
|
1386
1349
|
"aria-hidden": "true",
|
1387
1350
|
"data-prefix": "fas",
|
@@ -1395,28 +1358,25 @@ var UnderlineIcon = (function (_ref) {
|
|
1395
1358
|
}));
|
1396
1359
|
});
|
1397
1360
|
|
1361
|
+
var _excluded$6 = ["styles"];
|
1398
1362
|
function _extends$6() {
|
1399
|
-
_extends$6 = Object.assign
|
1363
|
+
_extends$6 = Object.assign ? Object.assign.bind() : function (target) {
|
1400
1364
|
for (var i = 1; i < arguments.length; i++) {
|
1401
1365
|
var source = arguments[i];
|
1402
|
-
|
1403
1366
|
for (var key in source) {
|
1404
1367
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1405
1368
|
target[key] = source[key];
|
1406
1369
|
}
|
1407
1370
|
}
|
1408
1371
|
}
|
1409
|
-
|
1410
1372
|
return target;
|
1411
1373
|
};
|
1412
|
-
|
1413
1374
|
return _extends$6.apply(this, arguments);
|
1414
1375
|
}
|
1415
1376
|
var ItalicIcon = (function (_ref) {
|
1416
1377
|
var _ref$styles = _ref.styles,
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1378
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
1379
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
1420
1380
|
return /*#__PURE__*/React.createElement("svg", _extends$6({
|
1421
1381
|
"aria-hidden": "true",
|
1422
1382
|
"data-prefix": "fas",
|
@@ -1430,28 +1390,25 @@ var ItalicIcon = (function (_ref) {
|
|
1430
1390
|
}));
|
1431
1391
|
});
|
1432
1392
|
|
1393
|
+
var _excluded$7 = ["styles"];
|
1433
1394
|
function _extends$7() {
|
1434
|
-
_extends$7 = Object.assign
|
1395
|
+
_extends$7 = Object.assign ? Object.assign.bind() : function (target) {
|
1435
1396
|
for (var i = 1; i < arguments.length; i++) {
|
1436
1397
|
var source = arguments[i];
|
1437
|
-
|
1438
1398
|
for (var key in source) {
|
1439
1399
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1440
1400
|
target[key] = source[key];
|
1441
1401
|
}
|
1442
1402
|
}
|
1443
1403
|
}
|
1444
|
-
|
1445
1404
|
return target;
|
1446
1405
|
};
|
1447
|
-
|
1448
1406
|
return _extends$7.apply(this, arguments);
|
1449
1407
|
}
|
1450
1408
|
var StrikethroughIcon = (function (_ref) {
|
1451
1409
|
var _ref$styles = _ref.styles,
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1410
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
1411
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
1455
1412
|
return /*#__PURE__*/React.createElement("svg", _extends$7({
|
1456
1413
|
"aria-hidden": "true",
|
1457
1414
|
"data-prefix": "fas",
|
@@ -1465,89 +1422,161 @@ var StrikethroughIcon = (function (_ref) {
|
|
1465
1422
|
}));
|
1466
1423
|
});
|
1467
1424
|
|
1425
|
+
var _excluded$8 = ["styles"];
|
1468
1426
|
function _extends$8() {
|
1469
|
-
_extends$8 = Object.assign
|
1427
|
+
_extends$8 = Object.assign ? Object.assign.bind() : function (target) {
|
1470
1428
|
for (var i = 1; i < arguments.length; i++) {
|
1471
1429
|
var source = arguments[i];
|
1472
|
-
|
1473
1430
|
for (var key in source) {
|
1474
1431
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1475
1432
|
target[key] = source[key];
|
1476
1433
|
}
|
1477
1434
|
}
|
1478
1435
|
}
|
1479
|
-
|
1480
1436
|
return target;
|
1481
1437
|
};
|
1482
|
-
|
1483
1438
|
return _extends$8.apply(this, arguments);
|
1484
1439
|
}
|
1485
|
-
var
|
1440
|
+
var SubIcon = (function (_ref) {
|
1486
1441
|
var _ref$styles = _ref.styles,
|
1487
|
-
|
1488
|
-
props = _objectWithoutProperties(_ref, ["styles"]);
|
1489
|
-
|
1442
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
1490
1443
|
return /*#__PURE__*/React.createElement("svg", _extends$8({
|
1491
|
-
"aria-hidden": "true",
|
1492
|
-
"data-prefix": "fas",
|
1493
|
-
"data-icon": "link",
|
1494
|
-
className: (styles["svg-inline--fa"] || "svg-inline--fa") + " " + (styles["fa-link"] || "fa-link") + " " + (styles["fa-w-16"] || "fa-w-16"),
|
1495
1444
|
xmlns: "http://www.w3.org/2000/svg",
|
1496
1445
|
viewBox: "0 0 512 512"
|
1497
1446
|
}, props), /*#__PURE__*/React.createElement("path", {
|
1498
|
-
|
1499
|
-
d: "M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 01-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0120.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0020.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 00-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"
|
1447
|
+
d: "M32 64C14.3 64 0 78.3 0 96s14.3 32 32 32h15.3l89.6 128-89.6 128H32c-17.7 0-32 14.3-32 32s14.3 32 32 32h32c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6h32c17.7 0 32-14.3 32-32s-14.3-32-32-32h-15.3l-89.6-128 89.6-128H320c17.7 0 32-14.3 32-32s-14.3-32-32-32h-32c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64H32zm448 256c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 361.5 404.3 368 416 368v80c-17.7 0-32 14.3-32 32s14.3 32 32 32h64c17.7 0 32-14.3 32-32s-14.3-32-32-32V320z"
|
1500
1448
|
}));
|
1501
1449
|
});
|
1502
1450
|
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
var selectLinkDestination = useSelectLinkDestination();
|
1515
|
-
useEffect(function () {
|
1516
|
-
var el = ref.current;
|
1517
|
-
var selection = editor.selection;
|
1518
|
-
|
1519
|
-
if (!el || !outerRef.current) {
|
1520
|
-
return;
|
1451
|
+
var _excluded$9 = ["styles"];
|
1452
|
+
function _extends$9() {
|
1453
|
+
_extends$9 = Object.assign ? Object.assign.bind() : function (target) {
|
1454
|
+
for (var i = 1; i < arguments.length; i++) {
|
1455
|
+
var source = arguments[i];
|
1456
|
+
for (var key in source) {
|
1457
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1458
|
+
target[key] = source[key];
|
1459
|
+
}
|
1460
|
+
}
|
1521
1461
|
}
|
1462
|
+
return target;
|
1463
|
+
};
|
1464
|
+
return _extends$9.apply(this, arguments);
|
1465
|
+
}
|
1466
|
+
var SupIcon = (function (_ref) {
|
1467
|
+
var _ref$styles = _ref.styles,
|
1468
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
1469
|
+
return /*#__PURE__*/React.createElement("svg", _extends$9({
|
1470
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1471
|
+
viewBox: "0 0 512 512"
|
1472
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
1473
|
+
d: "M480 32c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 73.5 404.3 80 416 80v80c-17.7 0-32 14.3-32 32s14.3 32 32 32h64c17.7 0 32-14.3 32-32s-14.3-32-32-32V32zM32 64C14.3 64 0 78.3 0 96s14.3 32 32 32h15.3l89.6 128-89.6 128H32c-17.7 0-32 14.3-32 32s14.3 32 32 32h32c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6h32c17.7 0 32-14.3 32-32s-14.3-32-32-32h-15.3l-89.6-128 89.6-128H320c17.7 0 32-14.3 32-32s-14.3-32-32-32h-32c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64H32z"
|
1474
|
+
}));
|
1475
|
+
});
|
1522
1476
|
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1477
|
+
var _excluded$a = ["styles"];
|
1478
|
+
function _extends$a() {
|
1479
|
+
_extends$a = Object.assign ? Object.assign.bind() : function (target) {
|
1480
|
+
for (var i = 1; i < arguments.length; i++) {
|
1481
|
+
var source = arguments[i];
|
1482
|
+
for (var key in source) {
|
1483
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1484
|
+
target[key] = source[key];
|
1485
|
+
}
|
1486
|
+
}
|
1526
1487
|
}
|
1488
|
+
return target;
|
1489
|
+
};
|
1490
|
+
return _extends$a.apply(this, arguments);
|
1491
|
+
}
|
1492
|
+
var link = (function (_ref) {
|
1493
|
+
var _ref$styles = _ref.styles,
|
1494
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
1495
|
+
props = _objectWithoutProperties(_ref, _excluded$a);
|
1496
|
+
return /*#__PURE__*/React.createElement("svg", _extends$a({
|
1497
|
+
"aria-hidden": "true",
|
1498
|
+
"data-prefix": "fas",
|
1499
|
+
"data-icon": "link",
|
1500
|
+
className: (styles["svg-inline--fa"] || "svg-inline--fa") + " " + (styles["fa-link"] || "fa-link") + " " + (styles["fa-w-16"] || "fa-w-16"),
|
1501
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1502
|
+
viewBox: "0 0 512 512"
|
1503
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
1504
|
+
fill: "currentColor",
|
1505
|
+
d: "M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 01-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0120.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0020.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 00-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"
|
1506
|
+
}));
|
1507
|
+
});
|
1527
1508
|
|
1509
|
+
function HoveringToolbar(_ref) {
|
1510
|
+
var children = _ref.children;
|
1511
|
+
var editor = useSlate();
|
1512
|
+
var _useI18n = useI18n({
|
1513
|
+
locale: 'ui'
|
1514
|
+
}),
|
1515
|
+
t = _useI18n.t;
|
1516
|
+
var selectLinkDestination = useSelectLinkDestination();
|
1517
|
+
var _useState = useState(false),
|
1518
|
+
_useState2 = _slicedToArray(_useState, 2),
|
1519
|
+
isOpen = _useState2[0],
|
1520
|
+
setIsOpen = _useState2[1];
|
1521
|
+
var _useState3 = useState(false),
|
1522
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
1523
|
+
isDragging = _useState4[0],
|
1524
|
+
setIsDragging = _useState4[1];
|
1525
|
+
var _useFloating = useFloating({
|
1526
|
+
placement: 'bottom-start',
|
1527
|
+
middleware: [offset(5), shift({
|
1528
|
+
crossAxis: true,
|
1529
|
+
padding: {
|
1530
|
+
left: 10,
|
1531
|
+
right: 10
|
1532
|
+
}
|
1533
|
+
})]
|
1534
|
+
}),
|
1535
|
+
refs = _useFloating.refs,
|
1536
|
+
floatingStyles = _useFloating.floatingStyles;
|
1537
|
+
useEffect(function () {
|
1538
|
+
var selection = editor.selection;
|
1539
|
+
if (isDragging || !selection || !ReactEditor.isFocused(editor) || Range.isCollapsed(selection) || Editor.string(editor, selection) === '') {
|
1540
|
+
setIsOpen(false);
|
1541
|
+
return;
|
1542
|
+
}
|
1528
1543
|
var domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1544
|
+
refs.setPositionReference({
|
1545
|
+
getBoundingClientRect: function getBoundingClientRect() {
|
1546
|
+
return domRange.getBoundingClientRect();
|
1547
|
+
},
|
1548
|
+
getClientRects: function getClientRects() {
|
1549
|
+
return domRange.getClientRects();
|
1550
|
+
}
|
1551
|
+
});
|
1552
|
+
setIsOpen(true);
|
1553
|
+
}, [refs, editor, editor.selection, isDragging]);
|
1554
|
+
var handleMouseDown = useCallback(function () {
|
1555
|
+
setIsDragging(true);
|
1556
|
+
function handleMouseUp() {
|
1557
|
+
// When clicking inside a selection, the selection sometimes
|
1558
|
+
// only resets after mouseup has fired. Prevent toolbar from
|
1559
|
+
// shortly being hidden and shown again before finally being
|
1560
|
+
// hidden when the selection resets.
|
1561
|
+
setTimeout(function () {
|
1562
|
+
setIsDragging(false);
|
1563
|
+
}, 10);
|
1540
1564
|
}
|
1541
|
-
|
1565
|
+
document.addEventListener('mouseup', handleMouseUp);
|
1566
|
+
return function () {
|
1567
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
1568
|
+
};
|
1569
|
+
}, []);
|
1570
|
+
var floatingPortalRoot = useFloatingPortalRoot();
|
1542
1571
|
return /*#__PURE__*/React.createElement("div", {
|
1543
|
-
|
1544
|
-
|
1572
|
+
onMouseDown: handleMouseDown
|
1573
|
+
}, isOpen && /*#__PURE__*/React.createElement(FloatingPortal, {
|
1574
|
+
root: floatingPortalRoot
|
1545
1575
|
}, /*#__PURE__*/React.createElement("div", {
|
1546
|
-
ref:
|
1547
|
-
|
1548
|
-
}, renderToolbar$1(editor, t, selectLinkDestination)));
|
1576
|
+
ref: refs.setFloating,
|
1577
|
+
style: floatingStyles
|
1578
|
+
}, renderToolbar$1(editor, t, selectLinkDestination))), children);
|
1549
1579
|
}
|
1550
|
-
|
1551
1580
|
function renderToolbar$1(editor, t, selectLinkDestination) {
|
1552
1581
|
var buttons = [{
|
1553
1582
|
name: 'bold',
|
@@ -1565,10 +1594,18 @@ function renderToolbar$1(editor, t, selectLinkDestination) {
|
|
1565
1594
|
name: 'strikethrough',
|
1566
1595
|
text: t('pageflow_scrolled.inline_editing.formats.strikethrough'),
|
1567
1596
|
icon: StrikethroughIcon
|
1597
|
+
}, {
|
1598
|
+
name: 'sub',
|
1599
|
+
text: t('pageflow_scrolled.inline_editing.formats.sub'),
|
1600
|
+
icon: SubIcon
|
1601
|
+
}, {
|
1602
|
+
name: 'sup',
|
1603
|
+
text: t('pageflow_scrolled.inline_editing.formats.sup'),
|
1604
|
+
icon: SupIcon
|
1568
1605
|
}, {
|
1569
1606
|
name: 'link',
|
1570
1607
|
text: isButtonActive(editor, 'link') ? t('pageflow_scrolled.inline_editing.remove_link') : t('pageflow_scrolled.inline_editing.insert_link'),
|
1571
|
-
icon:
|
1608
|
+
icon: link
|
1572
1609
|
}].map(function (button) {
|
1573
1610
|
return _objectSpread2(_objectSpread2({}, button), {}, {
|
1574
1611
|
active: isButtonActive(editor, button.name)
|
@@ -1581,7 +1618,6 @@ function renderToolbar$1(editor, t, selectLinkDestination) {
|
|
1581
1618
|
}
|
1582
1619
|
});
|
1583
1620
|
}
|
1584
|
-
|
1585
1621
|
function handleButtonClick(editor, format, selectLinkDestination) {
|
1586
1622
|
if (format === 'link') {
|
1587
1623
|
if (isLinkActive(editor)) {
|
@@ -1589,7 +1625,7 @@ function handleButtonClick(editor, format, selectLinkDestination) {
|
|
1589
1625
|
} else {
|
1590
1626
|
selectLinkDestination().then(function (_ref2) {
|
1591
1627
|
var href = _ref2.href,
|
1592
|
-
|
1628
|
+
openInNewTab = _ref2.openInNewTab;
|
1593
1629
|
wrapLink(editor, href, openInNewTab);
|
1594
1630
|
}, function () {});
|
1595
1631
|
}
|
@@ -1597,7 +1633,6 @@ function handleButtonClick(editor, format, selectLinkDestination) {
|
|
1597
1633
|
toggleMark(editor, format);
|
1598
1634
|
}
|
1599
1635
|
}
|
1600
|
-
|
1601
1636
|
function isButtonActive(editor, format) {
|
1602
1637
|
if (format === 'link') {
|
1603
1638
|
return isLinkActive(editor);
|
@@ -1605,7 +1640,6 @@ function isButtonActive(editor, format) {
|
|
1605
1640
|
return isMarkActive(editor, format);
|
1606
1641
|
}
|
1607
1642
|
}
|
1608
|
-
|
1609
1643
|
function unwrapLink(editor) {
|
1610
1644
|
Transforms.unwrapNodes(editor, {
|
1611
1645
|
match: function match(n) {
|
@@ -1613,7 +1647,6 @@ function unwrapLink(editor) {
|
|
1613
1647
|
}
|
1614
1648
|
});
|
1615
1649
|
}
|
1616
|
-
|
1617
1650
|
function wrapLink(editor, href, openInNewTab) {
|
1618
1651
|
var link = {
|
1619
1652
|
type: 'link',
|
@@ -1628,33 +1661,18 @@ function wrapLink(editor, href, openInNewTab) {
|
|
1628
1661
|
edge: 'end'
|
1629
1662
|
});
|
1630
1663
|
}
|
1631
|
-
|
1632
1664
|
function isLinkActive(editor) {
|
1633
1665
|
var _Editor$nodes = Editor.nodes(editor, {
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1666
|
+
match: function match(n) {
|
1667
|
+
return n.type === 'link';
|
1668
|
+
}
|
1669
|
+
}),
|
1670
|
+
_Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
|
1671
|
+
link = _Editor$nodes2[0];
|
1641
1672
|
return !!link;
|
1642
1673
|
}
|
1643
1674
|
|
1644
|
-
|
1645
|
-
var isActive = isMarkActive(editor, format);
|
1646
|
-
|
1647
|
-
if (isActive) {
|
1648
|
-
Editor.removeMark(editor, format);
|
1649
|
-
} else {
|
1650
|
-
Editor.addMark(editor, format, true);
|
1651
|
-
}
|
1652
|
-
}
|
1653
|
-
|
1654
|
-
function isMarkActive(editor, format) {
|
1655
|
-
var marks = Editor.marks(editor);
|
1656
|
-
return marks ? marks[format] === true : false;
|
1657
|
-
}
|
1675
|
+
var styles$a = {"container":"index-module_container__3dD9z","shy":"index-module_shy__KgWjc","selected":"index-module_selected__mE58y","selection":"index-module_selection__3dUiD"};
|
1658
1676
|
|
1659
1677
|
function getUniformSelectedNode(editor, propertyName) {
|
1660
1678
|
var currentNodeEntries = _toConsumableArray(Editor.nodes(editor, {
|
@@ -1663,15 +1681,12 @@ function getUniformSelectedNode(editor, propertyName) {
|
|
1663
1681
|
},
|
1664
1682
|
mode: 'highest'
|
1665
1683
|
}));
|
1666
|
-
|
1667
1684
|
var values = _toConsumableArray(new Set(currentNodeEntries.map(function (_ref) {
|
1668
1685
|
var _ref2 = _slicedToArray(_ref, 2),
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1686
|
+
node = _ref2[0],
|
1687
|
+
path = _ref2[1];
|
1672
1688
|
return node[propertyName];
|
1673
1689
|
})));
|
1674
|
-
|
1675
1690
|
return values.length === 1 ? currentNodeEntries[0][0] : null;
|
1676
1691
|
}
|
1677
1692
|
|
@@ -1732,13 +1747,12 @@ function _createForOfIteratorHelper(o) {
|
|
1732
1747
|
|
1733
1748
|
function isBlockActive(editor, format) {
|
1734
1749
|
var _Editor$nodes = Editor.nodes(editor, {
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1750
|
+
match: function match(n) {
|
1751
|
+
return n.type === format;
|
1752
|
+
}
|
1753
|
+
}),
|
1754
|
+
_Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
|
1755
|
+
match = _Editor$nodes2[0];
|
1742
1756
|
return !!match;
|
1743
1757
|
}
|
1744
1758
|
var listTypes = ['numbered-list', 'bulleted-list'];
|
@@ -1754,64 +1768,64 @@ function toggleBlock(editor, format) {
|
|
1754
1768
|
Transforms.setNodes(editor, {
|
1755
1769
|
type: isActive ? 'paragraph' : isList ? 'list-item' : format
|
1756
1770
|
});
|
1757
|
-
|
1758
1771
|
if (!isActive && isList) {
|
1759
1772
|
var block = _objectSpread2({
|
1760
1773
|
type: format,
|
1761
1774
|
children: []
|
1762
|
-
},
|
1763
|
-
|
1775
|
+
}, preserveColorAndTypographyVariant(editor));
|
1764
1776
|
Transforms.wrapNodes(editor, block);
|
1765
1777
|
}
|
1766
1778
|
}
|
1767
|
-
function
|
1779
|
+
function applyTypographyVariant(editor, variant) {
|
1768
1780
|
applyProperties(editor, {
|
1769
1781
|
variant: variant
|
1770
1782
|
});
|
1771
1783
|
}
|
1784
|
+
function applyTypographySize(editor, size) {
|
1785
|
+
applyProperties(editor, {
|
1786
|
+
size: size
|
1787
|
+
});
|
1788
|
+
}
|
1772
1789
|
function applyColor(editor, color) {
|
1773
1790
|
applyProperties(editor, {
|
1774
1791
|
color: color
|
1775
1792
|
});
|
1776
1793
|
}
|
1777
|
-
|
1794
|
+
function applyTextAlign(editor, textAlign) {
|
1795
|
+
applyProperties(editor, {
|
1796
|
+
textAlign: textAlign === 'justify' ? 'justify' : undefined
|
1797
|
+
});
|
1798
|
+
}
|
1778
1799
|
function applyProperties(editor, properties) {
|
1779
1800
|
Transforms.setNodes(editor, properties, {
|
1780
1801
|
mode: 'highest'
|
1781
1802
|
});
|
1782
1803
|
applyPropertiesToListItems(editor, properties);
|
1783
1804
|
}
|
1784
|
-
|
1785
1805
|
function applyPropertiesToListItems(editor, properties) {
|
1786
1806
|
var lists = Editor.nodes(editor, {
|
1787
1807
|
match: function match(n) {
|
1788
1808
|
return listTypes.includes(n.type);
|
1789
1809
|
}
|
1790
1810
|
});
|
1791
|
-
|
1792
1811
|
var _iterator = _createForOfIteratorHelper(lists),
|
1793
|
-
|
1794
|
-
|
1812
|
+
_step;
|
1795
1813
|
try {
|
1796
1814
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
1797
1815
|
var _step$value = _slicedToArray(_step.value, 2),
|
1798
|
-
|
1799
|
-
|
1816
|
+
listPath = _step$value[1];
|
1800
1817
|
var items = Editor.nodes(editor, {
|
1801
1818
|
at: listPath,
|
1802
1819
|
match: function match(n) {
|
1803
1820
|
return n.type === 'list-item';
|
1804
1821
|
}
|
1805
1822
|
});
|
1806
|
-
|
1807
1823
|
var _iterator2 = _createForOfIteratorHelper(items),
|
1808
|
-
|
1809
|
-
|
1824
|
+
_step2;
|
1810
1825
|
try {
|
1811
1826
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
1812
1827
|
var _step2$value = _slicedToArray(_step2.value, 2),
|
1813
|
-
|
1814
|
-
|
1828
|
+
itemPath = _step2$value[1];
|
1815
1829
|
Transforms.setNodes(editor, properties, {
|
1816
1830
|
at: itemPath
|
1817
1831
|
});
|
@@ -1828,8 +1842,7 @@ function applyPropertiesToListItems(editor, properties) {
|
|
1828
1842
|
_iterator.f();
|
1829
1843
|
}
|
1830
1844
|
}
|
1831
|
-
|
1832
|
-
function preserveColorAndTypograpyhVariant(editor) {
|
1845
|
+
function preserveColorAndTypographyVariant(editor) {
|
1833
1846
|
var nodeEntry = Editor.above(editor, {
|
1834
1847
|
at: Range.start(editor.selection),
|
1835
1848
|
match: function match(n) {
|
@@ -1837,43 +1850,33 @@ function preserveColorAndTypograpyhVariant(editor) {
|
|
1837
1850
|
}
|
1838
1851
|
});
|
1839
1852
|
var result = {};
|
1840
|
-
|
1841
1853
|
if (nodeEntry && nodeEntry[0].variant) {
|
1842
1854
|
result.variant = nodeEntry[0].variant;
|
1843
1855
|
}
|
1844
|
-
|
1845
1856
|
if (nodeEntry && nodeEntry[0].color) {
|
1846
1857
|
result.color = nodeEntry[0].color;
|
1847
1858
|
}
|
1848
|
-
|
1849
1859
|
return result;
|
1850
1860
|
}
|
1851
|
-
|
1852
1861
|
function withBlockNormalization(_ref, editor) {
|
1853
1862
|
var onlyParagraphs = _ref.onlyParagraphs;
|
1854
|
-
|
1855
1863
|
if (!onlyParagraphs) {
|
1856
1864
|
return editor;
|
1857
1865
|
}
|
1858
|
-
|
1859
1866
|
var normalizeNode = editor.normalizeNode;
|
1860
|
-
|
1861
1867
|
editor.normalizeNode = function (_ref2) {
|
1862
1868
|
var _ref3 = _slicedToArray(_ref2, 2),
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1869
|
+
node = _ref3[0],
|
1870
|
+
path = _ref3[1];
|
1866
1871
|
if (path.length === 0) {
|
1867
1872
|
var _iterator3 = _createForOfIteratorHelper(Node.children(editor, path)),
|
1868
|
-
|
1869
|
-
|
1873
|
+
_step3;
|
1870
1874
|
try {
|
1871
1875
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
1872
1876
|
var _step3$value = _slicedToArray(_step3.value, 2),
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
if (Element.isElement(child) && child.type !== 'paragraph') {
|
1877
|
+
child = _step3$value[0],
|
1878
|
+
childPath = _step3$value[1];
|
1879
|
+
if (Element$1.isElement(child) && child.type !== 'paragraph') {
|
1877
1880
|
Transforms.unwrapNodes(editor, {
|
1878
1881
|
match: function match(n) {
|
1879
1882
|
return listTypes.includes(n.type);
|
@@ -1894,36 +1897,31 @@ function withBlockNormalization(_ref, editor) {
|
|
1894
1897
|
_iterator3.f();
|
1895
1898
|
}
|
1896
1899
|
}
|
1897
|
-
|
1898
1900
|
return normalizeNode([node, path]);
|
1899
1901
|
};
|
1900
|
-
|
1901
1902
|
return editor;
|
1902
1903
|
}
|
1903
1904
|
|
1904
|
-
|
1905
|
-
|
1905
|
+
var _excluded$b = ["styles"];
|
1906
|
+
function _extends$b() {
|
1907
|
+
_extends$b = Object.assign ? Object.assign.bind() : function (target) {
|
1906
1908
|
for (var i = 1; i < arguments.length; i++) {
|
1907
1909
|
var source = arguments[i];
|
1908
|
-
|
1909
1910
|
for (var key in source) {
|
1910
1911
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1911
1912
|
target[key] = source[key];
|
1912
1913
|
}
|
1913
1914
|
}
|
1914
1915
|
}
|
1915
|
-
|
1916
1916
|
return target;
|
1917
1917
|
};
|
1918
|
-
|
1919
|
-
return _extends$9.apply(this, arguments);
|
1918
|
+
return _extends$b.apply(this, arguments);
|
1920
1919
|
}
|
1921
1920
|
var TextIcon = (function (_ref) {
|
1922
1921
|
var _ref$styles = _ref.styles,
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
return /*#__PURE__*/React.createElement("svg", _extends$9({
|
1922
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
1923
|
+
props = _objectWithoutProperties(_ref, _excluded$b);
|
1924
|
+
return /*#__PURE__*/React.createElement("svg", _extends$b({
|
1927
1925
|
"aria-hidden": "true",
|
1928
1926
|
"data-prefix": "fas",
|
1929
1927
|
"data-icon": "align-justify",
|
@@ -1936,29 +1934,26 @@ var TextIcon = (function (_ref) {
|
|
1936
1934
|
}));
|
1937
1935
|
});
|
1938
1936
|
|
1939
|
-
|
1940
|
-
|
1937
|
+
var _excluded$c = ["styles"];
|
1938
|
+
function _extends$c() {
|
1939
|
+
_extends$c = Object.assign ? Object.assign.bind() : function (target) {
|
1941
1940
|
for (var i = 1; i < arguments.length; i++) {
|
1942
1941
|
var source = arguments[i];
|
1943
|
-
|
1944
1942
|
for (var key in source) {
|
1945
1943
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1946
1944
|
target[key] = source[key];
|
1947
1945
|
}
|
1948
1946
|
}
|
1949
1947
|
}
|
1950
|
-
|
1951
1948
|
return target;
|
1952
1949
|
};
|
1953
|
-
|
1954
|
-
return _extends$a.apply(this, arguments);
|
1950
|
+
return _extends$c.apply(this, arguments);
|
1955
1951
|
}
|
1956
1952
|
var HeadingIcon = (function (_ref) {
|
1957
1953
|
var _ref$styles = _ref.styles,
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
return /*#__PURE__*/React.createElement("svg", _extends$a({
|
1954
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
1955
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
1956
|
+
return /*#__PURE__*/React.createElement("svg", _extends$c({
|
1962
1957
|
"aria-hidden": "true",
|
1963
1958
|
"data-prefix": "fas",
|
1964
1959
|
"data-icon": "heading",
|
@@ -1971,29 +1966,26 @@ var HeadingIcon = (function (_ref) {
|
|
1971
1966
|
}));
|
1972
1967
|
});
|
1973
1968
|
|
1974
|
-
|
1975
|
-
|
1969
|
+
var _excluded$d = ["styles"];
|
1970
|
+
function _extends$d() {
|
1971
|
+
_extends$d = Object.assign ? Object.assign.bind() : function (target) {
|
1976
1972
|
for (var i = 1; i < arguments.length; i++) {
|
1977
1973
|
var source = arguments[i];
|
1978
|
-
|
1979
1974
|
for (var key in source) {
|
1980
1975
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1981
1976
|
target[key] = source[key];
|
1982
1977
|
}
|
1983
1978
|
}
|
1984
1979
|
}
|
1985
|
-
|
1986
1980
|
return target;
|
1987
1981
|
};
|
1988
|
-
|
1989
|
-
return _extends$b.apply(this, arguments);
|
1982
|
+
return _extends$d.apply(this, arguments);
|
1990
1983
|
}
|
1991
1984
|
var OlIcon = (function (_ref) {
|
1992
1985
|
var _ref$styles = _ref.styles,
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
return /*#__PURE__*/React.createElement("svg", _extends$b({
|
1986
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
1987
|
+
props = _objectWithoutProperties(_ref, _excluded$d);
|
1988
|
+
return /*#__PURE__*/React.createElement("svg", _extends$d({
|
1997
1989
|
"aria-hidden": "true",
|
1998
1990
|
"data-prefix": "fas",
|
1999
1991
|
"data-icon": "list-ol",
|
@@ -2006,29 +1998,26 @@ var OlIcon = (function (_ref) {
|
|
2006
1998
|
}));
|
2007
1999
|
});
|
2008
2000
|
|
2009
|
-
|
2010
|
-
|
2001
|
+
var _excluded$e = ["styles"];
|
2002
|
+
function _extends$e() {
|
2003
|
+
_extends$e = Object.assign ? Object.assign.bind() : function (target) {
|
2011
2004
|
for (var i = 1; i < arguments.length; i++) {
|
2012
2005
|
var source = arguments[i];
|
2013
|
-
|
2014
2006
|
for (var key in source) {
|
2015
2007
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
2016
2008
|
target[key] = source[key];
|
2017
2009
|
}
|
2018
2010
|
}
|
2019
2011
|
}
|
2020
|
-
|
2021
2012
|
return target;
|
2022
2013
|
};
|
2023
|
-
|
2024
|
-
return _extends$c.apply(this, arguments);
|
2014
|
+
return _extends$e.apply(this, arguments);
|
2025
2015
|
}
|
2026
2016
|
var UlIcon = (function (_ref) {
|
2027
2017
|
var _ref$styles = _ref.styles,
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
return /*#__PURE__*/React.createElement("svg", _extends$c({
|
2018
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
2019
|
+
props = _objectWithoutProperties(_ref, _excluded$e);
|
2020
|
+
return /*#__PURE__*/React.createElement("svg", _extends$e({
|
2032
2021
|
"aria-hidden": "true",
|
2033
2022
|
"data-prefix": "fas",
|
2034
2023
|
"data-icon": "list-ul",
|
@@ -2041,29 +2030,26 @@ var UlIcon = (function (_ref) {
|
|
2041
2030
|
}));
|
2042
2031
|
});
|
2043
2032
|
|
2044
|
-
|
2045
|
-
|
2033
|
+
var _excluded$f = ["styles"];
|
2034
|
+
function _extends$f() {
|
2035
|
+
_extends$f = Object.assign ? Object.assign.bind() : function (target) {
|
2046
2036
|
for (var i = 1; i < arguments.length; i++) {
|
2047
2037
|
var source = arguments[i];
|
2048
|
-
|
2049
2038
|
for (var key in source) {
|
2050
2039
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
2051
2040
|
target[key] = source[key];
|
2052
2041
|
}
|
2053
2042
|
}
|
2054
2043
|
}
|
2055
|
-
|
2056
2044
|
return target;
|
2057
2045
|
};
|
2058
|
-
|
2059
|
-
return _extends$d.apply(this, arguments);
|
2046
|
+
return _extends$f.apply(this, arguments);
|
2060
2047
|
}
|
2061
2048
|
var QuoteIcon = (function (_ref) {
|
2062
2049
|
var _ref$styles = _ref.styles,
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
return /*#__PURE__*/React.createElement("svg", _extends$d({
|
2050
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
2051
|
+
props = _objectWithoutProperties(_ref, _excluded$f);
|
2052
|
+
return /*#__PURE__*/React.createElement("svg", _extends$f({
|
2067
2053
|
"aria-hidden": "true",
|
2068
2054
|
"data-prefix": "fas",
|
2069
2055
|
"data-icon": "quote-right",
|
@@ -2078,36 +2064,28 @@ var QuoteIcon = (function (_ref) {
|
|
2078
2064
|
|
2079
2065
|
function Selection(props) {
|
2080
2066
|
var editor = useSlate();
|
2081
|
-
|
2082
2067
|
var _useI18n = useI18n({
|
2083
|
-
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2068
|
+
locale: 'ui'
|
2069
|
+
}),
|
2070
|
+
t = _useI18n.t;
|
2087
2071
|
var ref = useRef();
|
2088
2072
|
var outerRef = useRef();
|
2089
2073
|
var innerRef = useRef();
|
2090
2074
|
var boundsRef = useRef();
|
2091
2075
|
var lastRangeRef = useRef();
|
2092
|
-
|
2093
2076
|
var _useContentElementEdi = useContentElementEditorState(),
|
2094
|
-
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2098
|
-
|
2077
|
+
setTransientState = _useContentElementEdi.setTransientState,
|
2078
|
+
select = _useContentElementEdi.select,
|
2079
|
+
isContentElementSelected = _useContentElementEdi.isSelected,
|
2080
|
+
range = _useContentElementEdi.range;
|
2099
2081
|
useEffect(function () {
|
2100
|
-
var _getUniformSelectedNo, _getUniformSelectedNo2;
|
2101
|
-
|
2082
|
+
var _getUniformSelectedNo, _getUniformSelectedNo2, _getUniformSelectedNo3, _getUniformSelectedNo4;
|
2102
2083
|
var selection = editor.selection;
|
2103
|
-
|
2104
2084
|
if (!ref.current) {
|
2105
2085
|
return;
|
2106
2086
|
}
|
2107
|
-
|
2108
2087
|
if (isContentElementSelected && range && lastRangeRef.current !== range) {
|
2109
2088
|
lastRangeRef.current = range;
|
2110
|
-
|
2111
2089
|
if (range[1] === range[0] + 1) {
|
2112
2090
|
Transforms.select(editor, Editor.point(editor, [range[0]], {
|
2113
2091
|
edge: 'start'
|
@@ -2122,40 +2100,35 @@ function Selection(props) {
|
|
2122
2100
|
})
|
2123
2101
|
});
|
2124
2102
|
}
|
2125
|
-
|
2126
2103
|
ReactEditor.focus(editor);
|
2127
2104
|
}
|
2128
|
-
|
2129
2105
|
if (!selection) {
|
2130
2106
|
if (boundsRef.current) {
|
2131
2107
|
hideRect(ref.current);
|
2132
2108
|
boundsRef.current = null;
|
2133
2109
|
}
|
2134
|
-
|
2135
2110
|
return;
|
2136
2111
|
}
|
2137
|
-
|
2138
2112
|
if (!isContentElementSelected && boundsRef.current) {
|
2139
2113
|
hideRect(ref.current);
|
2140
2114
|
boundsRef.current = null;
|
2141
2115
|
window.getSelection().removeAllRanges();
|
2142
2116
|
return;
|
2143
2117
|
}
|
2144
|
-
|
2145
2118
|
if (!isContentElementSelected && !boundsRef.current) {
|
2146
2119
|
select();
|
2147
2120
|
}
|
2148
|
-
|
2149
2121
|
var _computeBounds = computeBounds(editor),
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2122
|
+
_computeBounds2 = _slicedToArray(_computeBounds, 2),
|
2123
|
+
start = _computeBounds2[0],
|
2124
|
+
end = _computeBounds2[1];
|
2154
2125
|
setTransientState({
|
2155
2126
|
editableTextIsSingleBlock: editor.children.length <= 1,
|
2156
2127
|
exampleNode: getUniformSelectedNode(editor, 'type'),
|
2157
2128
|
typographyVariant: (_getUniformSelectedNo = getUniformSelectedNode(editor, 'variant')) === null || _getUniformSelectedNo === void 0 ? void 0 : _getUniformSelectedNo.variant,
|
2158
|
-
|
2129
|
+
typographySize: (_getUniformSelectedNo2 = getUniformSelectedNode(editor, 'size')) === null || _getUniformSelectedNo2 === void 0 ? void 0 : _getUniformSelectedNo2.size,
|
2130
|
+
color: (_getUniformSelectedNo3 = getUniformSelectedNode(editor, 'color')) === null || _getUniformSelectedNo3 === void 0 ? void 0 : _getUniformSelectedNo3.color,
|
2131
|
+
textAlign: (_getUniformSelectedNo4 = getUniformSelectedNode(editor, 'textAlign')) === null || _getUniformSelectedNo4 === void 0 ? void 0 : _getUniformSelectedNo4.textAlign
|
2159
2132
|
});
|
2160
2133
|
boundsRef.current = {
|
2161
2134
|
start: start,
|
@@ -2163,28 +2136,26 @@ function Selection(props) {
|
|
2163
2136
|
};
|
2164
2137
|
updateRect(editor, start, end, outerRef.current, ref.current, innerRef.current);
|
2165
2138
|
});
|
2166
|
-
|
2167
2139
|
var _useDrag = useDrag({
|
2168
|
-
|
2169
|
-
type: 'contentElement',
|
2170
|
-
id: props.contentElementId
|
2171
|
-
},
|
2172
|
-
begin: function begin() {
|
2173
|
-
return {
|
2140
|
+
item: {
|
2174
2141
|
type: 'contentElement',
|
2175
|
-
id: props.contentElementId
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2182
|
-
|
2142
|
+
id: props.contentElementId
|
2143
|
+
},
|
2144
|
+
begin: function begin() {
|
2145
|
+
return {
|
2146
|
+
type: 'contentElement',
|
2147
|
+
id: props.contentElementId,
|
2148
|
+
range: [boundsRef.current.start, boundsRef.current.end + 1]
|
2149
|
+
};
|
2150
|
+
}
|
2151
|
+
}),
|
2152
|
+
_useDrag2 = _slicedToArray(_useDrag, 2),
|
2153
|
+
drag = _useDrag2[1];
|
2183
2154
|
return /*#__PURE__*/React.createElement("div", {
|
2184
2155
|
ref: outerRef
|
2185
2156
|
}, /*#__PURE__*/React.createElement("div", {
|
2186
2157
|
ref: ref,
|
2187
|
-
className: styles$
|
2158
|
+
className: styles$a.selection
|
2188
2159
|
}, /*#__PURE__*/React.createElement(SelectionRect, {
|
2189
2160
|
selected: true,
|
2190
2161
|
drag: drag,
|
@@ -2216,30 +2187,24 @@ function Selection(props) {
|
|
2216
2187
|
ref: innerRef
|
2217
2188
|
}))));
|
2218
2189
|
}
|
2219
|
-
|
2220
2190
|
function computeBounds(editor) {
|
2221
2191
|
var startPoint = Range.start(editor.selection);
|
2222
2192
|
var endPoint = Range.end(editor.selection);
|
2223
2193
|
var startPath = startPoint.path.slice(0, 1);
|
2224
2194
|
var endPath = endPoint.path.slice(0, 1);
|
2225
|
-
|
2226
2195
|
if (!Path.equals(startPath, endPath) && endPoint.offset === 0) {
|
2227
2196
|
endPath = Path.previous(endPath);
|
2228
2197
|
}
|
2229
|
-
|
2230
2198
|
return [startPath[0], endPath[0]];
|
2231
2199
|
}
|
2232
|
-
|
2233
2200
|
function hideRect(el) {
|
2234
2201
|
el.removeAttribute('style');
|
2235
2202
|
}
|
2236
|
-
|
2237
2203
|
function updateRect(editor, startIndex, endIndex, outer, el, inner) {
|
2238
2204
|
var _getDOMNodes = getDOMNodes(editor, startIndex, endIndex),
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2205
|
+
_getDOMNodes2 = _slicedToArray(_getDOMNodes, 2),
|
2206
|
+
startDOMNode = _getDOMNodes2[0],
|
2207
|
+
endDOMNode = _getDOMNodes2[1];
|
2243
2208
|
if (startDOMNode && endDOMNode) {
|
2244
2209
|
var startRect = startDOMNode.getBoundingClientRect();
|
2245
2210
|
var endRect = endDOMNode.getBoundingClientRect();
|
@@ -2249,11 +2214,9 @@ function updateRect(editor, startIndex, endIndex, outer, el, inner) {
|
|
2249
2214
|
inner.style.height = "".concat(endRect.bottom - startRect.top, "px");
|
2250
2215
|
}
|
2251
2216
|
}
|
2252
|
-
|
2253
2217
|
function getDOMNodes(editor, startIndex, endIndex) {
|
2254
2218
|
var startNode = Node.get(editor, [startIndex]);
|
2255
2219
|
var endNode = Node.get(editor, [endIndex]);
|
2256
|
-
|
2257
2220
|
try {
|
2258
2221
|
var startDOMNode = ReactEditor.toDOMNode(editor, startNode);
|
2259
2222
|
var endDOMNode = ReactEditor.toDOMNode(editor, endNode);
|
@@ -2262,7 +2225,6 @@ function getDOMNodes(editor, startIndex, endIndex) {
|
|
2262
2225
|
return [];
|
2263
2226
|
}
|
2264
2227
|
}
|
2265
|
-
|
2266
2228
|
function toolbarButtons(t) {
|
2267
2229
|
return [{
|
2268
2230
|
name: 'paragraph',
|
@@ -2287,17 +2249,15 @@ function toolbarButtons(t) {
|
|
2287
2249
|
}];
|
2288
2250
|
}
|
2289
2251
|
|
2290
|
-
var styles$
|
2252
|
+
var styles$b = {"container":"DropTargets-module_container__3vudG","dropTarget":"DropTargets-module_dropTarget__3mmox","dropIndicator":"DropTargets-module_dropIndicator__2zu4d","isOver":"DropTargets-module_isOver__2usWn"};
|
2291
2253
|
|
2292
2254
|
function DropTargets$1(_ref) {
|
2293
2255
|
var contentElementId = _ref.contentElementId;
|
2294
2256
|
var editor = useSlate();
|
2295
|
-
|
2296
2257
|
var _useState = useState(),
|
2297
|
-
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2258
|
+
_useState2 = _slicedToArray(_useState, 2),
|
2259
|
+
targets = _useState2[0],
|
2260
|
+
setTargets = _useState2[1];
|
2301
2261
|
var containerRef = useRef();
|
2302
2262
|
useEffect(function () {
|
2303
2263
|
if (!targets) {
|
@@ -2306,10 +2266,9 @@ function DropTargets$1(_ref) {
|
|
2306
2266
|
}, [targets, editor]);
|
2307
2267
|
return /*#__PURE__*/React.createElement("div", {
|
2308
2268
|
ref: containerRef,
|
2309
|
-
className: styles$
|
2269
|
+
className: styles$b.container
|
2310
2270
|
}, renderDropTargets(targets || [], contentElementId));
|
2311
2271
|
}
|
2312
|
-
|
2313
2272
|
function renderDropTargets(targets, contentElementId) {
|
2314
2273
|
function handleDrop(item, index) {
|
2315
2274
|
if (index === 0) {
|
@@ -2342,7 +2301,6 @@ function renderDropTargets(targets, contentElementId) {
|
|
2342
2301
|
});
|
2343
2302
|
}
|
2344
2303
|
}
|
2345
|
-
|
2346
2304
|
return targets.map(function (target, index) {
|
2347
2305
|
return /*#__PURE__*/React.createElement(DropTarget, Object.assign({}, target, {
|
2348
2306
|
key: index,
|
@@ -2352,45 +2310,41 @@ function renderDropTargets(targets, contentElementId) {
|
|
2352
2310
|
}));
|
2353
2311
|
});
|
2354
2312
|
}
|
2355
|
-
|
2356
2313
|
function DropTarget(_ref2) {
|
2357
2314
|
var display = _ref2.display,
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2315
|
+
top = _ref2.top,
|
2316
|
+
height = _ref2.height,
|
2317
|
+
indicatorTop = _ref2.indicatorTop,
|
2318
|
+
onDrop = _ref2.onDrop;
|
2363
2319
|
var _useDrop = useDrop({
|
2364
|
-
|
2365
|
-
|
2366
|
-
|
2367
|
-
|
2368
|
-
|
2369
|
-
|
2370
|
-
|
2371
|
-
|
2372
|
-
|
2373
|
-
|
2374
|
-
|
2375
|
-
|
2376
|
-
|
2377
|
-
|
2320
|
+
accept: 'contentElement',
|
2321
|
+
collect: function collect(monitor) {
|
2322
|
+
return {
|
2323
|
+
isOver: monitor.isOver()
|
2324
|
+
};
|
2325
|
+
},
|
2326
|
+
drop: function drop(item) {
|
2327
|
+
return onDrop(item);
|
2328
|
+
}
|
2329
|
+
}),
|
2330
|
+
_useDrop2 = _slicedToArray(_useDrop, 2),
|
2331
|
+
isOver = _useDrop2[0].isOver,
|
2332
|
+
drop = _useDrop2[1];
|
2378
2333
|
return /*#__PURE__*/React.createElement("div", {
|
2379
2334
|
ref: drop,
|
2380
|
-
className: classNames(styles$
|
2335
|
+
className: classNames(styles$b.dropTarget, _defineProperty({}, styles$b.isOver, isOver)),
|
2381
2336
|
style: {
|
2382
2337
|
display: display,
|
2383
2338
|
top: top,
|
2384
2339
|
height: height
|
2385
2340
|
}
|
2386
2341
|
}, /*#__PURE__*/React.createElement("div", {
|
2387
|
-
className: styles$
|
2342
|
+
className: styles$b.dropIndicator,
|
2388
2343
|
style: {
|
2389
2344
|
top: indicatorTop
|
2390
2345
|
}
|
2391
2346
|
}));
|
2392
2347
|
}
|
2393
|
-
|
2394
2348
|
function measureHeights(editor, container) {
|
2395
2349
|
var containerRect = container.getBoundingClientRect();
|
2396
2350
|
var lastTargetDimensions = {
|
@@ -2424,11 +2378,9 @@ function measureHeights(editor, container) {
|
|
2424
2378
|
var shy = "\xAD";
|
2425
2379
|
function decorateCharacter(_ref, character, attributes, _ref2) {
|
2426
2380
|
var _ref3 = _slicedToArray(_ref, 2),
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2381
|
+
node = _ref3[0],
|
2382
|
+
path = _ref3[1];
|
2430
2383
|
var length = _ref2.length;
|
2431
|
-
|
2432
2384
|
if (Text.isText(node)) {
|
2433
2385
|
var parts = node.text.split(character);
|
2434
2386
|
parts.pop();
|
@@ -2447,13 +2399,11 @@ function decorateCharacter(_ref, character, attributes, _ref2) {
|
|
2447
2399
|
}, attributes);
|
2448
2400
|
});
|
2449
2401
|
}
|
2450
|
-
|
2451
2402
|
return [];
|
2452
2403
|
}
|
2453
2404
|
function deleteCharacter(editor, node, path, regExp) {
|
2454
2405
|
var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
2455
2406
|
var match = regExp.exec(node.text);
|
2456
|
-
|
2457
2407
|
if (match) {
|
2458
2408
|
Transforms["delete"](editor, {
|
2459
2409
|
at: {
|
@@ -2465,7 +2415,6 @@ function deleteCharacter(editor, node, path, regExp) {
|
|
2465
2415
|
});
|
2466
2416
|
return true;
|
2467
2417
|
}
|
2468
|
-
|
2469
2418
|
return false;
|
2470
2419
|
}
|
2471
2420
|
|
@@ -2474,7 +2423,6 @@ function useLineBreakHandler(editor) {
|
|
2474
2423
|
if (event.key !== 'Enter') {
|
2475
2424
|
return;
|
2476
2425
|
}
|
2477
|
-
|
2478
2426
|
if (event.altKey === true) {
|
2479
2427
|
editor.insertText(shy);
|
2480
2428
|
event.preventDefault();
|
@@ -2493,15 +2441,13 @@ function decorateLineBreaks(nodeEntry) {
|
|
2493
2441
|
}
|
2494
2442
|
function renderLeafWithLineBreakDecoration(_ref) {
|
2495
2443
|
var leaf = _ref.leaf,
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2444
|
+
children = _ref.children,
|
2445
|
+
attributes = _ref.attributes;
|
2499
2446
|
if (leaf.shy) {
|
2500
2447
|
children = /*#__PURE__*/React.createElement("span", {
|
2501
|
-
className: styles$
|
2448
|
+
className: styles$a.shy
|
2502
2449
|
}, children);
|
2503
2450
|
}
|
2504
|
-
|
2505
2451
|
return renderLeaf$1({
|
2506
2452
|
leaf: leaf,
|
2507
2453
|
children: children,
|
@@ -2510,68 +2456,103 @@ function renderLeafWithLineBreakDecoration(_ref) {
|
|
2510
2456
|
}
|
2511
2457
|
function withLineBreakNormalization(editor) {
|
2512
2458
|
var normalizeNode = editor.normalizeNode;
|
2513
|
-
|
2514
2459
|
editor.normalizeNode = function (_ref2) {
|
2515
2460
|
var _ref3 = _slicedToArray(_ref2, 2),
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2461
|
+
node = _ref3[0],
|
2462
|
+
path = _ref3[1];
|
2519
2463
|
if (node.text) {
|
2520
2464
|
if (deleteCharacter(editor, node, path, new RegExp("".concat(shy, "\\s"))) || deleteCharacter(editor, node, path, new RegExp("^".concat(shy))) || deleteCharacter(editor, node, path, new RegExp("\\s".concat(shy)), 1) || deleteCharacter(editor, node, path, new RegExp("".concat(shy).concat(shy)))) {
|
2521
2465
|
return;
|
2522
2466
|
}
|
2523
2467
|
}
|
2524
|
-
|
2525
2468
|
return normalizeNode([node, path]);
|
2526
2469
|
};
|
2527
|
-
|
2528
2470
|
return editor;
|
2529
2471
|
}
|
2530
2472
|
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2473
|
+
function useShortcutHandler(editor) {
|
2474
|
+
return useCallback(function (event) {
|
2475
|
+
if (!event.ctrlKey) {
|
2476
|
+
return;
|
2477
|
+
}
|
2478
|
+
if (event.key === 'z') {
|
2479
|
+
event.preventDefault();
|
2480
|
+
editor.undo();
|
2481
|
+
} else if (event.key === 'y') {
|
2482
|
+
event.preventDefault();
|
2483
|
+
editor.redo();
|
2484
|
+
} else if (event.key === 'b') {
|
2485
|
+
event.preventDefault();
|
2486
|
+
toggleMark(editor, 'bold');
|
2487
|
+
} else if (event.key === 'i') {
|
2488
|
+
event.preventDefault();
|
2489
|
+
toggleMark(editor, 'italic');
|
2490
|
+
} else if (event.key === 'u') {
|
2491
|
+
event.preventDefault();
|
2492
|
+
toggleMark(editor, 'underline');
|
2493
|
+
} else if (event.key === 'S') {
|
2494
|
+
event.preventDefault();
|
2495
|
+
toggleMark(editor, 'strikethrough');
|
2496
|
+
} else if (event.key === ',') {
|
2497
|
+
event.preventDefault();
|
2498
|
+
toggleMark(editor, 'sup');
|
2499
|
+
} else if (event.key === ';') {
|
2500
|
+
event.preventDefault();
|
2501
|
+
toggleMark(editor, 'sub');
|
2502
|
+
}
|
2503
|
+
}, [editor]);
|
2504
|
+
}
|
2505
|
+
|
2506
|
+
var selectedClassName = styles$a.selected;
|
2507
|
+
var EditableText = React.memo(function EditableText(_ref) {
|
2508
|
+
var value = _ref.value,
|
2509
|
+
contentElementId = _ref.contentElementId,
|
2510
|
+
placeholder = _ref.placeholder,
|
2511
|
+
onChange = _ref.onChange,
|
2512
|
+
selectionRect = _ref.selectionRect,
|
2513
|
+
className = _ref.className,
|
2514
|
+
placeholderClassName = _ref.placeholderClassName,
|
2515
|
+
_ref$scaleCategory = _ref.scaleCategory,
|
2516
|
+
scaleCategory = _ref$scaleCategory === void 0 ? 'body' : _ref$scaleCategory,
|
2517
|
+
typographyVariant = _ref.typographyVariant,
|
2518
|
+
typographySize = _ref.typographySize,
|
2519
|
+
autoFocus = _ref.autoFocus,
|
2520
|
+
_ref$floatingControls = _ref.floatingControlsPosition,
|
2521
|
+
floatingControlsPosition = _ref$floatingControls === void 0 ? 'above' : _ref$floatingControls;
|
2522
|
+
var editor = useMemo(function () {
|
2523
|
+
return withLinks(withCustomInsertBreak(withBlockNormalization({
|
2546
2524
|
onlyParagraphs: !selectionRect
|
2547
|
-
}, withLineBreakNormalization(withReact(createEditor())))));
|
2525
|
+
}, withLineBreakNormalization(withReact(withHistory(createEditor()))))));
|
2548
2526
|
}, [selectionRect]);
|
2549
2527
|
var handleLineBreaks = useLineBreakHandler(editor);
|
2528
|
+
var handleShortcuts = useShortcutHandler(editor);
|
2529
|
+
var handleKeyDown = useCallback(function (event) {
|
2530
|
+
handleLineBreaks(event);
|
2531
|
+
handleShortcuts(event);
|
2532
|
+
}, [handleLineBreaks, handleShortcuts]);
|
2550
2533
|
useEffect(function () {
|
2551
2534
|
if (autoFocus) {
|
2552
2535
|
ReactEditor.focus(editor);
|
2553
2536
|
}
|
2554
2537
|
}, [autoFocus, editor]);
|
2555
|
-
|
2556
2538
|
var _useCachedValue = useCachedValue(value, {
|
2557
|
-
|
2558
|
-
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2539
|
+
defaultValue: [{
|
2540
|
+
type: 'paragraph',
|
2541
|
+
children: [{
|
2542
|
+
text: ''
|
2543
|
+
}]
|
2544
|
+
}],
|
2545
|
+
onDebouncedChange: onChange,
|
2546
|
+
onReset: function onReset(nextValue) {
|
2547
|
+
resetSelectionIfOutsideNextValue(editor, nextValue);
|
2548
|
+
resetHistory(editor);
|
2549
|
+
}
|
2550
|
+
}),
|
2551
|
+
_useCachedValue2 = _slicedToArray(_useCachedValue, 2),
|
2552
|
+
cachedValue = _useCachedValue2[0],
|
2553
|
+
setCachedValue = _useCachedValue2[1];
|
2572
2554
|
var _useContentElementEdi = useContentElementEditorState(),
|
2573
|
-
|
2574
|
-
|
2555
|
+
isSelected = _useContentElementEdi.isSelected;
|
2575
2556
|
useContentElementEditorCommandSubscription(function (command) {
|
2576
2557
|
if (command.type === 'REMOVE') {
|
2577
2558
|
Transforms.removeNodes(editor, {
|
@@ -2579,92 +2560,92 @@ var EditableText = React.memo(function EditableText(_ref) {
|
|
2579
2560
|
});
|
2580
2561
|
} else if (command.type === 'TRANSIENT_STATE_UPDATE') {
|
2581
2562
|
if ('typographyVariant' in command.payload) {
|
2582
|
-
|
2563
|
+
applyTypographyVariant(editor, command.payload.typographyVariant);
|
2564
|
+
}
|
2565
|
+
if ('typographySize' in command.payload) {
|
2566
|
+
applyTypographySize(editor, command.payload.typographySize);
|
2583
2567
|
}
|
2584
|
-
|
2585
2568
|
if ('color' in command.payload) {
|
2586
2569
|
applyColor(editor, command.payload.color);
|
2587
2570
|
}
|
2571
|
+
if ('textAlign' in command.payload) {
|
2572
|
+
applyTextAlign(editor, command.payload.textAlign);
|
2573
|
+
}
|
2588
2574
|
}
|
2589
2575
|
});
|
2590
|
-
|
2591
2576
|
var _useDropTargetsActive = useDropTargetsActive(),
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2577
|
+
_useDropTargetsActive2 = _slicedToArray(_useDropTargetsActive, 2),
|
2578
|
+
dropTargetsActive = _useDropTargetsActive2[0],
|
2579
|
+
ref = _useDropTargetsActive2[1];
|
2596
2580
|
return /*#__PURE__*/React.createElement(Text$1, {
|
2597
|
-
scaleCategory: scaleCategory
|
2581
|
+
scaleCategory: scaleCategory,
|
2582
|
+
typographyVariant: typographyVariant,
|
2583
|
+
typographySize: typographySize
|
2598
2584
|
}, /*#__PURE__*/React.createElement("div", {
|
2599
|
-
className: classNames(styles$
|
2585
|
+
className: classNames(styles$a.container, _defineProperty({}, styles$a.selected, isSelected)),
|
2600
2586
|
ref: ref
|
2601
2587
|
}, /*#__PURE__*/React.createElement(Slate, {
|
2602
2588
|
editor: editor,
|
2603
2589
|
value: cachedValue,
|
2604
2590
|
onChange: setCachedValue
|
2605
2591
|
}, /*#__PURE__*/React.createElement(LinkTooltipProvider, {
|
2606
|
-
|
2592
|
+
disabled: editor.selection && !Range.isCollapsed(editor.selection),
|
2607
2593
|
position: floatingControlsPosition
|
2608
2594
|
}, selectionRect && /*#__PURE__*/React.createElement(Selection, {
|
2609
2595
|
contentElementId: contentElementId
|
2610
2596
|
}), dropTargetsActive && /*#__PURE__*/React.createElement(DropTargets$1, {
|
2611
2597
|
contentElementId: contentElementId
|
2612
|
-
}), /*#__PURE__*/React.createElement(HoveringToolbar, {
|
2613
|
-
position: floatingControlsPosition
|
2614
|
-
}), /*#__PURE__*/React.createElement(Editable, {
|
2598
|
+
}), /*#__PURE__*/React.createElement(HoveringToolbar, null, /*#__PURE__*/React.createElement(Editable, {
|
2615
2599
|
className: className,
|
2616
2600
|
decorate: decorateLineBreaks,
|
2617
|
-
onKeyDown:
|
2601
|
+
onKeyDown: handleKeyDown,
|
2618
2602
|
renderElement: renderElementWithLinkPreview,
|
2619
2603
|
renderLeaf: renderLeafWithLineBreakDecoration
|
2620
|
-
}))), /*#__PURE__*/React.createElement(TextPlaceholder, {
|
2604
|
+
})))), /*#__PURE__*/React.createElement(TextPlaceholder, {
|
2621
2605
|
text: placeholder,
|
2622
2606
|
className: placeholderClassName,
|
2623
2607
|
visible: isBlank(cachedValue)
|
2624
2608
|
})));
|
2625
2609
|
});
|
2626
|
-
|
2627
2610
|
function isBlank(value) {
|
2628
2611
|
var _value$, _value$2, _value$2$children$;
|
2629
|
-
|
2630
2612
|
return value.length <= 1 && ((_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.children.length) <= 1 && value[0].type === 'paragraph' && !((_value$2 = value[0]) === null || _value$2 === void 0 ? void 0 : (_value$2$children$ = _value$2.children[0]) === null || _value$2$children$ === void 0 ? void 0 : _value$2$children$.text);
|
2631
2613
|
}
|
2632
|
-
|
2633
2614
|
function resetSelectionIfOutsideNextValue(editor, nextValue) {
|
2634
2615
|
var nextEditor = {
|
2635
2616
|
children: nextValue
|
2636
2617
|
};
|
2637
|
-
|
2638
2618
|
if (editor.selection && (!hasTextAtPoint(nextEditor, editor.selection.anchor) || !hasTextAtPoint(nextEditor, editor.selection.focus))) {
|
2639
2619
|
Transforms.deselect(editor);
|
2640
2620
|
}
|
2641
2621
|
}
|
2642
|
-
|
2643
2622
|
function hasTextAtPoint(editor, point) {
|
2644
2623
|
if (!Node.has(editor, point.path)) {
|
2645
2624
|
return false;
|
2646
2625
|
}
|
2647
|
-
|
2648
2626
|
var node = Node.get(editor, point.path);
|
2649
2627
|
return Text.isText(node) && point.offset <= node.text.length;
|
2650
2628
|
}
|
2629
|
+
function resetHistory(editor) {
|
2630
|
+
editor.history.undos = [];
|
2631
|
+
editor.history.redos = [];
|
2632
|
+
}
|
2651
2633
|
|
2652
2634
|
function useLineBreakHandler$1(editor) {
|
2653
2635
|
return useCallback(function (event) {
|
2654
2636
|
if (event.key !== 'Enter') {
|
2655
2637
|
return true;
|
2656
|
-
}
|
2638
|
+
}
|
2639
|
+
|
2640
|
+
// Soft hyphens used to be inserted with Shift + Enter.
|
2657
2641
|
// Since Shift + Enter is now used for soft breaks in text blocks,
|
2658
2642
|
// we switched to Alt + Enter. Since all line breaks in
|
2659
2643
|
// EdtiableInlineText are soft, we also keep the old short cut
|
2660
|
-
|
2661
|
-
|
2662
2644
|
if (event.shiftKey === true || event.altKey === true) {
|
2663
2645
|
editor.insertText(shy);
|
2664
2646
|
} else {
|
2665
2647
|
editor.insertText('\n');
|
2666
2648
|
}
|
2667
|
-
|
2668
2649
|
return false;
|
2669
2650
|
}, [editor]);
|
2670
2651
|
}
|
@@ -2681,12 +2662,10 @@ function decorateLineBreaks$1(nodeEntry) {
|
|
2681
2662
|
}
|
2682
2663
|
function withLineBreakNormalization$1(editor) {
|
2683
2664
|
var normalizeNode = editor.normalizeNode;
|
2684
|
-
|
2685
2665
|
editor.normalizeNode = function (_ref) {
|
2686
2666
|
var _ref2 = _slicedToArray(_ref, 2),
|
2687
|
-
|
2688
|
-
|
2689
|
-
|
2667
|
+
node = _ref2[0],
|
2668
|
+
path = _ref2[1];
|
2690
2669
|
if (path.length === 0 && editor.children.length > 1) {
|
2691
2670
|
Transforms.mergeNodes(editor);
|
2692
2671
|
return;
|
@@ -2695,47 +2674,61 @@ function withLineBreakNormalization$1(editor) {
|
|
2695
2674
|
return;
|
2696
2675
|
}
|
2697
2676
|
}
|
2698
|
-
|
2699
2677
|
return normalizeNode([node, path]);
|
2700
2678
|
};
|
2701
|
-
|
2702
2679
|
return editor;
|
2703
2680
|
}
|
2704
2681
|
|
2705
|
-
|
2682
|
+
function useShortcutHandler$1(editor) {
|
2683
|
+
return useCallback(function (event) {
|
2684
|
+
if (!event.ctrlKey) {
|
2685
|
+
return;
|
2686
|
+
}
|
2687
|
+
if (event.key === 'z') {
|
2688
|
+
event.preventDefault();
|
2689
|
+
editor.undo();
|
2690
|
+
} else if (event.key === 'y') {
|
2691
|
+
event.preventDefault();
|
2692
|
+
editor.redo();
|
2693
|
+
}
|
2694
|
+
}, [editor]);
|
2695
|
+
}
|
2696
|
+
|
2697
|
+
var styles$c = {"shy":"index-module_shy__1E2-J","newLine":"index-module_newLine__1QnIs","selected":"index-module_selected__1U9ro","manualHyphens":"index-module_manualHyphens__16b2t"};
|
2706
2698
|
|
2707
2699
|
var EditableInlineText = memo(function EditableInlineText(_ref) {
|
2708
2700
|
var _cachedValue$, _cachedValue$$childre;
|
2709
|
-
|
2710
2701
|
var value = _ref.value,
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2702
|
+
_ref$defaultValue = _ref.defaultValue,
|
2703
|
+
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
2704
|
+
hyphens = _ref.hyphens,
|
2705
|
+
placeholder = _ref.placeholder,
|
2706
|
+
onChange = _ref.onChange;
|
2716
2707
|
var editor = useMemo(function () {
|
2717
|
-
return withLineBreakNormalization$1(withReact(createEditor()));
|
2708
|
+
return withLineBreakNormalization$1(withReact(withHistory(createEditor())));
|
2718
2709
|
}, []);
|
2719
2710
|
var handleLineBreaks = useLineBreakHandler$1(editor);
|
2720
|
-
|
2711
|
+
var handleShortcuts = useShortcutHandler$1(editor);
|
2712
|
+
var handleKeyDown = useCallback(function (event) {
|
2713
|
+
handleLineBreaks(event);
|
2714
|
+
handleShortcuts(event);
|
2715
|
+
}, [handleLineBreaks, handleShortcuts]);
|
2721
2716
|
var _useCachedValue = useCachedValue(value, {
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2717
|
+
defaultValue: [{
|
2718
|
+
type: 'heading',
|
2719
|
+
children: [{
|
2720
|
+
text: defaultValue
|
2721
|
+
}]
|
2722
|
+
}],
|
2723
|
+
onDebouncedChange: onChange
|
2724
|
+
}),
|
2725
|
+
_useCachedValue2 = _slicedToArray(_useCachedValue, 2),
|
2726
|
+
cachedValue = _useCachedValue2[0],
|
2727
|
+
setCachedValue = _useCachedValue2[1];
|
2734
2728
|
var _useContentElementEdi = useContentElementEditorState(),
|
2735
|
-
|
2736
|
-
|
2729
|
+
isSelected = _useContentElementEdi.isSelected;
|
2737
2730
|
return /*#__PURE__*/React.createElement("div", {
|
2738
|
-
className: classNames(frontendStyles.root, frontendStyles["hyphens-".concat(hyphens)], _defineProperty({}, styles$
|
2731
|
+
className: classNames(frontendStyles.root, frontendStyles["hyphens-".concat(hyphens)], _defineProperty({}, styles$c.manualHyphens, hyphens === 'manual'), _defineProperty({}, styles$c.selected, isSelected)),
|
2739
2732
|
spellCheck: "false"
|
2740
2733
|
}, /*#__PURE__*/React.createElement(Slate, {
|
2741
2734
|
editor: editor,
|
@@ -2743,58 +2736,738 @@ var EditableInlineText = memo(function EditableInlineText(_ref) {
|
|
2743
2736
|
onChange: setCachedValue
|
2744
2737
|
}, /*#__PURE__*/React.createElement(Editable, {
|
2745
2738
|
decorate: decorateLineBreaks$1,
|
2746
|
-
onKeyDown:
|
2739
|
+
onKeyDown: handleKeyDown,
|
2740
|
+
renderElement: function renderElement(props) {
|
2741
|
+
return /*#__PURE__*/React.createElement(Element, props);
|
2742
|
+
},
|
2747
2743
|
renderLeaf: renderLeaf
|
2748
2744
|
})), /*#__PURE__*/React.createElement(TextPlaceholder, {
|
2749
2745
|
text: placeholder,
|
2750
2746
|
visible: !((_cachedValue$ = cachedValue[0]) === null || _cachedValue$ === void 0 ? void 0 : (_cachedValue$$childre = _cachedValue$.children[0]) === null || _cachedValue$$childre === void 0 ? void 0 : _cachedValue$$childre.text)
|
2751
2747
|
}));
|
2752
2748
|
});
|
2753
|
-
|
2754
|
-
function renderLeaf(_ref2) {
|
2749
|
+
function Element(_ref2) {
|
2755
2750
|
var attributes = _ref2.attributes,
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2751
|
+
children = _ref2.children,
|
2752
|
+
element = _ref2.element;
|
2753
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({}, attributes, {
|
2754
|
+
style: {
|
2755
|
+
position: 'relative'
|
2756
|
+
}
|
2757
|
+
}), /*#__PURE__*/React.createElement("span", {
|
2758
|
+
className: frontendStyles.textEffects
|
2759
|
+
}, children));
|
2760
|
+
}
|
2761
|
+
function renderLeaf(_ref3) {
|
2762
|
+
var attributes = _ref3.attributes,
|
2763
|
+
children = _ref3.children,
|
2764
|
+
leaf = _ref3.leaf;
|
2759
2765
|
if (leaf.shy) {
|
2760
2766
|
children = /*#__PURE__*/React.createElement("span", {
|
2761
|
-
className: styles$
|
2767
|
+
className: styles$c.shy
|
2762
2768
|
}, children);
|
2763
2769
|
}
|
2764
|
-
|
2765
2770
|
if (leaf.newLine) {
|
2766
2771
|
children = /*#__PURE__*/React.createElement("span", {
|
2767
|
-
className: styles$
|
2772
|
+
className: styles$c.newLine
|
2768
2773
|
}, children);
|
2769
2774
|
}
|
2770
|
-
|
2771
2775
|
return /*#__PURE__*/React.createElement("span", attributes, children);
|
2772
2776
|
}
|
2773
2777
|
|
2774
|
-
var
|
2778
|
+
var Row = {
|
2779
|
+
match: function match(editor) {
|
2780
|
+
var _Editor$nodes = Editor.nodes(editor, {
|
2781
|
+
match: function match(n) {
|
2782
|
+
return n.type === 'row';
|
2783
|
+
}
|
2784
|
+
}),
|
2785
|
+
_Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
|
2786
|
+
rowMatch = _Editor$nodes2[0];
|
2787
|
+
return rowMatch;
|
2788
|
+
}
|
2789
|
+
};
|
2790
|
+
var Cell = {
|
2791
|
+
splitChildren: function splitChildren(editor, _ref) {
|
2792
|
+
var cellNode = _ref.cellNode,
|
2793
|
+
point = _ref.point;
|
2794
|
+
var _Editor$leaf = Editor.leaf(editor, point.path),
|
2795
|
+
_Editor$leaf2 = _slicedToArray(_Editor$leaf, 2),
|
2796
|
+
leafNode = _Editor$leaf2[0],
|
2797
|
+
leafPath = _Editor$leaf2[1];
|
2798
|
+
var cursorOffset = point.offset;
|
2799
|
+
var text = leafNode.text || '';
|
2800
|
+
var beforeText = text.slice(0, cursorOffset);
|
2801
|
+
var afterText = text.slice(cursorOffset);
|
2802
|
+
var splitIndex = leafPath[leafPath.length - 1];
|
2803
|
+
var beforeNodes = [];
|
2804
|
+
var afterNodes = [];
|
2805
|
+
cellNode.children.forEach(function (node, index) {
|
2806
|
+
if (index < splitIndex) {
|
2807
|
+
beforeNodes.push(node);
|
2808
|
+
} else if (index === splitIndex) {
|
2809
|
+
if (beforeText) {
|
2810
|
+
beforeNodes.push(_objectSpread2(_objectSpread2({}, node), {}, {
|
2811
|
+
text: beforeText
|
2812
|
+
}));
|
2813
|
+
}
|
2814
|
+
if (afterText) {
|
2815
|
+
afterNodes.push(_objectSpread2(_objectSpread2({}, node), {}, {
|
2816
|
+
text: afterText
|
2817
|
+
}));
|
2818
|
+
}
|
2819
|
+
} else {
|
2820
|
+
afterNodes.push(node);
|
2821
|
+
}
|
2822
|
+
});
|
2823
|
+
return [beforeNodes, afterNodes];
|
2824
|
+
},
|
2825
|
+
match: function match(editor) {
|
2826
|
+
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
2827
|
+
at = _ref2.at;
|
2828
|
+
var _Editor$nodes3 = Editor.nodes(editor, {
|
2829
|
+
match: function match(n) {
|
2830
|
+
return n.type === 'label' || n.type === 'value';
|
2831
|
+
},
|
2832
|
+
at: at
|
2833
|
+
}),
|
2834
|
+
_Editor$nodes4 = _slicedToArray(_Editor$nodes3, 1),
|
2835
|
+
cellMatch = _Editor$nodes4[0];
|
2836
|
+
return cellMatch;
|
2837
|
+
},
|
2838
|
+
inFirstLine: function inFirstLine(editor, point) {
|
2839
|
+
var _Editor$node = Editor.node(editor, point.path),
|
2840
|
+
_Editor$node2 = _slicedToArray(_Editor$node, 1),
|
2841
|
+
node = _Editor$node2[0];
|
2842
|
+
var text = Node.string(node);
|
2843
|
+
var firstLineBreak = text.indexOf('\n');
|
2844
|
+
return firstLineBreak === -1 || point.offset <= firstLineBreak;
|
2845
|
+
},
|
2846
|
+
inLastLine: function inLastLine(editor, point) {
|
2847
|
+
var _Editor$node3 = Editor.node(editor, point.path),
|
2848
|
+
_Editor$node4 = _slicedToArray(_Editor$node3, 1),
|
2849
|
+
node = _Editor$node4[0];
|
2850
|
+
var text = Node.string(node);
|
2851
|
+
var lastLineBreak = text.lastIndexOf('\n');
|
2852
|
+
return lastLineBreak === -1 || point.offset > lastLineBreak;
|
2853
|
+
},
|
2854
|
+
getPointAtStartOfLastLine: function getPointAtStartOfLastLine(editor, cellPath) {
|
2855
|
+
var _Editor$node5 = Editor.node(editor, cellPath),
|
2856
|
+
_Editor$node6 = _slicedToArray(_Editor$node5, 1),
|
2857
|
+
node = _Editor$node6[0];
|
2858
|
+
var text = Node.string(node);
|
2859
|
+
var lastLineBreak = text.lastIndexOf('\n');
|
2860
|
+
var offset = lastLineBreak === -1 ? 0 : lastLineBreak + 1;
|
2861
|
+
return {
|
2862
|
+
path: cellPath,
|
2863
|
+
offset: offset
|
2864
|
+
};
|
2865
|
+
}
|
2866
|
+
};
|
2867
|
+
var CellPath = {
|
2868
|
+
columnIndex: function columnIndex(path) {
|
2869
|
+
return path[path.length - 1];
|
2870
|
+
},
|
2871
|
+
rowIndex: function rowIndex(path) {
|
2872
|
+
return path[path.length - 2];
|
2873
|
+
}
|
2874
|
+
};
|
2775
2875
|
|
2776
|
-
|
2777
|
-
|
2876
|
+
var CellTransforms = {
|
2877
|
+
replaceContent: function replaceContent(editor, nodes, _ref) {
|
2878
|
+
var cellPath = _ref.cellPath;
|
2879
|
+
Transforms.insertText(editor, '', {
|
2880
|
+
at: cellPath
|
2881
|
+
});
|
2882
|
+
if (nodes.length > 0) {
|
2883
|
+
Transforms.insertNodes(editor, nodes, {
|
2884
|
+
at: [].concat(_toConsumableArray(cellPath), [0])
|
2885
|
+
});
|
2886
|
+
}
|
2887
|
+
},
|
2888
|
+
deleteContentUntil: function deleteContentUntil(editor, _ref2) {
|
2889
|
+
var cellPath = _ref2.cellPath,
|
2890
|
+
point = _ref2.point;
|
2891
|
+
if (!Editor.isStart(editor, point, cellPath)) {
|
2892
|
+
Transforms["delete"](editor, {
|
2893
|
+
at: {
|
2894
|
+
anchor: Editor.start(editor, cellPath),
|
2895
|
+
focus: point
|
2896
|
+
}
|
2897
|
+
});
|
2898
|
+
}
|
2899
|
+
},
|
2900
|
+
deleteContentFrom: function deleteContentFrom(editor, _ref3) {
|
2901
|
+
var cellPath = _ref3.cellPath,
|
2902
|
+
point = _ref3.point;
|
2903
|
+
if (!Editor.isEnd(editor, point, cellPath)) {
|
2904
|
+
Transforms["delete"](editor, {
|
2905
|
+
at: {
|
2906
|
+
anchor: point,
|
2907
|
+
focus: Editor.end(editor, cellPath)
|
2908
|
+
}
|
2909
|
+
});
|
2910
|
+
}
|
2911
|
+
}
|
2912
|
+
};
|
2913
|
+
|
2914
|
+
var TableTransforms = {
|
2915
|
+
deleteRange: function deleteRange(editor, _ref) {
|
2916
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
2917
|
+
startPoint = _ref2[0],
|
2918
|
+
endPoint = _ref2[1];
|
2919
|
+
var startCellMatch = Cell.match(editor, {
|
2920
|
+
at: startPoint.path
|
2921
|
+
});
|
2922
|
+
var endCellMatch = Cell.match(editor, {
|
2923
|
+
at: endPoint.path
|
2924
|
+
});
|
2925
|
+
if (startCellMatch && endCellMatch) {
|
2926
|
+
var _startCellMatch = _slicedToArray(startCellMatch, 2),
|
2927
|
+
startCellNode = _startCellMatch[0],
|
2928
|
+
startCellPath = _startCellMatch[1];
|
2929
|
+
var _endCellMatch = _slicedToArray(endCellMatch, 2),
|
2930
|
+
endCellNode = _endCellMatch[0],
|
2931
|
+
endCellPath = _endCellMatch[1];
|
2932
|
+
if (!Path.equals(startCellPath, endCellPath)) {
|
2933
|
+
var rewrittenCellPath = getRewrittenCellPath(editor, startCellPath, endCellPath);
|
2934
|
+
var rows = Array.from(Editor.nodes(editor, {
|
2935
|
+
match: function match(n) {
|
2936
|
+
return n.type === 'row';
|
2937
|
+
},
|
2938
|
+
at: {
|
2939
|
+
anchor: startPoint,
|
2940
|
+
focus: endPoint
|
2941
|
+
}
|
2942
|
+
}));
|
2943
|
+
CellTransforms.deleteContentFrom(editor, {
|
2944
|
+
cellPath: startCellPath,
|
2945
|
+
point: startPoint
|
2946
|
+
});
|
2947
|
+
if (rewrittenCellPath) {
|
2948
|
+
var _beforeNodes;
|
2949
|
+
var beforeNodes = CellPath.columnIndex(startCellPath) === CellPath.columnIndex(endCellPath) ? Cell.splitChildren(editor, {
|
2950
|
+
cellNode: startCellNode,
|
2951
|
+
point: startPoint
|
2952
|
+
})[0] : [];
|
2953
|
+
var _Cell$splitChildren = Cell.splitChildren(editor, {
|
2954
|
+
cellNode: endCellNode,
|
2955
|
+
point: endPoint
|
2956
|
+
}),
|
2957
|
+
_Cell$splitChildren2 = _slicedToArray(_Cell$splitChildren, 2),
|
2958
|
+
afterNodes = _Cell$splitChildren2[1];
|
2959
|
+
CellTransforms.replaceContent(editor, beforeNodes.concat(afterNodes), {
|
2960
|
+
cellPath: rewrittenCellPath
|
2961
|
+
});
|
2962
|
+
Transforms.select(editor, {
|
2963
|
+
path: [].concat(_toConsumableArray(rewrittenCellPath), [beforeNodes.length ? beforeNodes.length - 1 : 0]),
|
2964
|
+
offset: ((_beforeNodes = beforeNodes[beforeNodes.length - 1]) === null || _beforeNodes === void 0 ? void 0 : _beforeNodes.text.length) || 0
|
2965
|
+
});
|
2966
|
+
rows.reverse().forEach(function (_ref3) {
|
2967
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
2968
|
+
_ = _ref4[0],
|
2969
|
+
rowPath = _ref4[1];
|
2970
|
+
if (rowPath[rowPath.length - 1] !== CellPath.rowIndex(rewrittenCellPath)) {
|
2971
|
+
Transforms.removeNodes(editor, {
|
2972
|
+
at: rowPath
|
2973
|
+
});
|
2974
|
+
}
|
2975
|
+
});
|
2976
|
+
} else {
|
2977
|
+
CellTransforms.deleteContentUntil(editor, {
|
2978
|
+
cellPath: endCellPath,
|
2979
|
+
point: endPoint
|
2980
|
+
});
|
2981
|
+
rows.slice(1, -1).reverse().forEach(function (_ref5) {
|
2982
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
2983
|
+
_ = _ref6[0],
|
2984
|
+
rowPath = _ref6[1];
|
2985
|
+
Transforms.removeNodes(editor, {
|
2986
|
+
at: rowPath
|
2987
|
+
});
|
2988
|
+
});
|
2989
|
+
Transforms.select(editor, startPoint);
|
2990
|
+
}
|
2991
|
+
return;
|
2992
|
+
}
|
2993
|
+
}
|
2994
|
+
}
|
2995
|
+
};
|
2996
|
+
function getRewrittenCellPath(editor, startCellPath, endCellPath) {
|
2997
|
+
if (CellPath.columnIndex(startCellPath) < CellPath.columnIndex(endCellPath)) {
|
2998
|
+
var _Editor$next = Editor.next(editor, {
|
2999
|
+
at: startCellPath
|
3000
|
+
}),
|
3001
|
+
_Editor$next2 = _slicedToArray(_Editor$next, 2),
|
3002
|
+
rewrittenCellPath = _Editor$next2[1];
|
3003
|
+
return rewrittenCellPath;
|
3004
|
+
} else if (CellPath.columnIndex(startCellPath) > CellPath.columnIndex(endCellPath)) {
|
3005
|
+
return null;
|
3006
|
+
} else if (CellPath.columnIndex(startCellPath) === 0) {
|
3007
|
+
return endCellPath;
|
3008
|
+
} else {
|
3009
|
+
return startCellPath;
|
3010
|
+
}
|
3011
|
+
}
|
3012
|
+
|
3013
|
+
function withFixedColumns(editor) {
|
3014
|
+
var deleteBackward = editor.deleteBackward,
|
3015
|
+
deleteForward = editor.deleteForward,
|
3016
|
+
deleteFragment = editor.deleteFragment;
|
3017
|
+
editor.insertBreak = function () {
|
3018
|
+
var cellMatch = Cell.match(editor);
|
3019
|
+
if (!cellMatch) {
|
3020
|
+
return;
|
3021
|
+
}
|
3022
|
+
var _cellMatch = _slicedToArray(cellMatch, 2),
|
3023
|
+
cellNode = _cellMatch[0],
|
3024
|
+
cellPath = _cellMatch[1];
|
3025
|
+
var rowPath = Path.parent(cellPath);
|
3026
|
+
var columnIndex = CellPath.columnIndex(cellPath);
|
3027
|
+
var newRowPath = Path.next(rowPath);
|
3028
|
+
var _Cell$splitChildren = Cell.splitChildren(editor, {
|
3029
|
+
cellNode: cellNode,
|
3030
|
+
point: editor.selection.anchor
|
3031
|
+
}),
|
3032
|
+
_Cell$splitChildren2 = _slicedToArray(_Cell$splitChildren, 2),
|
3033
|
+
beforeNodes = _Cell$splitChildren2[0],
|
3034
|
+
afterNodes = _Cell$splitChildren2[1];
|
3035
|
+
if (columnIndex === 0) {
|
3036
|
+
CellTransforms.replaceContent(editor, afterNodes, {
|
3037
|
+
cellPath: cellPath
|
3038
|
+
});
|
3039
|
+
var newRow = {
|
3040
|
+
type: 'row',
|
3041
|
+
children: [{
|
3042
|
+
type: 'label',
|
3043
|
+
children: beforeNodes
|
3044
|
+
}, {
|
3045
|
+
type: 'value',
|
3046
|
+
children: [{
|
3047
|
+
text: ''
|
3048
|
+
}]
|
3049
|
+
}]
|
3050
|
+
};
|
3051
|
+
Transforms.insertNodes(editor, newRow, {
|
3052
|
+
at: rowPath
|
3053
|
+
});
|
3054
|
+
} else {
|
3055
|
+
CellTransforms.replaceContent(editor, beforeNodes, {
|
3056
|
+
cellPath: cellPath
|
3057
|
+
});
|
3058
|
+
var _newRow = {
|
3059
|
+
type: 'row',
|
3060
|
+
children: [{
|
3061
|
+
type: 'label',
|
3062
|
+
children: [{
|
3063
|
+
text: ''
|
3064
|
+
}]
|
3065
|
+
}, {
|
3066
|
+
type: 'value',
|
3067
|
+
children: afterNodes
|
3068
|
+
}]
|
3069
|
+
};
|
3070
|
+
Transforms.insertNodes(editor, _newRow, {
|
3071
|
+
at: newRowPath
|
3072
|
+
});
|
3073
|
+
}
|
3074
|
+
Transforms.select(editor, {
|
3075
|
+
path: [].concat(_toConsumableArray(newRowPath), [afterNodes.length ? columnIndex : 0, 0]),
|
3076
|
+
offset: 0
|
3077
|
+
});
|
3078
|
+
};
|
3079
|
+
editor.deleteBackward = function () {
|
3080
|
+
if (!editor.selection || !Range.isCollapsed(editor.selection)) {
|
3081
|
+
return;
|
3082
|
+
}
|
3083
|
+
var cellMatch = Cell.match(editor);
|
3084
|
+
if (!cellMatch) {
|
3085
|
+
return;
|
3086
|
+
}
|
3087
|
+
var _cellMatch2 = _slicedToArray(cellMatch, 2),
|
3088
|
+
cellPath = _cellMatch2[1];
|
3089
|
+
if (!Editor.isStart(editor, editor.selection.anchor, cellPath)) {
|
3090
|
+
deleteBackward.apply(this, arguments);
|
3091
|
+
return;
|
3092
|
+
}
|
3093
|
+
var _Editor$parent = Editor.parent(editor, cellPath),
|
3094
|
+
_Editor$parent2 = _slicedToArray(_Editor$parent, 2),
|
3095
|
+
row = _Editor$parent2[0],
|
3096
|
+
rowPath = _Editor$parent2[1];
|
3097
|
+
var previousRowMatch = Editor.previous(editor, {
|
3098
|
+
at: rowPath
|
3099
|
+
});
|
3100
|
+
if (CellPath.columnIndex(cellPath) === 0) {
|
3101
|
+
if (previousRowMatch) {
|
3102
|
+
var _previousRowMatch = _slicedToArray(previousRowMatch, 2),
|
3103
|
+
previousRow = _previousRowMatch[0],
|
3104
|
+
previousRowPath = _previousRowMatch[1];
|
3105
|
+
if (Node.string(previousRow) === '') {
|
3106
|
+
Transforms["delete"](editor, {
|
3107
|
+
at: previousRowPath
|
3108
|
+
});
|
3109
|
+
} else if (Node.string(row) === '') {
|
3110
|
+
Transforms["delete"](editor, {
|
3111
|
+
at: rowPath
|
3112
|
+
});
|
3113
|
+
} else if (Node.string(Node.child(previousRow, 1)) === '') {
|
3114
|
+
TableTransforms.deleteRange(editor, [Editor.end(editor, [].concat(_toConsumableArray(previousRowPath), [0])), editor.selection.anchor]);
|
3115
|
+
} else {
|
3116
|
+
Transforms.select(editor, Editor.end(editor, previousRowPath));
|
3117
|
+
}
|
3118
|
+
}
|
3119
|
+
} else {
|
3120
|
+
if (previousRowMatch) {
|
3121
|
+
var _previousRowMatch2 = _slicedToArray(previousRowMatch, 2),
|
3122
|
+
_previousRowPath = _previousRowMatch2[1];
|
3123
|
+
if (Node.string(Node.child(row, 0)) === '') {
|
3124
|
+
TableTransforms.deleteRange(editor, [Editor.end(editor, _previousRowPath), editor.selection.anchor]);
|
3125
|
+
return;
|
3126
|
+
}
|
3127
|
+
}
|
3128
|
+
Transforms.select(editor, Editor.end(editor, Path.previous(cellPath)));
|
3129
|
+
}
|
3130
|
+
};
|
3131
|
+
editor.deleteForward = function () {
|
3132
|
+
if (!editor.selection || !Range.isCollapsed(editor.selection)) {
|
3133
|
+
return;
|
3134
|
+
}
|
3135
|
+
var cellMatch = Cell.match(editor);
|
3136
|
+
if (!cellMatch) {
|
3137
|
+
return;
|
3138
|
+
}
|
3139
|
+
var _cellMatch3 = _slicedToArray(cellMatch, 2),
|
3140
|
+
cellPath = _cellMatch3[1];
|
3141
|
+
if (!Editor.isEnd(editor, editor.selection.anchor, cellPath)) {
|
3142
|
+
deleteForward();
|
3143
|
+
return;
|
3144
|
+
}
|
3145
|
+
var columnIndex = cellPath[cellPath.length - 1];
|
3146
|
+
var _Editor$parent3 = Editor.parent(editor, cellPath),
|
3147
|
+
_Editor$parent4 = _slicedToArray(_Editor$parent3, 2),
|
3148
|
+
row = _Editor$parent4[0],
|
3149
|
+
rowPath = _Editor$parent4[1];
|
3150
|
+
var nextRowMatch = Editor.next(editor, {
|
3151
|
+
at: rowPath
|
3152
|
+
});
|
3153
|
+
if (columnIndex === 0) {
|
3154
|
+
if (Node.string(row) === '') {
|
3155
|
+
var previousRowMatch = Editor.previous(editor, {
|
3156
|
+
at: rowPath
|
3157
|
+
});
|
3158
|
+
if (previousRowMatch || nextRowMatch) {
|
3159
|
+
Transforms["delete"](editor, {
|
3160
|
+
at: rowPath
|
3161
|
+
});
|
3162
|
+
if (Node.has(editor, rowPath)) {
|
3163
|
+
Transforms.select(editor, Editor.start(editor, rowPath));
|
3164
|
+
} else {
|
3165
|
+
var _previousRowMatch3 = _slicedToArray(previousRowMatch, 2),
|
3166
|
+
previousRowPath = _previousRowMatch3[1];
|
3167
|
+
Transforms.select(editor, Editor.start(editor, previousRowPath));
|
3168
|
+
}
|
3169
|
+
}
|
3170
|
+
} else {
|
3171
|
+
if (nextRowMatch) {
|
3172
|
+
var _nextRowMatch = _slicedToArray(nextRowMatch, 2),
|
3173
|
+
nextRowPath = _nextRowMatch[1];
|
3174
|
+
if (Node.string(Node.child(row, 1)) === '') {
|
3175
|
+
TableTransforms.deleteRange(editor, [editor.selection.anchor, Editor.start(editor, nextRowPath)]);
|
3176
|
+
return;
|
3177
|
+
}
|
3178
|
+
}
|
3179
|
+
Transforms.select(editor, Editor.start(editor, Path.next(cellPath)));
|
3180
|
+
}
|
3181
|
+
} else {
|
3182
|
+
if (nextRowMatch) {
|
3183
|
+
var _nextRowMatch2 = _slicedToArray(nextRowMatch, 2),
|
3184
|
+
nextRow = _nextRowMatch2[0],
|
3185
|
+
_nextRowPath = _nextRowMatch2[1];
|
3186
|
+
if (Node.string(nextRow) === '') {
|
3187
|
+
Transforms["delete"](editor, {
|
3188
|
+
at: _nextRowPath
|
3189
|
+
});
|
3190
|
+
} else if (Node.string(Node.child(nextRow, 0)) === '') {
|
3191
|
+
TableTransforms.deleteRange(editor, [editor.selection.anchor, Editor.start(editor, [].concat(_toConsumableArray(_nextRowPath), [1]))]);
|
3192
|
+
} else {
|
3193
|
+
Transforms.select(editor, Editor.start(editor, _nextRowPath));
|
3194
|
+
}
|
3195
|
+
}
|
3196
|
+
}
|
3197
|
+
};
|
3198
|
+
editor.deleteFragment = function () {
|
3199
|
+
if (editor.selection && Range.isExpanded(editor.selection)) {
|
3200
|
+
if (TableTransforms.deleteRange(editor, Range.edges(editor.selection))) {
|
3201
|
+
return;
|
3202
|
+
}
|
3203
|
+
}
|
3204
|
+
deleteFragment();
|
3205
|
+
};
|
3206
|
+
editor.insertData = function (data) {
|
3207
|
+
var fragment = data.getData('application/x-slate-fragment');
|
3208
|
+
if (fragment) {
|
3209
|
+
var decoded = decodeURIComponent(window.atob(fragment));
|
3210
|
+
var parsed = JSON.parse(decoded);
|
3211
|
+
if (parsed.every(function (element) {
|
3212
|
+
return element['type'] === 'row';
|
3213
|
+
})) {
|
3214
|
+
editor.insertFragment(parsed);
|
3215
|
+
return;
|
3216
|
+
}
|
3217
|
+
}
|
3218
|
+
var text = data.getData('text/plain');
|
3219
|
+
if (text) {
|
3220
|
+
editor.insertText(text);
|
3221
|
+
}
|
3222
|
+
};
|
3223
|
+
editor.insertFragment = function (fragment) {
|
3224
|
+
if (fragment.length === 1 && fragment[0].children.length === 1) {
|
3225
|
+
Transforms.insertFragment(editor, fragment[0].children[0].children);
|
3226
|
+
} else {
|
3227
|
+
var rowMatch = Row.match(editor);
|
3228
|
+
if (rowMatch) {
|
3229
|
+
ensureLabelAndValueCells(fragment);
|
3230
|
+
var _rowMatch = _slicedToArray(rowMatch, 2),
|
3231
|
+
rowPath = _rowMatch[1];
|
3232
|
+
var nextRowPath = Path.next(rowPath);
|
3233
|
+
var pathRef = Editor.pathRef(editor, nextRowPath);
|
3234
|
+
Transforms.insertNodes(editor, fragment, {
|
3235
|
+
at: nextRowPath
|
3236
|
+
});
|
3237
|
+
Transforms.select(editor, Editor.end(editor, Path.previous(pathRef.unref())));
|
3238
|
+
}
|
3239
|
+
}
|
3240
|
+
function ensureLabelAndValueCells(fragment) {
|
3241
|
+
if (fragment[0].children.length === 1) {
|
3242
|
+
fragment[0].children.unshift({
|
3243
|
+
type: 'label',
|
3244
|
+
children: [{
|
3245
|
+
text: ''
|
3246
|
+
}]
|
3247
|
+
});
|
3248
|
+
}
|
3249
|
+
if (fragment[fragment.length - 1].children.length === 1) {
|
3250
|
+
fragment[fragment.length - 1].children.push({
|
3251
|
+
type: 'value',
|
3252
|
+
children: [{
|
3253
|
+
text: ''
|
3254
|
+
}]
|
3255
|
+
});
|
3256
|
+
}
|
3257
|
+
}
|
3258
|
+
};
|
3259
|
+
return editor;
|
3260
|
+
}
|
3261
|
+
|
3262
|
+
function handleTableNavigation(editor, event, stacked) {
|
3263
|
+
if (stacked) {
|
3264
|
+
return;
|
3265
|
+
}
|
3266
|
+
var selection = editor.selection;
|
3267
|
+
if (selection && Range.isCollapsed(selection)) {
|
3268
|
+
var cellMatch = Cell.match(editor);
|
3269
|
+
if (cellMatch) {
|
3270
|
+
var _cellMatch = _slicedToArray(cellMatch, 2),
|
3271
|
+
cellPath = _cellMatch[1];
|
3272
|
+
var rowPath = cellPath.slice(0, -1);
|
3273
|
+
if (event.key === 'ArrowUp' && Cell.inFirstLine(editor, selection.anchor)) {
|
3274
|
+
event.preventDefault();
|
3275
|
+
if (rowPath[rowPath.length - 1] > 0) {
|
3276
|
+
var previousRowPath = Path.previous(rowPath);
|
3277
|
+
var targetPath = [].concat(_toConsumableArray(previousRowPath), [cellPath[cellPath.length - 1]]);
|
3278
|
+
Transforms.select(editor, Cell.getPointAtStartOfLastLine(editor, Editor.start(editor, targetPath).path));
|
3279
|
+
}
|
3280
|
+
} else if (event.key === 'ArrowDown' && Cell.inLastLine(editor, selection.anchor)) {
|
3281
|
+
event.preventDefault();
|
3282
|
+
var nextRowPath = Path.next(rowPath);
|
3283
|
+
var _targetPath = [].concat(_toConsumableArray(nextRowPath), [cellPath[cellPath.length - 1]]);
|
3284
|
+
if (Node.has(editor, _targetPath)) {
|
3285
|
+
Transforms.select(editor, Editor.start(editor, _targetPath));
|
3286
|
+
}
|
3287
|
+
}
|
3288
|
+
}
|
3289
|
+
}
|
3290
|
+
}
|
3291
|
+
|
3292
|
+
var styles$d = {"placeholder":"placeholders-module_placeholder__2j2eo"};
|
3293
|
+
|
3294
|
+
function createRenderElementWithPlaceholder(options) {
|
3295
|
+
var renderElement = createRenderElement(options);
|
3296
|
+
return function (_ref) {
|
3297
|
+
var attributes = _ref.attributes,
|
3298
|
+
children = _ref.children,
|
3299
|
+
element = _ref.element;
|
3300
|
+
if ((element.type === 'label' || element.type === 'value') && options.showPlaceholders && Node.string(element) === '') {
|
3301
|
+
children = /*#__PURE__*/React.createElement(React.Fragment, null, children, /*#__PURE__*/React.createElement("span", {
|
3302
|
+
contentEditable: false,
|
3303
|
+
className: styles$d.placeholder,
|
3304
|
+
"data-text": element.type === 'label' ? options.labelPlaceholder : options.valuePlaceholder
|
3305
|
+
}));
|
3306
|
+
}
|
3307
|
+
return renderElement({
|
3308
|
+
attributes: attributes,
|
3309
|
+
children: children,
|
3310
|
+
element: element
|
3311
|
+
});
|
3312
|
+
};
|
3313
|
+
}
|
3314
|
+
|
3315
|
+
var EditableTable = React.memo(function EditableTable(_ref) {
|
3316
|
+
var value = _ref.value,
|
3317
|
+
onChange = _ref.onChange,
|
3318
|
+
className = _ref.className,
|
3319
|
+
_ref$labelScaleCatego = _ref.labelScaleCategory,
|
3320
|
+
labelScaleCategory = _ref$labelScaleCatego === void 0 ? 'body' : _ref$labelScaleCatego,
|
3321
|
+
_ref$valueScaleCatego = _ref.valueScaleCategory,
|
3322
|
+
valueScaleCategory = _ref$valueScaleCatego === void 0 ? 'body' : _ref$valueScaleCatego,
|
3323
|
+
labelPlaceholder = _ref.labelPlaceholder,
|
3324
|
+
valuePlaceholder = _ref.valuePlaceholder,
|
3325
|
+
_ref$floatingControls = _ref.floatingControlsPosition,
|
3326
|
+
floatingControlsPosition = _ref$floatingControls === void 0 ? 'below' : _ref$floatingControls,
|
3327
|
+
_ref$stackedInPhoneLa = _ref.stackedInPhoneLayout,
|
3328
|
+
stackedInPhoneLayout = _ref$stackedInPhoneLa === void 0 ? false : _ref$stackedInPhoneLa;
|
3329
|
+
var editor = useMemo(function () {
|
3330
|
+
return withFixedColumns(withLinks(withLineBreakNormalization(withReact(withHistory(createEditor())))));
|
3331
|
+
}, []);
|
3332
|
+
var _useContentElementEdi = useContentElementEditorState(),
|
3333
|
+
isSelected = _useContentElementEdi.isSelected;
|
3334
|
+
var phoneLayout = usePhoneLayout();
|
3335
|
+
var stacked = stackedInPhoneLayout && phoneLayout;
|
3336
|
+
var handleLineBreaks = useLineBreakHandler(editor);
|
3337
|
+
var handleShortcuts = useShortcutHandler(editor);
|
3338
|
+
var handleKeyDown = useCallback(function (event) {
|
3339
|
+
handleLineBreaks(event);
|
3340
|
+
handleShortcuts(event);
|
3341
|
+
handleTableNavigation(editor, event, stacked);
|
3342
|
+
}, [editor, handleLineBreaks, handleShortcuts, stacked]);
|
3343
|
+
var _useCachedValue = useCachedValue(value, {
|
3344
|
+
defaultValue: [{
|
3345
|
+
type: 'row',
|
3346
|
+
children: [{
|
3347
|
+
type: 'label',
|
3348
|
+
children: [{
|
3349
|
+
text: ''
|
3350
|
+
}]
|
3351
|
+
}, {
|
3352
|
+
type: 'value',
|
3353
|
+
children: [{
|
3354
|
+
text: ''
|
3355
|
+
}]
|
3356
|
+
}]
|
3357
|
+
}],
|
3358
|
+
onDebouncedChange: onChange
|
3359
|
+
}),
|
3360
|
+
_useCachedValue2 = _slicedToArray(_useCachedValue, 2),
|
3361
|
+
cachedValue = _useCachedValue2[0],
|
3362
|
+
setCachedValue = _useCachedValue2[1];
|
3363
|
+
var showPlaceholders = cachedValue.length === 1;
|
3364
|
+
var renderElement = useMemo(function () {
|
3365
|
+
return wrapRenderElementWithLinkPreview(createRenderElementWithPlaceholder({
|
3366
|
+
labelScaleCategory: labelScaleCategory,
|
3367
|
+
valueScaleCategory: valueScaleCategory,
|
3368
|
+
labelPlaceholder: labelPlaceholder,
|
3369
|
+
valuePlaceholder: valuePlaceholder,
|
3370
|
+
showPlaceholders: showPlaceholders
|
3371
|
+
}));
|
3372
|
+
}, [labelScaleCategory, valueScaleCategory, labelPlaceholder, valuePlaceholder, showPlaceholders]);
|
3373
|
+
return /*#__PURE__*/React.createElement(Slate, {
|
3374
|
+
editor: editor,
|
3375
|
+
value: cachedValue,
|
3376
|
+
onChange: setCachedValue
|
3377
|
+
}, /*#__PURE__*/React.createElement(LinkTooltipProvider, {
|
3378
|
+
disabled: editor.selection && !Range.isCollapsed(editor.selection),
|
3379
|
+
position: floatingControlsPosition
|
3380
|
+
}, /*#__PURE__*/React.createElement(HoveringToolbar, {
|
3381
|
+
position: floatingControlsPosition
|
3382
|
+
}), /*#__PURE__*/React.createElement("table", {
|
3383
|
+
className: classNames(className, tableStyles.table, _defineProperty({}, selectedClassName, isSelected)),
|
3384
|
+
"data-stacked": stacked ? '' : undefined
|
3385
|
+
}, /*#__PURE__*/React.createElement(Editable, {
|
3386
|
+
as: "tbody",
|
3387
|
+
decorate: decorateLineBreaks,
|
3388
|
+
onKeyDown: handleKeyDown,
|
3389
|
+
renderElement: renderElement,
|
3390
|
+
renderLeaf: renderLeafWithLineBreakDecoration
|
3391
|
+
}))));
|
3392
|
+
});
|
3393
|
+
|
3394
|
+
var styles$e = {"reference":"ActionButtons-module_reference__27uyP","buttons":"ActionButtons-module_buttons__1Hz2Z","button":"ActionButtons-module_button__1wzIk","iconOnly":"ActionButtons-module_iconOnly__1VEGK","floating":"ActionButtons-module_floating__18Epj","escaped":"ActionButtons-module_escaped__2M1PU","size-lg":"ActionButtons-module_size-lg__2b0Dw","position-outside":"ActionButtons-module_position-outside__1rpXW","position-outsideLeft":"ActionButtons-module_position-outsideLeft__3bo3f","position-outsideIndented":"ActionButtons-module_position-outsideIndented__2LZds","position-inside":"ActionButtons-module_position-inside__IDFN8","position-center":"ActionButtons-module_position-center__1ff85"};
|
3395
|
+
|
3396
|
+
var _excluded$g = ["styles"];
|
3397
|
+
function _extends$g() {
|
3398
|
+
_extends$g = Object.assign ? Object.assign.bind() : function (target) {
|
2778
3399
|
for (var i = 1; i < arguments.length; i++) {
|
2779
3400
|
var source = arguments[i];
|
2780
|
-
|
2781
3401
|
for (var key in source) {
|
2782
3402
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
2783
3403
|
target[key] = source[key];
|
2784
3404
|
}
|
2785
3405
|
}
|
2786
3406
|
}
|
3407
|
+
return target;
|
3408
|
+
};
|
3409
|
+
return _extends$g.apply(this, arguments);
|
3410
|
+
}
|
3411
|
+
var background = (function (_ref) {
|
3412
|
+
var _ref$styles = _ref.styles,
|
3413
|
+
props = _objectWithoutProperties(_ref, _excluded$g);
|
3414
|
+
return /*#__PURE__*/React.createElement("svg", _extends$g({
|
3415
|
+
xmlns: "http://www.w3.org/2000/svg",
|
3416
|
+
viewBox: "0 0 448 512"
|
3417
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
3418
|
+
d: "M64 32C28.7 32 0 60.7 0 96v200c0 35.3 28.7 64 64 64h208c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64z"
|
3419
|
+
}), /*#__PURE__*/React.createElement("path", {
|
3420
|
+
d: "M363.494 144v48H384c8.8 0 16 7.2 16 16v200c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16v-21.16h-48V408c0 35.3 28.7 64 64 64h208c35.3 0 64-28.7 64-64V208c0-35.3-28.7-64-64-64z"
|
3421
|
+
}));
|
3422
|
+
});
|
2787
3423
|
|
3424
|
+
var _excluded$h = ["styles"];
|
3425
|
+
function _extends$h() {
|
3426
|
+
_extends$h = Object.assign ? Object.assign.bind() : function (target) {
|
3427
|
+
for (var i = 1; i < arguments.length; i++) {
|
3428
|
+
var source = arguments[i];
|
3429
|
+
for (var key in source) {
|
3430
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
3431
|
+
target[key] = source[key];
|
3432
|
+
}
|
3433
|
+
}
|
3434
|
+
}
|
2788
3435
|
return target;
|
2789
3436
|
};
|
3437
|
+
return _extends$h.apply(this, arguments);
|
3438
|
+
}
|
3439
|
+
var foreground = (function (_ref) {
|
3440
|
+
var _ref$styles = _ref.styles,
|
3441
|
+
props = _objectWithoutProperties(_ref, _excluded$h);
|
3442
|
+
return /*#__PURE__*/React.createElement("svg", _extends$h({
|
3443
|
+
xmlns: "http://www.w3.org/2000/svg",
|
3444
|
+
viewBox: "0 0 448 512"
|
3445
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
3446
|
+
d: "M363.494 148v168.365c0 41.077-33.397 74.475-74.474 74.475H112V412c0 35.3 28.7 64 64 64h208c35.3 0 64-28.7 64-64V212c0-35.3-28.7-64-64-64z"
|
3447
|
+
}), /*#__PURE__*/React.createElement("path", {
|
3448
|
+
d: "M272 84c8.8 0 16 7.2 16 16v200c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V100c0-8.8 7.2-16 16-16zM64 36C28.7 36 0 64.7 0 100v200c0 35.3 28.7 64 64 64h208c35.3 0 64-28.7 64-64V100c0-35.3-28.7-64-64-64z"
|
3449
|
+
}));
|
3450
|
+
});
|
2790
3451
|
|
2791
|
-
|
3452
|
+
var _excluded$i = ["styles"];
|
3453
|
+
function _extends$i() {
|
3454
|
+
_extends$i = Object.assign ? Object.assign.bind() : function (target) {
|
3455
|
+
for (var i = 1; i < arguments.length; i++) {
|
3456
|
+
var source = arguments[i];
|
3457
|
+
for (var key in source) {
|
3458
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
3459
|
+
target[key] = source[key];
|
3460
|
+
}
|
3461
|
+
}
|
3462
|
+
}
|
3463
|
+
return target;
|
3464
|
+
};
|
3465
|
+
return _extends$i.apply(this, arguments);
|
2792
3466
|
}
|
2793
3467
|
var pencil = (function (_ref) {
|
2794
3468
|
var _ref$styles = _ref.styles,
|
2795
|
-
|
2796
|
-
|
2797
|
-
return /*#__PURE__*/React.createElement("svg", _extends$e({
|
3469
|
+
props = _objectWithoutProperties(_ref, _excluded$i);
|
3470
|
+
return /*#__PURE__*/React.createElement("svg", _extends$i({
|
2798
3471
|
xmlns: "http://www.w3.org/2000/svg",
|
2799
3472
|
viewBox: "0 0 512 512"
|
2800
3473
|
}, props), /*#__PURE__*/React.createElement("path", {
|
@@ -2802,35 +3475,235 @@ var pencil = (function (_ref) {
|
|
2802
3475
|
}));
|
2803
3476
|
});
|
2804
3477
|
|
3478
|
+
var _excluded$j = ["styles"];
|
3479
|
+
function _extends$j() {
|
3480
|
+
_extends$j = Object.assign ? Object.assign.bind() : function (target) {
|
3481
|
+
for (var i = 1; i < arguments.length; i++) {
|
3482
|
+
var source = arguments[i];
|
3483
|
+
for (var key in source) {
|
3484
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
3485
|
+
target[key] = source[key];
|
3486
|
+
}
|
3487
|
+
}
|
3488
|
+
}
|
3489
|
+
return target;
|
3490
|
+
};
|
3491
|
+
return _extends$j.apply(this, arguments);
|
3492
|
+
}
|
3493
|
+
var unlink = (function (_ref) {
|
3494
|
+
var _ref$styles = _ref.styles,
|
3495
|
+
props = _objectWithoutProperties(_ref, _excluded$j);
|
3496
|
+
return /*#__PURE__*/React.createElement("svg", _extends$j({
|
3497
|
+
xmlns: "http://www.w3.org/2000/svg",
|
3498
|
+
viewBox: "0 0 512 512",
|
3499
|
+
"aria-hidden": "true"
|
3500
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
3501
|
+
d: "M360 0c-39-.001-78 14.8-107 44.4L185 112l-1 1 57 56s1 0 1-1l67-67c28-28.2 74-28.1 102 1 28 28 27 73-1 101l-13 14c-4 4-6 10-4 16 6 17 9 35 10 53 1 14 18 20 27 11l38-38c59-59 59-155 0-214.6C438 14.8 399 .001 360 0zm-63 165c-4 0-8 2-11 5l-22 21v1l107 107c2-41-13-82-44-114a152 152 0 00-21-17c-3-2-6-3-9-3zM93.3 211c-4.1 0-8.4 1-11.7 4l-37.1 38c-59.3 59-59.3 155 0 215C104 527 200 527 259 468l68-68v-1l-56-56s-1 0-1 1l-67 67c-28 28-74 28-102-1-28.2-28-27.4-73 1-101l13-14c4-4 6-10 4-16-6-17-10-35-10-53 0-9-8-15-15.7-15zm47.7 2c-2 41 13 82 44 114a152 152 0 0021 17c6 4 15 4 20-2l22-21v-1L141 213z"
|
3502
|
+
}), /*#__PURE__*/React.createElement("path", {
|
3503
|
+
stroke: "#000",
|
3504
|
+
strokeWidth: "68.787",
|
3505
|
+
strokeLinecap: "round",
|
3506
|
+
d: "M64 64l384 384"
|
3507
|
+
}));
|
3508
|
+
});
|
3509
|
+
|
2805
3510
|
var icons = {
|
2806
|
-
|
3511
|
+
background: background,
|
3512
|
+
foreground: foreground,
|
3513
|
+
link: link,
|
3514
|
+
pencil: pencil,
|
3515
|
+
unlink: unlink
|
2807
3516
|
};
|
3517
|
+
function ActionButtons(_ref) {
|
3518
|
+
var _middlewareData$hide;
|
3519
|
+
var buttons = _ref.buttons,
|
3520
|
+
position = _ref.position,
|
3521
|
+
portal = _ref.portal,
|
3522
|
+
_ref$size = _ref.size,
|
3523
|
+
size = _ref$size === void 0 ? 'md' : _ref$size;
|
3524
|
+
var iconSize = size === 'md' ? 15 : 20;
|
3525
|
+
var _useFloating = useFloating({
|
3526
|
+
placement: position === 'center' ? 'bottom' : position === 'inside' ? 'top-end' : position === 'outsideLeft' ? 'bottom-start' : 'bottom-end',
|
3527
|
+
middleware: portal && [hide({
|
3528
|
+
strategy: 'escaped'
|
3529
|
+
}), shift({
|
3530
|
+
elementContext: 'reference'
|
3531
|
+
})],
|
3532
|
+
whileElementsMounted: autoUpdate
|
3533
|
+
}),
|
3534
|
+
refs = _useFloating.refs,
|
3535
|
+
floatingStyles = _useFloating.floatingStyles,
|
3536
|
+
middlewareData = _useFloating.middlewareData;
|
3537
|
+
return /*#__PURE__*/React.createElement("span", {
|
3538
|
+
className: classNames(styles$e.reference, styles$e["position-".concat(position)]),
|
3539
|
+
ref: refs.setReference
|
3540
|
+
}, /*#__PURE__*/React.createElement(Portal, {
|
3541
|
+
enabled: portal
|
3542
|
+
}, /*#__PURE__*/React.createElement("div", {
|
3543
|
+
ref: refs.setFloating,
|
3544
|
+
className: classNames(styles$e.floating, _defineProperty({}, styles$e.escaped, (_middlewareData$hide = middlewareData.hide) === null || _middlewareData$hide === void 0 ? void 0 : _middlewareData$hide.escaped)),
|
3545
|
+
style: floatingStyles
|
3546
|
+
}, /*#__PURE__*/React.createElement("div", {
|
3547
|
+
className: styles$e.buttons
|
3548
|
+
}, buttons.map(function (_ref2, index) {
|
3549
|
+
var icon = _ref2.icon,
|
3550
|
+
text = _ref2.text,
|
3551
|
+
onClick = _ref2.onClick,
|
3552
|
+
iconOnly = _ref2.iconOnly;
|
3553
|
+
var Icon = icons[icon];
|
3554
|
+
return /*#__PURE__*/React.createElement("button", {
|
3555
|
+
key: index,
|
3556
|
+
className: classNames(styles$e.button, styles$e["size-".concat(size)], _defineProperty({}, styles$e.iconOnly, iconOnly)),
|
3557
|
+
onClick: onClick,
|
3558
|
+
title: iconOnly ? text : undefined,
|
3559
|
+
"aria-label": iconOnly ? text : undefined
|
3560
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
3561
|
+
width: iconSize,
|
3562
|
+
height: iconSize
|
3563
|
+
}), !iconOnly && text);
|
3564
|
+
})))));
|
3565
|
+
}
|
3566
|
+
function Portal(_ref3) {
|
3567
|
+
var enabled = _ref3.enabled,
|
3568
|
+
children = _ref3.children;
|
3569
|
+
var floatingPortalRoot = useFloatingPortalRoot();
|
3570
|
+
if (enabled) {
|
3571
|
+
return /*#__PURE__*/React.createElement(FloatingPortal, {
|
3572
|
+
root: floatingPortalRoot
|
3573
|
+
}, children);
|
3574
|
+
} else {
|
3575
|
+
return children;
|
3576
|
+
}
|
3577
|
+
}
|
3578
|
+
|
3579
|
+
var styles$f = {"wrapper":"EditableLink-module_wrapper__2sbJy"};
|
3580
|
+
|
3581
|
+
function EditableLink(_ref) {
|
3582
|
+
var className = _ref.className,
|
3583
|
+
href = _ref.href,
|
3584
|
+
openInNewTab = _ref.openInNewTab,
|
3585
|
+
children = _ref.children,
|
3586
|
+
onChange = _ref.onChange,
|
3587
|
+
linkPreviewDisabled = _ref.linkPreviewDisabled,
|
3588
|
+
_ref$linkPreviewPosit = _ref.linkPreviewPosition,
|
3589
|
+
linkPreviewPosition = _ref$linkPreviewPosit === void 0 ? 'below' : _ref$linkPreviewPosit,
|
3590
|
+
_ref$linkPreviewAlign = _ref.linkPreviewAlign,
|
3591
|
+
linkPreviewAlign = _ref$linkPreviewAlign === void 0 ? 'center' : _ref$linkPreviewAlign,
|
3592
|
+
_ref$actionButtonPosi = _ref.actionButtonPosition,
|
3593
|
+
actionButtonPosition = _ref$actionButtonPosi === void 0 ? 'outside' : _ref$actionButtonPosi,
|
3594
|
+
_ref$actionButtonVisi = _ref.actionButtonVisible,
|
3595
|
+
actionButtonVisible = _ref$actionButtonVisi === void 0 ? 'whenSelected' : _ref$actionButtonVisi,
|
3596
|
+
actionButtonPortal = _ref.actionButtonPortal,
|
3597
|
+
_ref$allowRemove = _ref.allowRemove,
|
3598
|
+
allowRemove = _ref$allowRemove === void 0 ? false : _ref$allowRemove;
|
3599
|
+
var selectLinkDestination = useSelectLinkDestination();
|
3600
|
+
var _useI18n = useI18n({
|
3601
|
+
locale: 'ui'
|
3602
|
+
}),
|
3603
|
+
t = _useI18n.t;
|
3604
|
+
var _useContentElementEdi = useContentElementEditorState(),
|
3605
|
+
isSelected = _useContentElementEdi.isSelected;
|
3606
|
+
if (actionButtonVisible === 'whenSelected') {
|
3607
|
+
actionButtonVisible = isSelected;
|
3608
|
+
}
|
3609
|
+
function handleSelectLinkDestination() {
|
3610
|
+
selectLinkDestination().then(onChange, function () {});
|
3611
|
+
}
|
3612
|
+
function handleRemoveLink() {
|
3613
|
+
onChange(null);
|
3614
|
+
}
|
3615
|
+
return /*#__PURE__*/React.createElement("div", {
|
3616
|
+
className: styles$f.wrapper
|
3617
|
+
}, /*#__PURE__*/React.createElement(LinkTooltipProvider, {
|
3618
|
+
disabled: linkPreviewDisabled,
|
3619
|
+
position: linkPreviewPosition,
|
3620
|
+
align: linkPreviewAlign,
|
3621
|
+
gap: 5
|
3622
|
+
}, /*#__PURE__*/React.createElement(LinkPreview, {
|
3623
|
+
href: href,
|
3624
|
+
openInNewTab: openInNewTab,
|
3625
|
+
className: className
|
3626
|
+
}, children)), actionButtonVisible && /*#__PURE__*/React.createElement(ActionButtons, {
|
3627
|
+
buttons: [{
|
3628
|
+
icon: 'link',
|
3629
|
+
text: href ? t('pageflow_scrolled.inline_editing.change_link_destination') : t('pageflow_scrolled.inline_editing.select_link_destination'),
|
3630
|
+
onClick: handleSelectLinkDestination
|
3631
|
+
}].concat(_toConsumableArray(allowRemove && href ? [{
|
3632
|
+
icon: 'unlink',
|
3633
|
+
iconOnly: true,
|
3634
|
+
text: t('pageflow_scrolled.inline_editing.remove_link'),
|
3635
|
+
onClick: handleRemoveLink
|
3636
|
+
}] : [])),
|
3637
|
+
position: actionButtonPosition,
|
3638
|
+
portal: actionButtonPortal
|
3639
|
+
}));
|
3640
|
+
}
|
3641
|
+
|
3642
|
+
var WidgetEditorStateContext = createContext();
|
3643
|
+
function useWidgetEditorState() {
|
3644
|
+
return useContext(WidgetEditorStateContext);
|
3645
|
+
}
|
3646
|
+
function SelectableWidgetDecorator(_ref) {
|
3647
|
+
var role = _ref.role,
|
3648
|
+
props = _ref.props,
|
3649
|
+
children = _ref.children;
|
3650
|
+
var _useEditorSelection = useEditorSelection(useMemo(function () {
|
3651
|
+
return {
|
3652
|
+
id: role,
|
3653
|
+
type: 'widget'
|
3654
|
+
};
|
3655
|
+
}, [role])),
|
3656
|
+
isSelected = _useEditorSelection.isSelected,
|
3657
|
+
select = _useEditorSelection.select;
|
3658
|
+
var value = useMemo(function () {
|
3659
|
+
return {
|
3660
|
+
isSelected: isSelected,
|
3661
|
+
select: select
|
3662
|
+
};
|
3663
|
+
}, [isSelected, select]);
|
3664
|
+
return /*#__PURE__*/React.createElement(WidgetEditorStateContext.Provider, {
|
3665
|
+
value: value
|
3666
|
+
}, children);
|
3667
|
+
}
|
3668
|
+
|
3669
|
+
function WidgetSelectionRect(_ref) {
|
3670
|
+
var children = _ref.children;
|
3671
|
+
var _useWidgetEditorState = useWidgetEditorState(),
|
3672
|
+
select = _useWidgetEditorState.select,
|
3673
|
+
isSelected = _useWidgetEditorState.isSelected;
|
3674
|
+
return /*#__PURE__*/React.createElement("div", {
|
3675
|
+
className: classNames(styles$3.wrapper, _defineProperty({}, styles$3.selected, isSelected)),
|
3676
|
+
onClick: function onClick() {
|
3677
|
+
return select();
|
3678
|
+
}
|
3679
|
+
}, children);
|
3680
|
+
}
|
3681
|
+
|
3682
|
+
var _excluded$k = ["icon", "text", "onClick", "iconOnly"];
|
2808
3683
|
function ActionButton(_ref) {
|
2809
3684
|
var icon = _ref.icon,
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2814
|
-
return /*#__PURE__*/React.createElement(
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
3685
|
+
text = _ref.text,
|
3686
|
+
onClick = _ref.onClick,
|
3687
|
+
iconOnly = _ref.iconOnly,
|
3688
|
+
rest = _objectWithoutProperties(_ref, _excluded$k);
|
3689
|
+
return /*#__PURE__*/React.createElement(ActionButtons, Object.assign({}, rest, {
|
3690
|
+
buttons: [{
|
3691
|
+
icon: icon,
|
3692
|
+
text: text,
|
3693
|
+
onClick: onClick,
|
3694
|
+
iconOnly: iconOnly
|
3695
|
+
}]
|
3696
|
+
}));
|
2821
3697
|
}
|
2822
3698
|
|
2823
3699
|
function PhonePlatformProvider(_ref) {
|
2824
3700
|
var children = _ref.children;
|
2825
|
-
|
2826
3701
|
var _useState = useState(false),
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
3702
|
+
_useState2 = _slicedToArray(_useState, 2),
|
3703
|
+
phoneEmulationMode = _useState2[0],
|
3704
|
+
setPhoneEmulationMode = _useState2[1];
|
2831
3705
|
useEffect(function () {
|
2832
3706
|
window.addEventListener('message', receive);
|
2833
|
-
|
2834
3707
|
function receive(event) {
|
2835
3708
|
if (event.data.type === 'CHANGE_EMULATION_MODE') {
|
2836
3709
|
if (event.data['payload'] === 'phone') {
|
@@ -2840,7 +3713,6 @@ function PhonePlatformProvider(_ref) {
|
|
2840
3713
|
}
|
2841
3714
|
}
|
2842
3715
|
}
|
2843
|
-
|
2844
3716
|
return function () {
|
2845
3717
|
return window.removeEventListener('message', receive);
|
2846
3718
|
};
|
@@ -2850,4 +3722,82 @@ function PhonePlatformProvider(_ref) {
|
|
2850
3722
|
}, children);
|
2851
3723
|
}
|
2852
3724
|
|
2853
|
-
|
3725
|
+
function BackdropDecorator(_ref) {
|
3726
|
+
var _backdrop$contentElem, _backdrop$contentElem2;
|
3727
|
+
var backdrop = _ref.backdrop,
|
3728
|
+
motifAreaState = _ref.motifAreaState,
|
3729
|
+
children = _ref.children;
|
3730
|
+
var _useI18n = useI18n({
|
3731
|
+
locale: 'ui'
|
3732
|
+
}),
|
3733
|
+
t = _useI18n.t;
|
3734
|
+
var _useEditorSelection = useEditorSelection({
|
3735
|
+
id: (_backdrop$contentElem = backdrop.contentElement) === null || _backdrop$contentElem === void 0 ? void 0 : _backdrop$contentElem.sectionId,
|
3736
|
+
type: 'sectionSettings'
|
3737
|
+
}),
|
3738
|
+
isSectionSelected = _useEditorSelection.isSelected,
|
3739
|
+
selectSection = _useEditorSelection.select;
|
3740
|
+
var _useEditorSelection2 = useEditorSelection({
|
3741
|
+
id: (_backdrop$contentElem2 = backdrop.contentElement) === null || _backdrop$contentElem2 === void 0 ? void 0 : _backdrop$contentElem2.id,
|
3742
|
+
type: 'contentElement'
|
3743
|
+
}),
|
3744
|
+
isBackdropElementSelected = _useEditorSelection2.isSelected,
|
3745
|
+
selectBackdropElement = _useEditorSelection2.select;
|
3746
|
+
var scrollToTarget = useScrollToTarget();
|
3747
|
+
var text, icon, handleClick;
|
3748
|
+
if (isBackdropElementSelected) {
|
3749
|
+
text = t('pageflow_scrolled.inline_editing.back_to_section');
|
3750
|
+
icon = 'foreground';
|
3751
|
+
handleClick = function handleClick() {
|
3752
|
+
return selectSection();
|
3753
|
+
};
|
3754
|
+
} else if (backdrop.contentElement) {
|
3755
|
+
text = t('pageflow_scrolled.inline_editing.select_backdrop_content_element');
|
3756
|
+
icon = 'background';
|
3757
|
+
handleClick = function handleClick() {
|
3758
|
+
scrollToTarget({
|
3759
|
+
id: backdrop.contentElement.sectionId,
|
3760
|
+
align: 'start'
|
3761
|
+
});
|
3762
|
+
selectBackdropElement();
|
3763
|
+
};
|
3764
|
+
} else {
|
3765
|
+
return children;
|
3766
|
+
}
|
3767
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
3768
|
+
className: classNames(styles$1.wrapper, _defineProperty({}, styles$1.visible, isBackdropElementSelected || isSectionSelected)),
|
3769
|
+
style: {
|
3770
|
+
height: motifAreaState.paddingTop
|
3771
|
+
}
|
3772
|
+
}, /*#__PURE__*/React.createElement("div", {
|
3773
|
+
className: styles$1.inner
|
3774
|
+
}, /*#__PURE__*/React.createElement(ActionButton, {
|
3775
|
+
size: "lg",
|
3776
|
+
position: "center",
|
3777
|
+
icon: icon,
|
3778
|
+
text: text,
|
3779
|
+
onClick: handleClick
|
3780
|
+
}))), children);
|
3781
|
+
}
|
3782
|
+
|
3783
|
+
function BackgroundContentElementDecorator(_ref) {
|
3784
|
+
var contentElement = _ref.contentElement,
|
3785
|
+
children = _ref.children;
|
3786
|
+
var _useEditorSelection = useEditorSelection({
|
3787
|
+
id: contentElement === null || contentElement === void 0 ? void 0 : contentElement.id,
|
3788
|
+
type: 'contentElement'
|
3789
|
+
}),
|
3790
|
+
isSelected = _useEditorSelection.isSelected;
|
3791
|
+
var _useEditorSelection2 = useEditorSelection({
|
3792
|
+
id: contentElement === null || contentElement === void 0 ? void 0 : contentElement.sectionId,
|
3793
|
+
type: 'sectionSettings'
|
3794
|
+
}),
|
3795
|
+
isSectionSelected = _useEditorSelection2.isSelected;
|
3796
|
+
return /*#__PURE__*/React.createElement("div", {
|
3797
|
+
style: {
|
3798
|
+
pointerEvents: isSelected || isSectionSelected ? 'auto' : 'none'
|
3799
|
+
}
|
3800
|
+
}, children);
|
3801
|
+
}
|
3802
|
+
|
3803
|
+
export { ActionButton, ActionButtons, BackdropDecorator, BackgroundContentElementDecorator, ContentDecorator, ContentElementDecorator, EditableInlineText, EditableLink, EditableTable, EditableText, EntryDecorator, LayoutWithPlaceholder, LinkTooltipProvider, PhonePlatformProvider, SectionDecorator, SelectableWidgetDecorator, WidgetSelectionRect };
|