pageflow 15.3.0 → 15.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pageflow might be problematic. Click here for more details.

Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +158 -353
  3. data/README.md +2 -3
  4. data/app/assets/javascripts/pageflow/dist/ui.js +99 -32
  5. data/app/assets/javascripts/pageflow/vendor.js +0 -1
  6. data/app/assets/stylesheets/pageflow/editor/base.scss +3 -2
  7. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +1 -1
  8. data/app/assets/stylesheets/pageflow/editor/select_button.scss +1 -1
  9. data/app/assets/stylesheets/pageflow/editor/sidebar_footer.scss +1 -1
  10. data/app/assets/stylesheets/pageflow/entries.scss +1 -1
  11. data/app/assets/stylesheets/pageflow/loading_spinner.scss +4 -1
  12. data/app/assets/stylesheets/pageflow/navigation_mobile.scss +4 -4
  13. data/app/assets/stylesheets/pageflow/themes/default/anchors.scss +1 -1
  14. data/app/assets/stylesheets/pageflow/themes/default/logo/variant/watermark.scss +1 -1
  15. data/app/assets/stylesheets/pageflow/themes/default/page/anchors.scss +1 -1
  16. data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/control_bar.scss +1 -1
  17. data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/info_box.scss +1 -1
  18. data/app/assets/stylesheets/pageflow/themes/default/player_controls/shared/menu_bar.scss +2 -2
  19. data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/control_bar.scss +2 -2
  20. data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/info_box.scss +1 -1
  21. data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/quality_menu.scss +2 -2
  22. data/app/assets/stylesheets/pageflow/themes/default/player_controls/waveform/wave.scss +1 -1
  23. data/app/assets/stylesheets/pageflow/ui/forms.scss +9 -2
  24. data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.scss +2 -2
  25. data/app/models/pageflow/account_role_query.rb +1 -1
  26. data/app/models/pageflow/managed_user_query.rb +1 -1
  27. data/app/policies/pageflow/folder_policy.rb +2 -2
  28. data/app/policies/pageflow/membership_policy.rb +2 -2
  29. data/app/policies/pageflow/theming_policy.rb +2 -2
  30. data/app/policies/pageflow/user_policy.rb +1 -1
  31. data/app/views/pageflow/video_files/_video_file.json.jbuilder +8 -1
  32. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +103 -36
  33. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +42 -15
  34. data/entry_types/paged/app/assets/javascripts/pageflow_paged/vendor.js +1 -0
  35. data/entry_types/paged/app/assets/javascripts/pageflow_paged/videojs.js +6 -0
  36. data/entry_types/paged/app/views/layouts/pageflow_paged/_loading_spinner_inline_script.html.erb +1 -0
  37. data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +1 -1
  38. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +2 -0
  39. data/entry_types/paged/lib/tasks/pageflow_paged_tasks.rake +7 -0
  40. data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/dash.all.min.js +0 -0
  41. data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs-dash.js +0 -0
  42. data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs.js +0 -0
  43. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +2 -0
  44. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +1 -0
  45. data/entry_types/scrolled/app/helpers/pageflow_scrolled/favicon_helper.rb +21 -0
  46. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +12 -5
  47. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +5 -7
  48. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +1 -0
  49. data/entry_types/scrolled/app/views/pageflow_scrolled/favicons/_entry.html.erb +10 -0
  50. data/entry_types/scrolled/config/locales/de.yml +655 -0
  51. data/entry_types/scrolled/config/locales/en.yml +522 -0
  52. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +5 -0
  53. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-192x192.png +0 -0
  54. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-512x512.png +0 -0
  55. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/apple-touch-icon.png +0 -0
  56. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/browserconfig.xml +9 -0
  57. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-16x16.png +0 -0
  58. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-32x32.png +0 -0
  59. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon.ico +0 -0
  60. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/mstile-150x150.png +0 -0
  61. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/safari-pinned-tab.svg +46 -0
  62. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/site.webmanifest +19 -0
  63. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/unmute.mp3 +0 -0
  64. data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +1 -0
  65. data/entry_types/scrolled/package/contentElements-editor.js +14 -1
  66. data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
  67. data/entry_types/scrolled/package/contentElements-frontend.js +338 -104
  68. data/entry_types/scrolled/package/editor.js +594 -242
  69. data/entry_types/scrolled/package/frontend/{EditableText-4264c349.js → EditableText-43c50894.js} +331 -163
  70. data/entry_types/scrolled/package/frontend/{Wavesurfer-c3c45324.js → Wavesurfer-b88b02e0.js} +0 -3
  71. data/entry_types/scrolled/package/frontend/{components-cfe6a479.js → components-3ead1b4a.js} +509 -91
  72. data/entry_types/scrolled/package/frontend/index.css +2 -2
  73. data/entry_types/scrolled/package/frontend/index.js +2107 -1025
  74. data/entry_types/scrolled/package/package.json +15 -3
  75. data/lib/generators/pageflow/initializer/templates/pageflow.rb +2 -1
  76. data/lib/pageflow/engine.rb +0 -1
  77. data/lib/pageflow/themes.rb +4 -0
  78. data/lib/pageflow/version.rb +1 -1
  79. data/package/config/jest/index.js +7 -2
  80. data/package/config/webpack.js +1 -2
  81. data/package/editor.js +4 -4
  82. data/package/frontend.js +30 -13
  83. data/package/ui.js +99 -32
  84. metadata +25 -11
  85. data/app/assets/javascripts/pageflow/videojs.js +0 -6
  86. data/entry_types/scrolled/config/locales/new/de.yml +0 -601
  87. data/entry_types/scrolled/config/locales/new/en.yml +0 -507
@@ -34,9 +34,6 @@ function _createSuper(Derived) {
34
34
  };
35
35
  }
36
36
  var EVENTS = ['audioprocess', 'error', 'finish', 'loading', 'mouseup', 'pause', 'play', 'ready', 'scroll', 'seek', 'zoom'];
37
- /**
38
- * @description Capitalise the first letter of a string
39
- */
40
37
 
41
38
  function capitaliseFirstLetter(string) {
42
39
  return string.split('-').map(function (part) {
@@ -1,9 +1,14 @@
1
- import React, { useMemo, useState, useCallback, useContext, useEffect, useRef, createContext, useLayoutEffect, memo } from 'react';
2
- import { h as _slicedToArray, M as ContentElementEditorCommandEmitterContext, x as useEntryStateDispatch, q as usePostMessageListener, _ as _defineProperty, a as _objectWithoutProperties, u as useI18n, N as ForcePaddingContext, O as updateContentElementConfiguration, Q as ContentElementConfigurationUpdateContext, R as ContentElementEditorStateContext, B as api, G as useContentElementEditorState, U as LayoutWithoutInlineEditing, V as renderElement, W as renderLeaf, l as _objectSpread2, D as useContentElementEditorCommandSubscription, T as Text$1, P as PhonePlatformContext } from './EditableText-4264c349.js';
1
+ import React, { useMemo, useState, useCallback, useContext, useRef, useEffect, createContext, useLayoutEffect, memo } from 'react';
2
+ import { _ as _slicedToArray, R as ContentElementEditorCommandEmitterContext, t as usePostMessageListener, A as useEntryStateDispatch, a as _defineProperty, b as _objectWithoutProperties, u as useI18n, U as MotifAreaVisibilityProvider, V as ForcePaddingContext, W as updateContentElementConfiguration, X as ContentElementConfigurationUpdateContext, Y as ContentElementEditorStateContext, G as api, J as useContentElementEditorState, Z as LayoutWithoutInlineEditing, $ as renderElement, a0 as renderLeaf, m as _objectSpread2, y as _toConsumableArray, I as useContentElementEditorCommandSubscription, T as Text$1, P as PhonePlatformContext } from './EditableText-43c50894.js';
3
3
  import classNames from 'classnames';
4
+ import 'use-context-selector';
5
+ import 'reselect';
4
6
  import 'i18n-js';
7
+ import 'slugify';
5
8
  import './getPrototypeOf-63c7c8e8.js';
6
9
  import BackboneEvents from 'backbone-events-standalone';
10
+ import { DndProvider, useDrop, useDrag } from 'react-dnd';
11
+ import { HTML5Backend } from 'react-dnd-html5-backend';
7
12
  import { Range, Editor, Transforms, Text, Node, Path, createEditor } from 'slate';
8
13
  import { useSlate, ReactEditor, withReact, Slate, Editable } from 'slate-react';
9
14
  import debounce from 'debounce';
@@ -74,6 +79,83 @@ function ContentElementEditorCommandSubscriptionProvider(_ref) {
74
79
  );
75
80
  }
76
81
 
82
+ // the editor phone preview. Each ContentElementDecorator renders a
83
+ // `data-scrollpoint` attribute with a unique value on its wrapper
84
+ // div. Before toggling the phone preview mode, the `EntryPreviewView`
85
+ // sends a `SAVE_SCROLL_POINT` message. `getCurrentScrollPoint` looks
86
+ // through all DOM elements with `data-scrollpoint` attributes and
87
+ // stores the unique id of the element with the smallest non-negative
88
+ // y coordinate in the viewport (i.e. the first content element inside
89
+ // the viewport). `ScrollPointMessageHandler` responds with a
90
+ // `SAVED_SCROLL_POINT` message which makes `EntryPreviewView` toggle
91
+ // the preview mode. Once the preview has been resized,
92
+ // `EntryPreviewView` sends a `RESTORE_SCROLL_POINT`
93
+ // message. `restoreScrollPoint` looks up the new position of the
94
+ // element with the saved scroll point and scrolls it into view.
95
+ //
96
+ // When a content element is selected, we want to keep that element
97
+ // in the viewport instead. The `SelectionRect` therefore renders a
98
+ // `data-scrollpoint=selection` attribute. If an element with such an
99
+ // attribute is present, `getCurrentScrollPoint` prefers it over all
100
+ // other scroll points. Since text block elements render a selection
101
+ // rect around the current paragraph, scroll position is also
102
+ // preserved correctly inside long text blocks.
103
+
104
+ function ScrollPointMessageHandler() {
105
+ var scrollPoint = useRef();
106
+ var receiveMessage = useCallback(function (data) {
107
+ if (data.type === 'SAVE_SCROLL_POINT') {
108
+ scrollPoint.current = getCurrentScrollPoint();
109
+ window.parent.postMessage({
110
+ type: 'SAVED_SCROLL_POINT'
111
+ }, window.location.origin);
112
+ } else if (data.type === 'RESTORE_SCROLL_POINT') {
113
+ if (scrollPoint.current) {
114
+ restoreScrollPoint(scrollPoint.current);
115
+ }
116
+ }
117
+ }, []);
118
+ usePostMessageListener(receiveMessage);
119
+ return null;
120
+ }
121
+
122
+ function getCurrentScrollPoint() {
123
+ var scrollPointElement = getSelectionScrollPointElement() || getScrollPointElementWithMinimumTopPositionInViewport();
124
+ return scrollPointElement === null || scrollPointElement === void 0 ? void 0 : scrollPointElement.getAttribute('data-scrollpoint');
125
+ }
126
+
127
+ function getSelectionScrollPointElement() {
128
+ return document.querySelector('[data-scrollpoint=selection]');
129
+ }
130
+
131
+ function getScrollPointElementWithMinimumTopPositionInViewport() {
132
+ var minTop = Infinity;
133
+ var scrollPointElement;
134
+ var scrollPoints = document.querySelectorAll('[data-scrollpoint]');
135
+
136
+ for (var i = 0; i < scrollPoints.length; i++) {
137
+ var rect = scrollPoints[i].getBoundingClientRect();
138
+
139
+ if (rect.top > 0 && rect.top < minTop) {
140
+ minTop = rect.top;
141
+ scrollPointElement = scrollPoints[i];
142
+ }
143
+ }
144
+
145
+ return scrollPointElement;
146
+ }
147
+
148
+ function restoreScrollPoint(name) {
149
+ var element = document.querySelector("[data-scrollpoint=\"".concat(name, "\"]"));
150
+
151
+ if (element) {
152
+ window.scrollTo({
153
+ top: element.getBoundingClientRect().top + window.scrollY - 100,
154
+ behavior: 'smooth'
155
+ });
156
+ }
157
+ }
158
+
77
159
  function EntryDecorator(props) {
78
160
  var contentElementEditorCommandEmitter = useContentElementEditorCommandEmitter();
79
161
  return (
@@ -84,9 +166,15 @@ function EntryDecorator(props) {
84
166
  contentElementEditorCommandEmitter: contentElementEditorCommandEmitter
85
167
  }),
86
168
  /*#__PURE__*/
169
+ React.createElement(ScrollPointMessageHandler, null),
170
+ /*#__PURE__*/
87
171
  React.createElement(ContentElementEditorCommandSubscriptionProvider, {
88
172
  emitter: contentElementEditorCommandEmitter
89
- }, props.children))
173
+ },
174
+ /*#__PURE__*/
175
+ React.createElement(DndProvider, {
176
+ backend: HTML5Backend
177
+ }, props.children)))
90
178
  );
91
179
  }
92
180
 
@@ -117,7 +205,7 @@ function MessageHandler(_ref) {
117
205
  return null;
118
206
  }
119
207
 
120
- 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 SectionDecorator-module_toolbar__2Va1D","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"};
208
+ 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"};
121
209
 
122
210
  var styles$1 = {"wrapper":"ContentElementDecorator-module_wrapper__NQgFN"};
123
211
 
@@ -177,47 +265,12 @@ function _extends() {
177
265
 
178
266
  return _extends.apply(this, arguments);
179
267
  }
180
- var editIcon = (function (_ref) {
181
- var _ref$styles = _ref.styles,
182
- styles = _ref$styles === void 0 ? {} : _ref$styles,
183
- props = _objectWithoutProperties(_ref, ["styles"]);
184
-
185
- return React.createElement("svg", _extends({
186
- "aria-hidden": "true",
187
- "data-prefix": "fas",
188
- "data-icon": "pencil-alt",
189
- className: (styles["svg-inline--fa"] || "svg-inline--fa") + " " + (styles["fa-pencil-alt"] || "fa-pencil-alt") + " " + (styles["fa-w-16"] || "fa-w-16"),
190
- xmlns: "http://www.w3.org/2000/svg",
191
- viewBox: "0 0 512 512"
192
- }, props), React.createElement("path", {
193
- fill: "currentColor",
194
- d: "M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"
195
- }));
196
- });
197
-
198
- function _extends$1() {
199
- _extends$1 = Object.assign || function (target) {
200
- for (var i = 1; i < arguments.length; i++) {
201
- var source = arguments[i];
202
-
203
- for (var key in source) {
204
- if (Object.prototype.hasOwnProperty.call(source, key)) {
205
- target[key] = source[key];
206
- }
207
- }
208
- }
209
-
210
- return target;
211
- };
212
-
213
- return _extends$1.apply(this, arguments);
214
- }
215
268
  var transitionIcon = (function (_ref) {
216
269
  var _ref$styles = _ref.styles,
217
270
  styles = _ref$styles === void 0 ? {} : _ref$styles,
218
271
  props = _objectWithoutProperties(_ref, ["styles"]);
219
272
 
220
- return React.createElement("svg", _extends$1({
273
+ return React.createElement("svg", _extends({
221
274
  "aria-hidden": "true",
222
275
  "data-prefix": "fas",
223
276
  "data-icon": "random",
@@ -238,16 +291,12 @@ function SectionDecorator(props) {
238
291
 
239
292
  var _useEditorSelection = useEditorSelection({
240
293
  id: props.id,
241
- type: 'section'
294
+ type: 'sectionSettings'
242
295
  }),
243
296
  isSelected = _useEditorSelection.isSelected,
244
297
  select = _useEditorSelection.select,
245
298
  resetSelection = _useEditorSelection.resetSelection;
246
299
 
247
- var settingsSelection = useEditorSelection({
248
- id: props.id,
249
- type: 'sectionSettings'
250
- });
251
300
  var transitionSelection = useEditorSelection({
252
301
  id: props.id,
253
302
  type: 'sectionTransition'
@@ -256,7 +305,7 @@ function SectionDecorator(props) {
256
305
  id: props.nextSection && props.nextSection.id,
257
306
  type: 'sectionTransition'
258
307
  });
259
- var lastContentElement = props.foreground[props.foreground.length - 1];
308
+ var lastContentElement = props.contentElements[props.contentElements.length - 1];
260
309
 
261
310
  var _useEditorSelection2 = useEditorSelection({
262
311
  id: lastContentElement && lastContentElement.id,
@@ -264,8 +313,6 @@ function SectionDecorator(props) {
264
313
  }),
265
314
  isLastContentElementSelected = _useEditorSelection2.isSelected;
266
315
 
267
- var isSectionSelected = isSelected || settingsSelection.isSelected;
268
-
269
316
  function selectIfOutsideContentItem(event) {
270
317
  if (!event.target.closest(".".concat(styles$1.wrapper))) {
271
318
  isSelected ? resetSelection() : select();
@@ -276,7 +323,7 @@ function SectionDecorator(props) {
276
323
  /*#__PURE__*/
277
324
  React.createElement("div", {
278
325
  "aria-label": t('pageflow_scrolled.inline_editing.select_section'),
279
- className: className(isSectionSelected, transitionSelection),
326
+ className: className(isSelected, transitionSelection),
280
327
  onMouseDown: selectIfOutsideContentItem
281
328
  },
282
329
  /*#__PURE__*/
@@ -286,26 +333,19 @@ function SectionDecorator(props) {
286
333
  id: props.previousSection && props.id,
287
334
  selection: transitionSelection,
288
335
  position: 'before'
289
- }),
290
- /*#__PURE__*/
291
- React.createElement("div", {
292
- className: styles.editToolbar
293
- },
294
- /*#__PURE__*/
295
- React.createElement(EditSectionButton, {
296
- id: props.id,
297
- selection: settingsSelection,
298
- text: t('pageflow_scrolled.inline_editing.edit_section_settings'),
299
- icon: editIcon
300
- })), renderEditTransitionButton({
336
+ }), renderEditTransitionButton({
301
337
  id: props.nextSection && props.nextSection.id,
302
338
  selection: nextTransitionSelection,
303
339
  position: 'after'
304
340
  })),
305
341
  /*#__PURE__*/
342
+ React.createElement(MotifAreaVisibilityProvider, {
343
+ visible: isSelected
344
+ },
345
+ /*#__PURE__*/
306
346
  React.createElement(ForcePaddingContext.Provider, {
307
- value: isLastContentElementSelected || isSectionSelected
308
- }, props.children))
347
+ value: isLastContentElementSelected || isSelected
348
+ }, props.children)))
309
349
  );
310
350
  }
311
351
 
@@ -381,7 +421,36 @@ function EditSectionButton(_ref3) {
381
421
  );
382
422
  }
383
423
 
384
- var styles$3 = {"selectionWidth":"1px","selectionPadding":"-6px","selectionPadding2":"-0.5em","main":"SelectionRect-module_main__3AOhG","full":"SelectionRect-module_full__3tsQF","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"};
424
+ var styles$3 = {"selectionWidth":"1px","selectionPadding":"-6px","selectionPadding2":"-0.5em","main":"SelectionRect-module_main__3AOhG","draggable":"SelectionRect-module_draggable__3Qp53","full":"SelectionRect-module_full__3tsQF","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"};
425
+
426
+ function _extends$1() {
427
+ _extends$1 = Object.assign || function (target) {
428
+ for (var i = 1; i < arguments.length; i++) {
429
+ var source = arguments[i];
430
+
431
+ for (var key in source) {
432
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
433
+ target[key] = source[key];
434
+ }
435
+ }
436
+ }
437
+
438
+ return target;
439
+ };
440
+
441
+ return _extends$1.apply(this, arguments);
442
+ }
443
+ var PlusIcon = (function (_ref) {
444
+ var _ref$styles = _ref.styles,
445
+ props = _objectWithoutProperties(_ref, ["styles"]);
446
+
447
+ return React.createElement("svg", _extends$1({
448
+ xmlns: "http://www.w3.org/2000/svg",
449
+ viewBox: "0 0 512 512"
450
+ }, props), React.createElement("path", {
451
+ d: "M256 0C114.844 0 0 114.839 0 256s114.844 256 256 256 256-114.839 256-256S397.156 0 256 0zm133.594 272.699H272.699v116.895c0 9.225-7.48 16.699-16.699 16.699-9.219 0-16.699-7.475-16.699-16.699V272.699H122.406c-9.219 0-16.699-7.475-16.699-16.699 0-9.225 7.48-16.699 16.699-16.699h116.895V122.406c0-9.225 7.48-16.699 16.699-16.699 9.219 0 16.699 7.475 16.699 16.699v116.895h116.895c9.219 0 16.699 7.475 16.699 16.699.001 9.225-7.48 16.699-16.699 16.699z"
452
+ }));
453
+ });
385
454
 
386
455
  function _extends$2() {
387
456
  _extends$2 = Object.assign || function (target) {
@@ -400,15 +469,21 @@ function _extends$2() {
400
469
 
401
470
  return _extends$2.apply(this, arguments);
402
471
  }
403
- var PlusIcon = (function (_ref) {
472
+ var MoveIcon = (function (_ref) {
404
473
  var _ref$styles = _ref.styles,
474
+ styles = _ref$styles === void 0 ? {} : _ref$styles,
405
475
  props = _objectWithoutProperties(_ref, ["styles"]);
406
476
 
407
477
  return React.createElement("svg", _extends$2({
478
+ "aria-hidden": "true",
479
+ "data-prefix": "fas",
480
+ "data-icon": "arrows-alt",
481
+ className: (styles["svg-inline--fa"] || "svg-inline--fa") + " " + (styles["fa-arrows-alt"] || "fa-arrows-alt") + " " + (styles["fa-w-16"] || "fa-w-16"),
408
482
  xmlns: "http://www.w3.org/2000/svg",
409
483
  viewBox: "0 0 512 512"
410
484
  }, props), React.createElement("path", {
411
- d: "M256 0C114.844 0 0 114.839 0 256s114.844 256 256 256 256-114.839 256-256S397.156 0 256 0zm133.594 272.699H272.699v116.895c0 9.225-7.48 16.699-16.699 16.699-9.219 0-16.699-7.475-16.699-16.699V272.699H122.406c-9.219 0-16.699-7.475-16.699-16.699 0-9.225 7.48-16.699 16.699-16.699h116.895V122.406c0-9.225 7.48-16.699 16.699-16.699 9.219 0 16.699 7.475 16.699 16.699v116.895h116.895c9.219 0 16.699 7.475 16.699 16.699.001 9.225-7.48 16.699-16.699 16.699z"
485
+ fill: "currentColor",
486
+ d: "M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"
412
487
  }));
413
488
  });
414
489
 
@@ -418,10 +493,11 @@ function SelectionRect(props) {
418
493
  return (
419
494
  /*#__PURE__*/
420
495
  React.createElement("div", {
421
- className: classNames(styles$3.main, (_classNames = {}, _defineProperty(_classNames, styles$3.full, props.full), _defineProperty(_classNames, styles$3.selected, props.selected), _defineProperty(_classNames, styles$3.start, props.selected && props.start), _defineProperty(_classNames, styles$3.end, props.selected && props.end), _classNames)),
496
+ className: classNames(styles$3.main, (_classNames = {}, _defineProperty(_classNames, styles$3.full, props.full), _defineProperty(_classNames, styles$3.selected, props.selected), _defineProperty(_classNames, styles$3.draggable, props.drag), _defineProperty(_classNames, styles$3.start, props.selected && props.start), _defineProperty(_classNames, styles$3.end, props.selected && props.end), _classNames)),
422
497
  "aria-label": props.ariaLabel,
498
+ "data-scrollpoint": props.scrollPoint ? 'selection' : undefined,
423
499
  onClick: props.onClick
424
- }, renderToolbar(props),
500
+ }, renderDragHandle(props), renderToolbar(props),
425
501
  /*#__PURE__*/
426
502
  React.createElement(InsertButton, Object.assign({}, props, {
427
503
  at: "before"
@@ -468,10 +544,30 @@ function InsertButton(props) {
468
544
  );
469
545
  }
470
546
 
471
- function renderToolbar(_ref) {
472
- var toolbarButtons = _ref.toolbarButtons,
473
- onToolbarButtonClick = _ref.onToolbarButtonClick,
474
- start = _ref.start;
547
+ function renderDragHandle(_ref) {
548
+ var drag = _ref.drag,
549
+ dragHandleTitle = _ref.dragHandleTitle;
550
+
551
+ if (!drag) {
552
+ return null;
553
+ }
554
+
555
+ return (
556
+ /*#__PURE__*/
557
+ React.createElement("div", {
558
+ ref: drag,
559
+ className: styles$3.dragHandle,
560
+ title: dragHandleTitle
561
+ },
562
+ /*#__PURE__*/
563
+ React.createElement(MoveIcon, null))
564
+ );
565
+ }
566
+
567
+ function renderToolbar(_ref2) {
568
+ var toolbarButtons = _ref2.toolbarButtons,
569
+ onToolbarButtonClick = _ref2.onToolbarButtonClick,
570
+ start = _ref2.start;
475
571
 
476
572
  if (toolbarButtons && start) {
477
573
  return (
@@ -494,6 +590,86 @@ SelectionRect.defaultProps = {
494
590
  end: true
495
591
  };
496
592
 
593
+ var styles$4 = {"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"};
594
+
595
+ function DropTargets(_ref) {
596
+ var accept = _ref.accept,
597
+ _canDrop = _ref.canDrop,
598
+ onDrop = _ref.onDrop;
599
+
600
+ var _useDrop = useDrop({
601
+ accept: accept,
602
+ canDrop: function canDrop(item) {
603
+ return _canDrop({
604
+ at: 'before',
605
+ id: item.id
606
+ });
607
+ },
608
+ collect: function collect(monitor) {
609
+ return {
610
+ canDropBefore: monitor.canDrop(),
611
+ isBefore: monitor.isOver() && monitor.canDrop()
612
+ };
613
+ },
614
+ drop: function drop(item) {
615
+ return onDrop({
616
+ at: 'before',
617
+ id: item.id
618
+ });
619
+ }
620
+ }),
621
+ _useDrop2 = _slicedToArray(_useDrop, 2),
622
+ _useDrop2$ = _useDrop2[0],
623
+ canDropBefore = _useDrop2$.canDropBefore,
624
+ isBefore = _useDrop2$.isBefore,
625
+ dropBefore = _useDrop2[1];
626
+
627
+ var _useDrop3 = useDrop({
628
+ accept: accept,
629
+ canDrop: function canDrop(item) {
630
+ return _canDrop({
631
+ at: 'after',
632
+ id: item.id
633
+ });
634
+ },
635
+ collect: function collect(monitor) {
636
+ return {
637
+ canDropAfter: monitor.canDrop(),
638
+ isAfter: monitor.isOver() && monitor.canDrop()
639
+ };
640
+ },
641
+ drop: function drop(item) {
642
+ return onDrop({
643
+ at: 'after',
644
+ id: item.id
645
+ });
646
+ }
647
+ }),
648
+ _useDrop4 = _slicedToArray(_useDrop3, 2),
649
+ _useDrop4$ = _useDrop4[0],
650
+ canDropAfter = _useDrop4$.canDropAfter,
651
+ isAfter = _useDrop4$.isAfter,
652
+ dropAfter = _useDrop4[1];
653
+
654
+ return (
655
+ /*#__PURE__*/
656
+ React.createElement(React.Fragment, null, canDropBefore &&
657
+ /*#__PURE__*/
658
+ React.createElement("div", {
659
+ ref: dropBefore,
660
+ "data-testid": "drop-before",
661
+ className: classNames(styles$4.before, _defineProperty({}, styles$4.isOver, isBefore))
662
+ }), canDropAfter &&
663
+ /*#__PURE__*/
664
+ React.createElement("div", {
665
+ ref: dropAfter,
666
+ "data-testid": "drop-after",
667
+ title: "bar",
668
+ className: classNames(styles$4.after, _defineProperty({}, styles$4.isOver, isAfter))
669
+ }))
670
+ );
671
+ }
672
+
497
673
  function postInsertContentElementMessage(_ref) {
498
674
  var id = _ref.id,
499
675
  at = _ref.at,
@@ -507,9 +683,20 @@ function postInsertContentElementMessage(_ref) {
507
683
  }
508
684
  }, window.location.origin);
509
685
  }
510
- function postUpdateContentElementMessage(_ref2) {
686
+ function postMoveContentElementMessage(_ref2) {
511
687
  var id = _ref2.id,
512
- configuration = _ref2.configuration;
688
+ to = _ref2.to;
689
+ window.parent.postMessage({
690
+ type: 'MOVE_CONTENT_ELEMENT',
691
+ payload: {
692
+ id: id,
693
+ to: to
694
+ }
695
+ }, window.location.origin);
696
+ }
697
+ function postUpdateContentElementMessage(_ref3) {
698
+ var id = _ref3.id,
699
+ configuration = _ref3.configuration;
513
700
  window.parent.postMessage({
514
701
  type: 'UPDATE_CONTENT_ELEMENT',
515
702
  payload: {
@@ -518,9 +705,9 @@ function postUpdateContentElementMessage(_ref2) {
518
705
  }
519
706
  }, window.location.origin);
520
707
  }
521
- function postUpdateTransientContentElementStateMessage(_ref3) {
522
- var id = _ref3.id,
523
- state = _ref3.state;
708
+ function postUpdateTransientContentElementStateMessage(_ref4) {
709
+ var id = _ref4.id,
710
+ state = _ref4.state;
524
711
  window.parent.postMessage({
525
712
  type: 'UPDATE_TRANSIENT_CONTENT_ELEMENT_STATE',
526
713
  payload: {
@@ -601,7 +788,8 @@ function ContentElementDecorator(props) {
601
788
  return (
602
789
  /*#__PURE__*/
603
790
  React.createElement("div", {
604
- className: styles$1.wrapper
791
+ className: styles$1.wrapper,
792
+ "data-scrollpoint": props.id
605
793
  },
606
794
  /*#__PURE__*/
607
795
  React.createElement(ContentElementEditorStateProvider, {
@@ -641,10 +829,23 @@ function DefaultSelectionRect(props) {
641
829
  }),
642
830
  t = _useI18n.t;
643
831
 
832
+ var _useDrag = useDrag({
833
+ item: {
834
+ type: 'contentElement',
835
+ id: props.id
836
+ }
837
+ }),
838
+ _useDrag2 = _slicedToArray(_useDrag, 3),
839
+ drag = _useDrag2[1],
840
+ preview = _useDrag2[2];
841
+
644
842
  return (
645
843
  /*#__PURE__*/
646
844
  React.createElement(SelectionRect, {
647
845
  selected: isSelected,
846
+ scrollPoint: isSelected,
847
+ drag: drag,
848
+ dragHandleTitle: t('pageflow_scrolled.inline_editing.drag_content_element'),
648
849
  full: props.position === 'full',
649
850
  ariaLabel: t('pageflow_scrolled.inline_editing.select_content_element'),
650
851
  insertButtonTitles: t('pageflow_scrolled.inline_editing.insert_content_element'),
@@ -657,11 +858,34 @@ function DefaultSelectionRect(props) {
657
858
  at: at
658
859
  });
659
860
  }
660
- }, props.children)
861
+ },
862
+ /*#__PURE__*/
863
+ React.createElement("div", {
864
+ ref: preview
865
+ }, props.children),
866
+ /*#__PURE__*/
867
+ React.createElement(DropTargets, {
868
+ accept: "contentElement",
869
+ canDrop: function canDrop(_ref2) {
870
+ var id = _ref2.id;
871
+ return id !== props.id;
872
+ },
873
+ onDrop: function onDrop(_ref3) {
874
+ var id = _ref3.id,
875
+ at = _ref3.at;
876
+ return postMoveContentElementMessage({
877
+ id: id,
878
+ to: {
879
+ id: props.id,
880
+ at: at
881
+ }
882
+ });
883
+ }
884
+ }))
661
885
  );
662
886
  }
663
887
 
664
- var styles$4 = {"container":"ContentElementInsertButton-module_container__3dvUS","hovered":"ContentElementInsertButton-module_hovered__3Pggi","button":"ContentElementInsertButton-module_button__2-eE2"};
888
+ var styles$5 = {"container":"ContentElementInsertButton-module_container__3dvUS","hovered":"ContentElementInsertButton-module_hovered__3Pggi","button":"ContentElementInsertButton-module_button__2-eE2"};
665
889
 
666
890
  function ContentElementInsertButton(_ref) {
667
891
  var onClick = _ref.onClick;
@@ -679,11 +903,11 @@ function ContentElementInsertButton(_ref) {
679
903
  return (
680
904
  /*#__PURE__*/
681
905
  React.createElement("div", {
682
- className: classNames(styles$4.container, _defineProperty({}, styles$4.hovered, hovered))
906
+ className: classNames(styles$5.container, _defineProperty({}, styles$5.hovered, hovered))
683
907
  },
684
908
  /*#__PURE__*/
685
909
  React.createElement("button", {
686
- className: styles$4.button,
910
+ className: styles$5.button,
687
911
  title: t('pageflow_scrolled.inline_editing.add_content_element'),
688
912
  onClick: onClick,
689
913
  onMouseDown: function onMouseDown(event) {
@@ -793,7 +1017,7 @@ function useDebouncedCallback(callback, delay) {
793
1017
  }, []);
794
1018
  }
795
1019
 
796
- var styles$5 = {"placeholder":"TextPlaceholder-module_placeholder__sgVwx"};
1020
+ var styles$6 = {"placeholder":"TextPlaceholder-module_placeholder__sgVwx"};
797
1021
 
798
1022
  function TextPlaceholder(_ref) {
799
1023
  var text = _ref.text,
@@ -806,8 +1030,10 @@ function TextPlaceholder(_ref) {
806
1030
  return (
807
1031
  /*#__PURE__*/
808
1032
  React.createElement("div", {
809
- className: styles$5.placeholder
810
- }, text)
1033
+ className: styles$6.placeholder
1034
+ },
1035
+ /*#__PURE__*/
1036
+ React.createElement("div", null, text))
811
1037
  );
812
1038
  }
813
1039
 
@@ -847,7 +1073,7 @@ function withCustomInsertBreak(editor) {
847
1073
  return editor;
848
1074
  }
849
1075
 
850
- var styles$6 = {"container":"index-module_container__3dD9z","hoveringToolbar":"index-module_hoveringToolbar__31Xpd","selection":"index-module_selection__3dUiD","linkTooltip":"index-module_linkTooltip__36m1K"};
1076
+ var styles$7 = {"container":"index-module_container__3dD9z","hoveringToolbar":"index-module_hoveringToolbar__31Xpd","selection":"index-module_selection__3dUiD","linkTooltip":"index-module_linkTooltip__36m1K"};
851
1077
 
852
1078
  function _extends$3() {
853
1079
  _extends$3 = Object.assign || function (target) {
@@ -984,7 +1210,7 @@ function LinkTooltip() {
984
1210
  return (
985
1211
  /*#__PURE__*/
986
1212
  React.createElement("div", {
987
- className: classNames(styles$6.linkTooltip, styles$6.hoveringToolbar),
1213
+ className: classNames(styles$7.linkTooltip, styles$7.hoveringToolbar),
988
1214
  onMouseEnter: keep,
989
1215
  onMouseLeave: deactivate,
990
1216
  style: {
@@ -1070,6 +1296,47 @@ function decorateLinkSelection(_ref, linkSelection) {
1070
1296
  return [];
1071
1297
  }
1072
1298
 
1299
+ // element is currently being dragged over the element. `react-dnd`
1300
+ // causes "Update on unmounted component warning" when dropping an
1301
+ // element removes a drop target [1]. As a workaround, couple
1302
+ // rendering of drop targets to asynchronously updated state. That way
1303
+ // the drop target is only removed after element has been dropped.
1304
+ //
1305
+ // [1] https://github.com/react-dnd/react-dnd/issues/1573
1306
+
1307
+ function useDropTargetsActive() {
1308
+ var _useState = useState(false),
1309
+ _useState2 = _slicedToArray(_useState, 2),
1310
+ dropTargetsActive = _useState2[0],
1311
+ setDropTargetsActive = _useState2[1];
1312
+
1313
+ var _useDrop = useDrop({
1314
+ accept: 'contentElement',
1315
+ collect: function collect(monitor) {
1316
+ return {
1317
+ canDrop: monitor.canDrop() && monitor.isOver()
1318
+ };
1319
+ }
1320
+ }),
1321
+ _useDrop2 = _slicedToArray(_useDrop, 2),
1322
+ canDrop = _useDrop2[0].canDrop,
1323
+ drop = _useDrop2[1];
1324
+
1325
+ useEffect(function () {
1326
+ if (canDrop) {
1327
+ setDropTargetsActive(true);
1328
+ } else {
1329
+ var timeout = setTimeout(function () {
1330
+ setDropTargetsActive(false);
1331
+ }, 10);
1332
+ return function () {
1333
+ clearTimeout(timeout);
1334
+ };
1335
+ }
1336
+ }, [canDrop]);
1337
+ return [dropTargetsActive, drop];
1338
+ }
1339
+
1073
1340
  function _extends$4() {
1074
1341
  _extends$4 = Object.assign || function (target) {
1075
1342
  for (var i = 1; i < arguments.length; i++) {
@@ -1146,7 +1413,7 @@ function LinkInput(_ref) {
1146
1413
  return (
1147
1414
  /*#__PURE__*/
1148
1415
  React.createElement("div", {
1149
- className: styles$6.linkTooltip
1416
+ className: styles$7.linkTooltip
1150
1417
  },
1151
1418
  /*#__PURE__*/
1152
1419
  React.createElement("input", {
@@ -1391,7 +1658,7 @@ function HoveringToolbar(_ref) {
1391
1658
  /*#__PURE__*/
1392
1659
  React.createElement("div", {
1393
1660
  ref: ref,
1394
- className: styles$6.hoveringToolbar
1661
+ className: styles$7.hoveringToolbar
1395
1662
  }, !linkSelection && renderToolbar$1(editor, setLinkSelection, t), linkSelection && renderLinkInput(editor, linkSelection, setLinkSelection)))
1396
1663
  );
1397
1664
  }
@@ -1769,11 +2036,12 @@ function Selection(props) {
1769
2036
  /*#__PURE__*/
1770
2037
  React.createElement("div", {
1771
2038
  ref: ref,
1772
- className: styles$6.selection
2039
+ className: styles$7.selection
1773
2040
  },
1774
2041
  /*#__PURE__*/
1775
2042
  React.createElement(SelectionRect, {
1776
2043
  selected: true,
2044
+ scrollPoint: isContentElementSelected,
1777
2045
  insertButtonTitles: t('pageflow_scrolled.inline_editing.insert_content_element'),
1778
2046
  onInsertButtonClick: function onInsertButtonClick(at) {
1779
2047
  if (at === 'before' && boundsRef.current.start === 0 || at === 'after' && !Node.has(editor, [boundsRef.current.end + 1])) {
@@ -1911,6 +2179,145 @@ function toolbarButtons(t) {
1911
2179
  }];
1912
2180
  }
1913
2181
 
2182
+ var styles$8 = {"container":"DropTargets-module_container__3vudG","dropTarget":"DropTargets-module_dropTarget__3mmox","dropIndicator":"DropTargets-module_dropIndicator__2zu4d","isOver":"DropTargets-module_isOver__2usWn"};
2183
+
2184
+ function DropTargets$1(_ref) {
2185
+ var contentElementId = _ref.contentElementId;
2186
+ var editor = useSlate();
2187
+
2188
+ var _useState = useState(),
2189
+ _useState2 = _slicedToArray(_useState, 2),
2190
+ targets = _useState2[0],
2191
+ setTargets = _useState2[1];
2192
+
2193
+ var containerRef = useRef();
2194
+ useEffect(function () {
2195
+ if (!targets) {
2196
+ setTargets(measureHeights(editor, containerRef.current));
2197
+ }
2198
+ }, [targets, editor]);
2199
+ return (
2200
+ /*#__PURE__*/
2201
+ React.createElement("div", {
2202
+ ref: containerRef,
2203
+ className: styles$8.container
2204
+ }, renderDropTargets(targets || [], contentElementId))
2205
+ );
2206
+ }
2207
+
2208
+ function renderDropTargets(targets, contentElementId) {
2209
+ function handleDrop(itemId, index) {
2210
+ if (index === 0) {
2211
+ postMoveContentElementMessage({
2212
+ id: itemId,
2213
+ to: {
2214
+ at: 'before',
2215
+ id: contentElementId
2216
+ }
2217
+ });
2218
+ } else if (index === targets.length - 1) {
2219
+ postMoveContentElementMessage({
2220
+ id: itemId,
2221
+ to: {
2222
+ at: 'after',
2223
+ id: contentElementId
2224
+ }
2225
+ });
2226
+ } else {
2227
+ postMoveContentElementMessage({
2228
+ id: itemId,
2229
+ to: {
2230
+ at: 'split',
2231
+ id: contentElementId,
2232
+ splitPoint: index
2233
+ }
2234
+ });
2235
+ }
2236
+ }
2237
+
2238
+ return targets.map(function (target, index) {
2239
+ return (
2240
+ /*#__PURE__*/
2241
+ React.createElement(DropTarget, Object.assign({}, target, {
2242
+ key: index,
2243
+ onDrop: function onDrop(itemId) {
2244
+ return handleDrop(itemId, index);
2245
+ }
2246
+ }))
2247
+ );
2248
+ });
2249
+ }
2250
+
2251
+ function DropTarget(_ref2) {
2252
+ var top = _ref2.top,
2253
+ height = _ref2.height,
2254
+ indicatorTop = _ref2.indicatorTop,
2255
+ onDrop = _ref2.onDrop;
2256
+
2257
+ var _useDrop = useDrop({
2258
+ accept: 'contentElement',
2259
+ collect: function collect(monitor) {
2260
+ return {
2261
+ isOver: monitor.isOver()
2262
+ };
2263
+ },
2264
+ drop: function drop(item) {
2265
+ return onDrop(item.id);
2266
+ }
2267
+ }),
2268
+ _useDrop2 = _slicedToArray(_useDrop, 2),
2269
+ isOver = _useDrop2[0].isOver,
2270
+ drop = _useDrop2[1];
2271
+
2272
+ return (
2273
+ /*#__PURE__*/
2274
+ React.createElement("div", {
2275
+ ref: drop,
2276
+ className: classNames(styles$8.dropTarget, _defineProperty({}, styles$8.isOver, isOver)),
2277
+ style: {
2278
+ top: top,
2279
+ height: height
2280
+ }
2281
+ },
2282
+ /*#__PURE__*/
2283
+ React.createElement("div", {
2284
+ className: styles$8.dropIndicator,
2285
+ style: {
2286
+ top: indicatorTop
2287
+ }
2288
+ }))
2289
+ );
2290
+ }
2291
+
2292
+ function measureHeights(editor, container) {
2293
+ var containerRect = container.getBoundingClientRect();
2294
+ var lastTargetDimensions = {
2295
+ top: 0,
2296
+ height: 0
2297
+ };
2298
+ var lastRectBottom = 0;
2299
+ var targetDimensions = editor.children.map(function (child, index) {
2300
+ var node = Node.get(editor, [index]);
2301
+ var domNode = ReactEditor.toDOMNode(editor, node);
2302
+ var rect = domNode.getBoundingClientRect();
2303
+ var top = lastTargetDimensions.top + lastTargetDimensions.height;
2304
+ var bottom = rect.top + rect.height / 2 - containerRect.top;
2305
+ var targetDimensions = {
2306
+ top: top,
2307
+ height: bottom - top,
2308
+ indicatorTop: index > 0 ? lastRectBottom + (rect.top - lastRectBottom) / 2 - containerRect.top - top : 0
2309
+ };
2310
+ lastRectBottom = rect.bottom;
2311
+ lastTargetDimensions = targetDimensions;
2312
+ return targetDimensions;
2313
+ });
2314
+ return [].concat(_toConsumableArray(targetDimensions), [{
2315
+ top: lastTargetDimensions.top + lastTargetDimensions.height,
2316
+ height: containerRect.height - (lastTargetDimensions.top + lastTargetDimensions.height),
2317
+ indicatorTop: containerRect.height - (lastTargetDimensions.top + lastTargetDimensions.height)
2318
+ }]);
2319
+ }
2320
+
1914
2321
  var EditableText = React.memo(function EditableText(_ref) {
1915
2322
  var value = _ref.value,
1916
2323
  contentElementId = _ref.contentElementId,
@@ -1948,6 +2355,12 @@ var EditableText = React.memo(function EditableText(_ref) {
1948
2355
  });
1949
2356
  }
1950
2357
  });
2358
+
2359
+ var _useDropTargetsActive = useDropTargetsActive(),
2360
+ _useDropTargetsActive2 = _slicedToArray(_useDropTargetsActive, 2),
2361
+ dropTargetsActive = _useDropTargetsActive2[0],
2362
+ ref = _useDropTargetsActive2[1];
2363
+
1951
2364
  var decorate = useCallback(function (nodeEntry) {
1952
2365
  return decorateLinkSelection(nodeEntry, linkSelection);
1953
2366
  }, [linkSelection]); // Ensure Slate rerenders when decorations change
@@ -1964,7 +2377,8 @@ var EditableText = React.memo(function EditableText(_ref) {
1964
2377
  },
1965
2378
  /*#__PURE__*/
1966
2379
  React.createElement("div", {
1967
- className: styles$6.container
2380
+ className: styles$7.container,
2381
+ ref: ref
1968
2382
  },
1969
2383
  /*#__PURE__*/
1970
2384
  React.createElement(Slate, {
@@ -1979,6 +2393,10 @@ var EditableText = React.memo(function EditableText(_ref) {
1979
2393
  /*#__PURE__*/
1980
2394
  React.createElement(Selection, {
1981
2395
  contentElementId: contentElementId
2396
+ }), dropTargetsActive &&
2397
+ /*#__PURE__*/
2398
+ React.createElement(DropTargets$1, {
2399
+ contentElementId: contentElementId
1982
2400
  }),
1983
2401
  /*#__PURE__*/
1984
2402
  React.createElement(HoveringToolbar, {