pageflow 16.0.0 → 16.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +210 -33
  3. data/README.md +0 -1
  4. data/Rakefile +1 -1
  5. data/admins/pageflow/entry.rb +0 -1
  6. data/admins/pageflow/sites.rb +3 -0
  7. data/app/assets/javascripts/pageflow/dist/ui.js +298 -72
  8. data/app/assets/stylesheets/pageflow/admin/permalink_input.scss +10 -0
  9. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +6 -1
  10. data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -0
  11. data/app/assets/stylesheets/pageflow/editor/help.scss +3 -3
  12. data/app/assets/stylesheets/pageflow/editor/info_box.scss +7 -0
  13. data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +0 -5
  14. data/app/assets/stylesheets/pageflow/ui/forms.scss +1 -1
  15. data/app/controllers/pageflow/chapters_controller.rb +2 -2
  16. data/app/controllers/pageflow/editor/files_controller.rb +1 -1
  17. data/app/controllers/pageflow/entries_controller.rb +10 -0
  18. data/app/controllers/pageflow/feeds_controller.rb +18 -0
  19. data/app/controllers/pageflow/pages_controller.rb +2 -2
  20. data/app/controllers/pageflow/sitemaps_controller.rb +15 -0
  21. data/app/controllers/pageflow/storylines_controller.rb +2 -2
  22. data/app/helpers/pageflow/entries_helper.rb +2 -1
  23. data/app/helpers/pageflow/feeds_helper.rb +66 -0
  24. data/app/helpers/pageflow/page_types_helper.rb +9 -9
  25. data/app/inputs/pageflow_permalink_input.rb +15 -3
  26. data/app/models/concerns/pageflow/reusable_file.rb +3 -3
  27. data/app/models/pageflow/account.rb +8 -0
  28. data/app/models/pageflow/audio_file_url_templates.rb +2 -1
  29. data/app/models/pageflow/draft_entry.rb +1 -1
  30. data/app/models/pageflow/entries_feed.rb +32 -0
  31. data/app/models/pageflow/image_file.rb +14 -3
  32. data/app/models/pageflow/membership.rb +3 -2
  33. data/app/models/pageflow/other_file.rb +5 -0
  34. data/app/models/pageflow/other_file_url_templates.rb +16 -0
  35. data/app/models/pageflow/published_entry.rb +6 -0
  36. data/app/models/pageflow/revision.rb +4 -0
  37. data/app/models/pageflow/site.rb +8 -0
  38. data/app/models/pageflow/sitemaps.rb +13 -0
  39. data/app/models/pageflow/used_file.rb +2 -2
  40. data/app/models/pageflow/video_file_url_templates.rb +3 -1
  41. data/app/models/pageflow/widget.rb +9 -1
  42. data/app/views/admin/entries/_permalink_inputs.html.erb +1 -2
  43. data/app/views/admin/sites/_attributes_table.html.arb +3 -0
  44. data/app/views/admin/sites/_fields.html.erb +6 -0
  45. data/app/views/components/pageflow/admin/extensible_attributes_table.rb +8 -2
  46. data/app/views/components/pageflow/admin/sites_tab.rb +3 -0
  47. data/app/views/pageflow/editor/config/_seeds.json.jbuilder +1 -0
  48. data/app/views/pageflow/feeds/index.atom.builder +20 -0
  49. data/app/views/pageflow/sitemaps/index.xml.builder +9 -0
  50. data/config/initializers/features.rb +1 -0
  51. data/config/initializers/paperclip.rb +4 -0
  52. data/config/locales/de.yml +27 -6
  53. data/config/locales/en.yml +30 -4
  54. data/config/routes.rb +3 -0
  55. data/config/spring.rb +1 -1
  56. data/db/migrate/20230120092923_create_other_files.rb +23 -0
  57. data/db/migrate/20230323115745_add_feeds_enabled_to_sites.rb +5 -0
  58. data/db/migrate/20230323154323_add_sitemap_enabled_to_sites.rb +5 -0
  59. data/db/migrate/20230331103823_add_title_to_sites.rb +5 -0
  60. data/db/migrate/20230405103612_add_custom_feed_url_to_sites.rb +5 -0
  61. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +445 -109
  62. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +26 -3
  63. data/entry_types/paged/app/controllers/pageflow_paged/editor/entries_controller.rb +0 -2
  64. data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +1 -0
  65. data/entry_types/paged/app/views/pageflow_paged/entries/show.html.erb +1 -0
  66. data/entry_types/paged/config/initializers/features.rb +0 -1
  67. data/entry_types/paged/lib/pageflow_paged/engine.rb +17 -1
  68. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
  69. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +3 -4
  70. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +13 -6
  71. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +2 -0
  72. data/entry_types/scrolled/app/helpers/pageflow_scrolled/cache_helper.rb +11 -0
  73. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/entry_json_seed_helper.rb +42 -0
  74. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +3 -0
  75. data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +31 -10
  76. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +9 -1
  77. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +3 -1
  78. data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +23 -0
  79. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +6 -1
  80. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -5
  81. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/sections/_section_with_content_elements.json.jbuilder +10 -0
  82. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +44 -41
  83. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_consent_vendors.json.jbuilder +16 -0
  84. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +3 -0
  85. data/entry_types/scrolled/config/initializers/features.rb +5 -0
  86. data/entry_types/scrolled/config/locales/consent_widget.de.yml +4 -0
  87. data/entry_types/scrolled/config/locales/consent_widget.en.yml +4 -0
  88. data/entry_types/scrolled/config/locales/de.yml +189 -8
  89. data/entry_types/scrolled/config/locales/en.yml +207 -2
  90. data/entry_types/scrolled/config/routes.rb +4 -0
  91. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +97 -5
  92. data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +1 -1
  93. data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +96 -0
  94. data/entry_types/scrolled/lib/pageflow_scrolled/content_element_consent_vendors.rb +38 -0
  95. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +17 -1
  96. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +24 -0
  97. data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +6 -1
  98. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +1 -2
  99. data/entry_types/scrolled/package/contentElements-editor.js +307 -22
  100. data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
  101. data/entry_types/scrolled/package/contentElements-frontend.js +690 -71
  102. data/entry_types/scrolled/package/editor.js +616 -220
  103. data/entry_types/scrolled/package/frontend/{EditableInlineText.module-14c7b097.js → EditableInlineText.module-fa9e3aff.js} +1669 -1674
  104. data/entry_types/scrolled/package/frontend/PhonePlatformContext-10a1d600.js +32 -0
  105. data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-727cce0d.js +107 -0
  106. data/entry_types/scrolled/package/frontend/Viewer-169e14ca.js +154 -0
  107. data/entry_types/scrolled/package/frontend/{Viewer-b6becc57.js → Viewer-ee1aa590.js} +32 -161
  108. data/entry_types/scrolled/package/frontend/arrowRight-92a34ccc.js +77 -0
  109. data/entry_types/scrolled/package/frontend/{components-b3160dd7.js → components-4a09bfa3.js} +185 -45
  110. data/entry_types/scrolled/package/frontend/{PhonePlatformContext-f6093cc6.js → i18n-ddd92820.js} +149 -107
  111. data/entry_types/scrolled/package/frontend/index-02378634.js +118 -0
  112. data/entry_types/scrolled/package/frontend/index.css +1 -1
  113. data/entry_types/scrolled/package/frontend/index.js +206 -54
  114. data/entry_types/scrolled/package/frontend/useContentElementEditorState-63045393.js +52 -0
  115. data/entry_types/scrolled/package/package.json +2 -1
  116. data/entry_types/scrolled/package/testHelpers.js +9 -2
  117. data/entry_types/scrolled/package/values/colors.module.css +15 -0
  118. data/entry_types/scrolled/package/widgets/consentBar.css +1 -0
  119. data/entry_types/scrolled/package/widgets/consentBar.js +426 -0
  120. data/entry_types/scrolled/package/widgets/defaultNavigation.css +1 -1
  121. data/lib/generators/pageflow/resque/resque_generator.rb +1 -1
  122. data/lib/pageflow/ability_mixin.rb +5 -5
  123. data/lib/pageflow/active_admin_can_can_fix.rb +2 -2
  124. data/lib/pageflow/built_in_file_type.rb +7 -0
  125. data/lib/pageflow/configuration.rb +21 -0
  126. data/lib/pageflow/engine.rb +60 -39
  127. data/lib/pageflow/entry_export_import/revision_serialization.rb +1 -1
  128. data/lib/pageflow/file_type.rb +2 -2
  129. data/lib/pageflow/global_config_api.rb +2 -2
  130. data/lib/pageflow/nested_revision_component.rb +23 -5
  131. data/lib/pageflow/rails_version.rb +19 -0
  132. data/lib/pageflow/seeds.rb +10 -7
  133. data/lib/pageflow/version.rb +1 -1
  134. data/lib/pageflow/widget_types.rb +4 -0
  135. data/package/config/webpack5.js +14 -0
  136. data/package/editor.js +141 -30
  137. data/package/frontend.js +26 -2
  138. data/package/testHelpers.js +1 -1
  139. data/package/ui.js +296 -71
  140. data/spec/factories/entries.rb +17 -3
  141. data/spec/factories/sites.rb +3 -0
  142. data/vendor/assets/javascripts/iscroll.js +4 -7
  143. metadata +65 -49
  144. data/app/helpers/pageflow/admin/permalinks_helper.rb +0 -15
  145. data/entry_types/scrolled/package/frontend/arrowRight-78a7cee4.js +0 -42
@@ -1,15 +1,17 @@
1
1
  import 'regenerator-runtime';
2
- import { a6 as ContentElementEditorCommandEmitterContext, b as usePostMessageListener, a7 as MotifAreaVisibilityProvider, a8 as ForcePaddingContext, a9 as ContentElementConfigurationUpdateContext, aa as ContentElementEditorStateContext, d as api, z as useContentElementEditorState, ab as LayoutWithoutInlineEditing, a5 as SectionThumbnail, ac as renderElement, ad as renderLeaf$1, y as useContentElementEditorCommandSubscription, T as Text$1, n as frontendStyles } from './EditableInlineText.module-14c7b097.js';
2
+ import { a9 as ContentElementEditorCommandEmitterContext, b as usePostMessageListener, aa as MotifAreaVisibilityProvider, ab as ForcePaddingContext, ac as ContentElementConfigurationUpdateContext, d as api, l as widths, ad as LayoutWithoutInlineEditing, a8 as SectionThumbnail, ae as renderElement, af as renderLeaf$1, D as useContentElementEditorCommandSubscription, W as Text$1, r as frontendStyles } from './EditableInlineText.module-fa9e3aff.js';
3
3
  import 'pageflow/frontend';
4
4
  import React, { useMemo, useState, useCallback, useContext, useRef, useEffect, createContext, memo } from 'react';
5
- import { c as _slicedToArray, o as useEntryStateDispatch, b as _defineProperty, _ as _objectWithoutProperties, u as useI18n, D as updateContentElementConfiguration, q as useChapter, a as _objectSpread2, j as _toConsumableArray, F as _unsupportedIterableToArray, P as PhonePlatformContext } from './PhonePlatformContext-f6093cc6.js';
6
- import 'i18n-js';
5
+ import { _ as _slicedToArray, n as useEntryStateDispatch, b as _defineProperty, e as _objectWithoutProperties, u as useI18n, C as updateContentElementConfiguration, m as useChapter, f as useFile, a as _objectSpread2, l as _toConsumableArray, D as _unsupportedIterableToArray } from './i18n-ddd92820.js';
6
+ import classNames from 'classnames';
7
+ import { C as ContentElementEditorStateContext, a as useContentElementEditorState } from './useContentElementEditorState-63045393.js';
7
8
  import 'use-context-selector';
8
9
  import 'reselect';
9
10
  import 'slugify';
10
- import classNames from 'classnames';
11
11
  import './createSuper-d0f30da3.js';
12
12
  import BackboneEvents from 'backbone-events-standalone';
13
+ import 'i18n-js';
14
+ import { P as PhonePlatformContext } from './PhonePlatformContext-10a1d600.js';
13
15
  import 'react-measure';
14
16
  import { DndProvider, useDrop, useDrag } from 'react-dnd';
15
17
  import { HTML5Backend } from 'react-dnd-html5-backend';
@@ -193,7 +195,7 @@ function MessageHandler(_ref) {
193
195
  return null;
194
196
  }
195
197
 
196
- var styles = {"wrapper":"SectionDecorator-module_wrapper__3sTk3","selected":"SectionDecorator-module_selected__1gcmF","transitionSelected":"SectionDecorator-module_transitionSelected__Wklk6","controls":"SectionDecorator-module_controls__LVEJG","editToolbar":"SectionDecorator-module_editToolbar__18Kjq","toolbar":"SectionDecorator-module_toolbar__2Va1D","transitionToolbar-before":"SectionDecorator-module_transitionToolbar-before__KipOO SectionDecorator-module_toolbar__2Va1D","transitionToolbar-after":"SectionDecorator-module_transitionToolbar-after__2_DVO SectionDecorator-module_toolbar__2Va1D"};
198
+ 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"};
197
199
 
198
200
  var styles$1 = {"wrapper":"ContentElementDecorator-module_wrapper__NQgFN"};
199
201
 
@@ -298,7 +300,7 @@ function SectionDecorator(_ref) {
298
300
  isLastContentElementSelected = _useEditorSelection2.isSelected;
299
301
 
300
302
  function selectIfOutsideContentItem(event) {
301
- if (!event.target.closest(".".concat(styles$1.wrapper))) {
303
+ if (!event.target.closest(".".concat(styles$1.wrapper)) && !event.target.closest('#fullscreenRoot')) {
302
304
  isSelected ? resetSelection() : select();
303
305
  }
304
306
  }
@@ -770,7 +772,7 @@ function DefaultSelectionRect(props) {
770
772
  scrollPoint: isSelected,
771
773
  drag: drag,
772
774
  dragHandleTitle: t('pageflow_scrolled.inline_editing.drag_content_element'),
773
- full: props.position === 'full',
775
+ full: props.width === widths.full || props.customMargin,
774
776
  ariaLabel: t('pageflow_scrolled.inline_editing.select_content_element'),
775
777
  insertButtonTitles: t('pageflow_scrolled.inline_editing.insert_content_element'),
776
778
  onClick: function onClick() {
@@ -930,7 +932,8 @@ var styles$6 = {"placeholder":"TextPlaceholder-module_placeholder__sgVwx"};
930
932
 
931
933
  function TextPlaceholder(_ref) {
932
934
  var text = _ref.text,
933
- visible = _ref.visible;
935
+ visible = _ref.visible,
936
+ className = _ref.className;
934
937
 
935
938
  if (!text || !visible) {
936
939
  return null;
@@ -938,7 +941,9 @@ function TextPlaceholder(_ref) {
938
941
 
939
942
  return /*#__PURE__*/React.createElement("div", {
940
943
  className: styles$6.placeholder
941
- }, /*#__PURE__*/React.createElement("div", null, text));
944
+ }, /*#__PURE__*/React.createElement("div", {
945
+ className: className
946
+ }, text));
942
947
  }
943
948
 
944
949
  function withCustomInsertBreak(editor) {
@@ -977,7 +982,7 @@ function withCustomInsertBreak(editor) {
977
982
  return editor;
978
983
  }
979
984
 
980
- var styles$7 = {"container":"index-module_container__3dD9z","shy":"index-module_shy__KgWjc","selected":"index-module_selected__mE58y","hoveringToolbar":"index-module_hoveringToolbar__31Xpd","selection":"index-module_selection__3dUiD","linkTooltip":"index-module_linkTooltip__36m1K","linkTooltipThumbnail":"index-module_linkTooltipThumbnail__2v-cf","linkTooltipThumbnailClickMask":"index-module_linkTooltipThumbnailClickMask__2Z3ff","linkTooltipNewTab":"index-module_linkTooltipNewTab__4tnLF","linkTooltipChapterNumber":"index-module_linkTooltipChapterNumber__2CsQA"};
985
+ var styles$7 = {"container":"index-module_container__3dD9z","shy":"index-module_shy__KgWjc","selected":"index-module_selected__mE58y","hoveringToolbarContainer":"index-module_hoveringToolbarContainer__3xVEz","hoveringToolbar":"index-module_hoveringToolbar__31Xpd","selection":"index-module_selection__3dUiD","linkTooltip":"index-module_linkTooltip__36m1K","linkTooltip-below":"index-module_linkTooltip-below__1wvl7","linkTooltip-above":"index-module_linkTooltip-above__P3YfD","linkTooltipThumbnail":"index-module_linkTooltipThumbnail__2v-cf","linkTooltipThumbnailClickMask":"index-module_linkTooltipThumbnailClickMask__2Z3ff","linkTooltipNewTab":"index-module_linkTooltipNewTab__4tnLF","linkTooltipChapterNumber":"index-module_linkTooltipChapterNumber__2CsQA"};
981
986
 
982
987
  function _extends$3() {
983
988
  _extends$3 = Object.assign || function (target) {
@@ -1018,6 +1023,7 @@ var UpdateContext = createContext();
1018
1023
  function LinkTooltipProvider(_ref) {
1019
1024
  var editor = _ref.editor,
1020
1025
  disabled = _ref.disabled,
1026
+ position = _ref.position,
1021
1027
  children = _ref.children;
1022
1028
 
1023
1029
  var _useState = useState(),
@@ -1037,7 +1043,8 @@ function LinkTooltipProvider(_ref) {
1037
1043
  setState({
1038
1044
  href: href,
1039
1045
  openInNewTab: openInNewTab,
1040
- top: linkRect.bottom - outerRect.top + 10,
1046
+ top: position === 'below' ? linkRect.bottom - outerRect.top + 10 : 'auto',
1047
+ bottom: position === 'above' ? outerRect.bottom - linkRect.top + 10 : 'auto',
1041
1048
  left: linkRect.left - outerRect.left
1042
1049
  });
1043
1050
  },
@@ -1054,7 +1061,7 @@ function LinkTooltipProvider(_ref) {
1054
1061
  }
1055
1062
  }
1056
1063
  };
1057
- }, []);
1064
+ }, [position]);
1058
1065
  return /*#__PURE__*/React.createElement(UpdateContext.Provider, {
1059
1066
  value: update
1060
1067
  }, /*#__PURE__*/React.createElement("div", {
@@ -1062,7 +1069,8 @@ function LinkTooltipProvider(_ref) {
1062
1069
  }, /*#__PURE__*/React.createElement(LinkTooltip, {
1063
1070
  editor: editor,
1064
1071
  state: state,
1065
- disabled: disabled
1072
+ disabled: disabled,
1073
+ position: position
1066
1074
  }), children));
1067
1075
  }
1068
1076
  function LinkPreview(_ref2) {
@@ -1087,6 +1095,7 @@ function LinkPreview(_ref2) {
1087
1095
  function LinkTooltip(_ref3) {
1088
1096
  var editor = _ref3.editor,
1089
1097
  disabled = _ref3.disabled,
1098
+ position = _ref3.position,
1090
1099
  state = _ref3.state;
1091
1100
 
1092
1101
  var _useContext2 = useContext(UpdateContext),
@@ -1098,11 +1107,12 @@ function LinkTooltip(_ref3) {
1098
1107
  }
1099
1108
 
1100
1109
  return /*#__PURE__*/React.createElement("div", {
1101
- className: classNames(styles$7.linkTooltip, styles$7.hoveringToolbar),
1110
+ className: classNames(styles$7.linkTooltip, styles$7["linkTooltip-".concat(position)], styles$7.hoveringToolbar),
1102
1111
  onMouseEnter: keep,
1103
1112
  onMouseLeave: deactivate,
1104
1113
  style: {
1105
1114
  top: state.top,
1115
+ bottom: state.bottom,
1106
1116
  left: state.left,
1107
1117
  opacity: 1
1108
1118
  }
@@ -1124,6 +1134,10 @@ function LinkDestination(_ref4) {
1124
1134
  return /*#__PURE__*/React.createElement(SectionLinkDestination, {
1125
1135
  permaId: href.section
1126
1136
  });
1137
+ } else if (href === null || href === void 0 ? void 0 : href.file) {
1138
+ return /*#__PURE__*/React.createElement(FileLinkDestination, {
1139
+ fileOptions: href.file
1140
+ });
1127
1141
  } else {
1128
1142
  return /*#__PURE__*/React.createElement(ExternalLinkDestination, {
1129
1143
  href: href,
@@ -1144,7 +1158,7 @@ function ChapterLinkDestination(_ref5) {
1144
1158
  t = _useI18n.t;
1145
1159
 
1146
1160
  if (!chapter) {
1147
- return '(Deleted chapter)';
1161
+ return /*#__PURE__*/React.createElement("span", null, t('pageflow_scrolled.inline_editing.link_tooltip.deleted_chapter'));
1148
1162
  }
1149
1163
 
1150
1164
  return /*#__PURE__*/React.createElement("a", {
@@ -1197,6 +1211,29 @@ function ExternalLinkDestination(_ref7) {
1197
1211
  }, openInNewTab ? t('pageflow_scrolled.inline_editing.link_tooltip.opens_in_new_tab') : t('pageflow_scrolled.inline_editing.link_tooltip.opens_in_same_tab')));
1198
1212
  }
1199
1213
 
1214
+ function FileLinkDestination(_ref8) {
1215
+ var fileOptions = _ref8.fileOptions;
1216
+ var file = useFile(fileOptions);
1217
+
1218
+ var _useI18n4 = useI18n({
1219
+ locale: 'ui'
1220
+ }),
1221
+ t = _useI18n4.t;
1222
+
1223
+ if (!file) {
1224
+ return /*#__PURE__*/React.createElement("span", null, t('pageflow_scrolled.inline_editing.link_tooltip.deleted_file'));
1225
+ }
1226
+
1227
+ return /*#__PURE__*/React.createElement("a", {
1228
+ href: file.urls.original,
1229
+ target: "_blank",
1230
+ rel: "noopener noreferrer"
1231
+ }, file.urls.original.split('/').pop(), /*#__PURE__*/React.createElement(ExternalLinkIcon, {
1232
+ width: 10,
1233
+ height: 10
1234
+ }));
1235
+ }
1236
+
1200
1237
  function withLinks(editor) {
1201
1238
  var isInline = editor.isInline;
1202
1239
 
@@ -1258,20 +1295,28 @@ function useDropTargetsActive() {
1258
1295
  return [dropTargetsActive, drop];
1259
1296
  }
1260
1297
 
1298
+ var abortPreviousCall;
1261
1299
  function useSelectLinkDestination() {
1262
1300
  return function () {
1263
1301
  return new Promise(function (resolve, reject) {
1302
+ if (abortPreviousCall) {
1303
+ abortPreviousCall();
1304
+ }
1305
+
1306
+ abortPreviousCall = function abortPreviousCall() {
1307
+ window.removeEventListener('message', receive);
1308
+ reject();
1309
+ };
1310
+
1264
1311
  postSelectLinkDestinationMessage();
1265
1312
  window.addEventListener('message', receive);
1266
1313
 
1267
1314
  function receive(message) {
1268
1315
  if (window.location.href.indexOf(message.origin) === 0) {
1269
1316
  if (message.data.type === 'LINK_DESTINATION_SELECTED') {
1317
+ abortPreviousCall = null;
1270
1318
  window.removeEventListener('message', receive);
1271
1319
  resolve(message.data.payload);
1272
- } else if (message.data.type === 'LINK_DESTINATION_SELECTION_ABORTED') {
1273
- window.removeEventListener('message', receive);
1274
- reject();
1275
1320
  }
1276
1321
  }
1277
1322
  }
@@ -1454,7 +1499,8 @@ var LinkIcon = (function (_ref) {
1454
1499
  }));
1455
1500
  });
1456
1501
 
1457
- function HoveringToolbar() {
1502
+ function HoveringToolbar(_ref) {
1503
+ var position = _ref.position;
1458
1504
  var ref = useRef();
1459
1505
  var outerRef = useRef();
1460
1506
  var editor = useSlate();
@@ -1482,11 +1528,19 @@ function HoveringToolbar() {
1482
1528
  var rect = domRange.getBoundingClientRect();
1483
1529
  var outerRect = outerRef.current.getBoundingClientRect();
1484
1530
  el.style.opacity = 1;
1485
- el.style.top = "".concat(rect.bottom - outerRect.top + 10, "px");
1486
1531
  el.style.left = "".concat(rect.left - outerRect.left, "px");
1532
+
1533
+ if (position === 'above') {
1534
+ el.style.top = 'auto';
1535
+ el.style.bottom = "".concat(outerRect.bottom - rect.top + 5, "px");
1536
+ } else {
1537
+ el.style.bottom = 'auto';
1538
+ el.style.top = "".concat(rect.bottom - outerRect.top + 5, "px");
1539
+ }
1487
1540
  });
1488
1541
  return /*#__PURE__*/React.createElement("div", {
1489
- ref: outerRef
1542
+ ref: outerRef,
1543
+ className: styles$7.hoveringToolbarContainer
1490
1544
  }, /*#__PURE__*/React.createElement("div", {
1491
1545
  ref: ref,
1492
1546
  className: styles$7.hoveringToolbar
@@ -1532,9 +1586,9 @@ function handleButtonClick(editor, format, selectLinkDestination) {
1532
1586
  if (isLinkActive(editor)) {
1533
1587
  unwrapLink(editor);
1534
1588
  } else {
1535
- selectLinkDestination().then(function (_ref) {
1536
- var href = _ref.href,
1537
- openInNewTab = _ref.openInNewTab;
1589
+ selectLinkDestination().then(function (_ref2) {
1590
+ var href = _ref2.href,
1591
+ openInNewTab = _ref2.openInNewTab;
1538
1592
  wrapLink(editor, href, openInNewTab);
1539
1593
  }, function () {});
1540
1594
  }
@@ -1704,21 +1758,30 @@ function toggleBlock(editor, format) {
1704
1758
  var block = _objectSpread2({
1705
1759
  type: format,
1706
1760
  children: []
1707
- }, preserveTypograpyhVariant(editor));
1761
+ }, preserveColorAndTypograpyhVariant(editor));
1708
1762
 
1709
1763
  Transforms.wrapNodes(editor, block);
1710
1764
  }
1711
1765
  }
1712
1766
  function applyTypograpyhVariant(editor, variant) {
1713
- Transforms.setNodes(editor, {
1767
+ applyProperties(editor, {
1714
1768
  variant: variant
1715
- }, {
1769
+ });
1770
+ }
1771
+ function applyColor(editor, color) {
1772
+ applyProperties(editor, {
1773
+ color: color
1774
+ });
1775
+ }
1776
+
1777
+ function applyProperties(editor, properties) {
1778
+ Transforms.setNodes(editor, properties, {
1716
1779
  mode: 'highest'
1717
1780
  });
1718
- applyTypograpyhVariantToListItems(editor, variant);
1781
+ applyPropertiesToListItems(editor, properties);
1719
1782
  }
1720
1783
 
1721
- function applyTypograpyhVariantToListItems(editor, variant) {
1784
+ function applyPropertiesToListItems(editor, properties) {
1722
1785
  var lists = Editor.nodes(editor, {
1723
1786
  match: function match(n) {
1724
1787
  return listTypes.includes(n.type);
@@ -1748,9 +1811,7 @@ function applyTypograpyhVariantToListItems(editor, variant) {
1748
1811
  var _step2$value = _slicedToArray(_step2.value, 2),
1749
1812
  itemPath = _step2$value[1];
1750
1813
 
1751
- Transforms.setNodes(editor, {
1752
- variant: variant
1753
- }, {
1814
+ Transforms.setNodes(editor, properties, {
1754
1815
  at: itemPath
1755
1816
  });
1756
1817
  }
@@ -1767,16 +1828,24 @@ function applyTypograpyhVariantToListItems(editor, variant) {
1767
1828
  }
1768
1829
  }
1769
1830
 
1770
- function preserveTypograpyhVariant(editor) {
1831
+ function preserveColorAndTypograpyhVariant(editor) {
1771
1832
  var nodeEntry = Editor.above(editor, {
1772
1833
  at: Range.start(editor.selection),
1773
1834
  match: function match(n) {
1774
1835
  return !!n.type;
1775
1836
  }
1776
1837
  });
1777
- return nodeEntry && nodeEntry[0].variant ? {
1778
- variant: nodeEntry[0].variant
1779
- } : {};
1838
+ var result = {};
1839
+
1840
+ if (nodeEntry && nodeEntry[0].variant) {
1841
+ result.variant = nodeEntry[0].variant;
1842
+ }
1843
+
1844
+ if (nodeEntry && nodeEntry[0].color) {
1845
+ result.color = nodeEntry[0].color;
1846
+ }
1847
+
1848
+ return result;
1780
1849
  }
1781
1850
 
1782
1851
  function withBlockNormalization(_ref, editor) {
@@ -2027,7 +2096,7 @@ function Selection(props) {
2027
2096
  range = _useContentElementEdi.range;
2028
2097
 
2029
2098
  useEffect(function () {
2030
- var _getUniformSelectedNo;
2099
+ var _getUniformSelectedNo, _getUniformSelectedNo2;
2031
2100
 
2032
2101
  var selection = editor.selection;
2033
2102
 
@@ -2084,7 +2153,8 @@ function Selection(props) {
2084
2153
  setTransientState({
2085
2154
  editableTextIsSingleBlock: editor.children.length <= 1,
2086
2155
  exampleNode: getUniformSelectedNode(editor, 'type'),
2087
- typographyVariant: (_getUniformSelectedNo = getUniformSelectedNode(editor, 'variant')) === null || _getUniformSelectedNo === void 0 ? void 0 : _getUniformSelectedNo.variant
2156
+ typographyVariant: (_getUniformSelectedNo = getUniformSelectedNode(editor, 'variant')) === null || _getUniformSelectedNo === void 0 ? void 0 : _getUniformSelectedNo.variant,
2157
+ color: (_getUniformSelectedNo2 = getUniformSelectedNode(editor, 'color')) === null || _getUniformSelectedNo2 === void 0 ? void 0 : _getUniformSelectedNo2.color
2088
2158
  });
2089
2159
  boundsRef.current = {
2090
2160
  start: start,
@@ -2463,13 +2533,24 @@ var EditableText = React.memo(function EditableText(_ref) {
2463
2533
  placeholder = _ref.placeholder,
2464
2534
  onChange = _ref.onChange,
2465
2535
  selectionRect = _ref.selectionRect,
2466
- className = _ref.className;
2536
+ className = _ref.className,
2537
+ placeholderClassName = _ref.placeholderClassName,
2538
+ _ref$scaleCategory = _ref.scaleCategory,
2539
+ scaleCategory = _ref$scaleCategory === void 0 ? 'body' : _ref$scaleCategory,
2540
+ autoFocus = _ref.autoFocus,
2541
+ _ref$floatingControls = _ref.floatingControlsPosition,
2542
+ floatingControlsPosition = _ref$floatingControls === void 0 ? 'below' : _ref$floatingControls;
2467
2543
  var editor = useMemo(function () {
2468
2544
  return withLinks(withCustomInsertBreak(withBlockNormalization({
2469
2545
  onlyParagraphs: !selectionRect
2470
2546
  }, withLineBreakNormalization(withReact(createEditor())))));
2471
2547
  }, [selectionRect]);
2472
2548
  var handleLineBreaks = useLineBreakHandler(editor);
2549
+ useEffect(function () {
2550
+ if (autoFocus) {
2551
+ ReactEditor.focus(editor);
2552
+ }
2553
+ }, [autoFocus, editor]);
2473
2554
 
2474
2555
  var _useCachedValue = useCachedValue(value, {
2475
2556
  defaultValue: [{
@@ -2495,8 +2576,14 @@ var EditableText = React.memo(function EditableText(_ref) {
2495
2576
  Transforms.removeNodes(editor, {
2496
2577
  mode: 'highest'
2497
2578
  });
2498
- } else if (command.type === 'TRANSIENT_STATE_UPDATE' && 'typographyVariant' in command.payload) {
2499
- applyTypograpyhVariant(editor, command.payload.typographyVariant);
2579
+ } else if (command.type === 'TRANSIENT_STATE_UPDATE') {
2580
+ if ('typographyVariant' in command.payload) {
2581
+ applyTypograpyhVariant(editor, command.payload.typographyVariant);
2582
+ }
2583
+
2584
+ if ('color' in command.payload) {
2585
+ applyColor(editor, command.payload.color);
2586
+ }
2500
2587
  }
2501
2588
  });
2502
2589
 
@@ -2506,7 +2593,7 @@ var EditableText = React.memo(function EditableText(_ref) {
2506
2593
  ref = _useDropTargetsActive2[1];
2507
2594
 
2508
2595
  return /*#__PURE__*/React.createElement(Text$1, {
2509
- scaleCategory: "body"
2596
+ scaleCategory: scaleCategory
2510
2597
  }, /*#__PURE__*/React.createElement("div", {
2511
2598
  className: classNames(styles$7.container, _defineProperty({}, styles$7.selected, isSelected)),
2512
2599
  ref: ref
@@ -2515,12 +2602,15 @@ var EditableText = React.memo(function EditableText(_ref) {
2515
2602
  value: cachedValue,
2516
2603
  onChange: setCachedValue
2517
2604
  }, /*#__PURE__*/React.createElement(LinkTooltipProvider, {
2518
- editor: editor
2605
+ editor: editor,
2606
+ position: floatingControlsPosition
2519
2607
  }, selectionRect && /*#__PURE__*/React.createElement(Selection, {
2520
2608
  contentElementId: contentElementId
2521
2609
  }), dropTargetsActive && /*#__PURE__*/React.createElement(DropTargets$1, {
2522
2610
  contentElementId: contentElementId
2523
- }), /*#__PURE__*/React.createElement(HoveringToolbar, null), /*#__PURE__*/React.createElement(Editable, {
2611
+ }), /*#__PURE__*/React.createElement(HoveringToolbar, {
2612
+ position: floatingControlsPosition
2613
+ }), /*#__PURE__*/React.createElement(Editable, {
2524
2614
  className: className,
2525
2615
  decorate: decorateLineBreaks,
2526
2616
  onKeyDown: handleLineBreaks,
@@ -2528,6 +2618,7 @@ var EditableText = React.memo(function EditableText(_ref) {
2528
2618
  renderLeaf: renderLeafWithLineBreakDecoration
2529
2619
  }))), /*#__PURE__*/React.createElement(TextPlaceholder, {
2530
2620
  text: placeholder,
2621
+ className: placeholderClassName,
2531
2622
  visible: isBlank(cachedValue)
2532
2623
  })));
2533
2624
  });
@@ -2679,6 +2770,55 @@ function renderLeaf(_ref2) {
2679
2770
  return /*#__PURE__*/React.createElement("span", attributes, children);
2680
2771
  }
2681
2772
 
2773
+ var styles$a = {"button":"ActionButton-module_button__8gy6J","position-outside":"ActionButton-module_position-outside__1E_lp","position-outsideIndented":"ActionButton-module_position-outsideIndented__3vf-7","position-inside":"ActionButton-module_position-inside__28_gp"};
2774
+
2775
+ function _extends$e() {
2776
+ _extends$e = Object.assign || function (target) {
2777
+ for (var i = 1; i < arguments.length; i++) {
2778
+ var source = arguments[i];
2779
+
2780
+ for (var key in source) {
2781
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
2782
+ target[key] = source[key];
2783
+ }
2784
+ }
2785
+ }
2786
+
2787
+ return target;
2788
+ };
2789
+
2790
+ return _extends$e.apply(this, arguments);
2791
+ }
2792
+ var pencil = (function (_ref) {
2793
+ var _ref$styles = _ref.styles,
2794
+ props = _objectWithoutProperties(_ref, ["styles"]);
2795
+
2796
+ return /*#__PURE__*/React.createElement("svg", _extends$e({
2797
+ xmlns: "http://www.w3.org/2000/svg",
2798
+ viewBox: "0 0 512 512"
2799
+ }, props), /*#__PURE__*/React.createElement("path", {
2800
+ d: "M410.3 231l11.3-11.3-33.9-33.9-62.1-62.1-33.9-33.9-11.3 11.3-22.6 22.6L58.6 322.9c-10.4 10.4-18 23.3-22.2 37.4L1 480.7c-2.5 8.4-.2 17.5 6.1 23.7s15.3 8.5 23.7 6.1l120.3-35.4c14.1-4.2 27-11.8 37.4-22.2l199.2-199.2 22.6-22.7zM160 399.4l-9.1 22.7c-4 3.1-8.5 5.4-13.3 6.9l-78.2 23 23-78.1c1.4-4.9 3.8-9.4 6.9-13.3l22.7-9.1v32c0 8.8 7.2 16 16 16h32zM362.7 18.7l-14.4 14.5-22.6 22.6-11.4 11.3 33.9 33.9 62.1 62.1 33.9 33.9 11.3-11.3 22.6-22.6 14.5-14.5c25-25 25-65.5 0-90.5l-39.3-39.4c-25-25-65.5-25-90.5 0zm-47.4 168l-144 144c-6.2 6.2-16.4 6.2-22.6 0s-6.2-16.4 0-22.6l144-144c6.2-6.2 16.4-6.2 22.6 0s6.2 16.4 0 22.6z"
2801
+ }));
2802
+ });
2803
+
2804
+ var icons = {
2805
+ pencil: pencil
2806
+ };
2807
+ function ActionButton(_ref) {
2808
+ var icon = _ref.icon,
2809
+ text = _ref.text,
2810
+ position = _ref.position,
2811
+ onClick = _ref.onClick;
2812
+ var Icon = icons[icon];
2813
+ return /*#__PURE__*/React.createElement("button", {
2814
+ className: classNames(styles$a.button, styles$a["position-".concat(position)]),
2815
+ onClick: onClick
2816
+ }, /*#__PURE__*/React.createElement(Icon, {
2817
+ width: 15,
2818
+ height: 15
2819
+ }), text);
2820
+ }
2821
+
2682
2822
  function PhonePlatformProvider(_ref) {
2683
2823
  var children = _ref.children;
2684
2824
 
@@ -2709,4 +2849,4 @@ function PhonePlatformProvider(_ref) {
2709
2849
  }, children);
2710
2850
  }
2711
2851
 
2712
- export { ContentDecorator, ContentElementDecorator, EditableInlineText, EditableText, LayoutWithPlaceholder, PhonePlatformProvider, SectionDecorator };
2852
+ export { ActionButton, ContentDecorator, ContentElementDecorator, EditableInlineText, EditableText, LayoutWithPlaceholder, PhonePlatformProvider, SectionDecorator };