@atlaskit/editor-common 74.44.1 → 74.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/icons/shared/table.js +24 -7
  3. package/dist/cjs/mark/commands.js +21 -26
  4. package/dist/cjs/media-single/constants.js +3 -1
  5. package/dist/cjs/media-single/index.js +6 -0
  6. package/dist/cjs/monitoring/error.js +1 -1
  7. package/dist/cjs/quick-insert/assets/list-number.js +18 -6
  8. package/dist/cjs/quick-insert/assets/list.js +21 -10
  9. package/dist/cjs/quick-insert/assets/quote.js +15 -3
  10. package/dist/cjs/quick-insert/assets/status.js +55 -16
  11. package/dist/cjs/selection/index.js +36 -0
  12. package/dist/cjs/selection/utils.js +46 -1
  13. package/dist/cjs/styles/shared/media-single.js +1 -2
  14. package/dist/cjs/ui/DropList/index.js +1 -1
  15. package/dist/cjs/ui/MediaSingle/styled.js +1 -8
  16. package/dist/cjs/utils/index.js +150 -0
  17. package/dist/cjs/utils/rich-media-utils.js +3 -6
  18. package/dist/cjs/version.json +1 -1
  19. package/dist/es2019/icons/shared/table.js +25 -7
  20. package/dist/es2019/mark/commands.js +21 -28
  21. package/dist/es2019/mark/index.js +1 -1
  22. package/dist/es2019/media-single/constants.js +1 -0
  23. package/dist/es2019/media-single/index.js +1 -1
  24. package/dist/es2019/monitoring/error.js +1 -1
  25. package/dist/es2019/quick-insert/assets/list-number.js +19 -6
  26. package/dist/es2019/quick-insert/assets/list.js +22 -9
  27. package/dist/es2019/quick-insert/assets/quote.js +16 -3
  28. package/dist/es2019/quick-insert/assets/status.js +56 -15
  29. package/dist/es2019/selection/index.js +1 -1
  30. package/dist/es2019/selection/utils.js +52 -1
  31. package/dist/es2019/styles/shared/media-single.js +3 -4
  32. package/dist/es2019/ui/DropList/index.js +1 -1
  33. package/dist/es2019/ui/MediaSingle/styled.js +1 -11
  34. package/dist/es2019/utils/index.js +139 -1
  35. package/dist/es2019/utils/rich-media-utils.js +3 -6
  36. package/dist/es2019/version.json +1 -1
  37. package/dist/esm/icons/shared/table.js +24 -7
  38. package/dist/esm/mark/commands.js +21 -26
  39. package/dist/esm/mark/index.js +1 -1
  40. package/dist/esm/media-single/constants.js +1 -0
  41. package/dist/esm/media-single/index.js +1 -1
  42. package/dist/esm/monitoring/error.js +1 -1
  43. package/dist/esm/quick-insert/assets/list-number.js +18 -6
  44. package/dist/esm/quick-insert/assets/list.js +21 -9
  45. package/dist/esm/quick-insert/assets/quote.js +15 -3
  46. package/dist/esm/quick-insert/assets/status.js +55 -15
  47. package/dist/esm/selection/index.js +1 -1
  48. package/dist/esm/selection/utils.js +40 -1
  49. package/dist/esm/styles/shared/media-single.js +1 -2
  50. package/dist/esm/ui/DropList/index.js +1 -1
  51. package/dist/esm/ui/MediaSingle/styled.js +1 -8
  52. package/dist/esm/utils/index.js +141 -1
  53. package/dist/esm/utils/rich-media-utils.js +3 -6
  54. package/dist/esm/version.json +1 -1
  55. package/dist/types/collab/index.d.ts +4 -1
  56. package/dist/types/mark/commands.d.ts +4 -4
  57. package/dist/types/mark/index.d.ts +1 -1
  58. package/dist/types/media-single/constants.d.ts +1 -0
  59. package/dist/types/media-single/index.d.ts +1 -1
  60. package/dist/types/selection/index.d.ts +1 -1
  61. package/dist/types/selection/utils.d.ts +9 -2
  62. package/dist/types/utils/index.d.ts +17 -0
  63. package/dist/types/utils/input-rules.d.ts +3 -2
  64. package/dist/types/utils/rich-media-utils.d.ts +4 -4
  65. package/dist/types-ts4.5/collab/index.d.ts +4 -1
  66. package/dist/types-ts4.5/mark/commands.d.ts +4 -4
  67. package/dist/types-ts4.5/mark/index.d.ts +1 -1
  68. package/dist/types-ts4.5/media-single/constants.d.ts +1 -0
  69. package/dist/types-ts4.5/media-single/index.d.ts +1 -1
  70. package/dist/types-ts4.5/selection/index.d.ts +1 -1
  71. package/dist/types-ts4.5/selection/utils.d.ts +9 -2
  72. package/dist/types-ts4.5/utils/index.d.ts +17 -0
  73. package/dist/types-ts4.5/utils/input-rules.d.ts +3 -2
  74. package/dist/types-ts4.5/utils/rich-media-utils.d.ts +4 -4
  75. package/package.json +1 -1
@@ -7,10 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.richMediaClassName = exports.mediaSingleSharedStyle = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _react = require("@emotion/react");
10
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
10
  var _templateObject;
12
11
  var richMediaClassName = 'rich-media-item';
13
12
  exports.richMediaClassName = richMediaClassName;
14
13
  var wrappedMediaBreakoutPoint = 410;
15
- var mediaSingleSharedStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n li .", " {\n margin: 0;\n }\n\n /* Hack for chrome to fix media single position\n inside a list when media is the first child */\n &.ua-chrome li > .mediaSingleView-content-wrap::before {\n content: '';\n display: block;\n height: 0;\n }\n\n &.ua-firefox {\n .mediaSingleView-content-wrap {\n user-select: none;\n }\n\n .captionView-content-wrap {\n user-select: text;\n }\n }\n\n .mediaSingleView-content-wrap[layout='center'] {\n clear: both;\n }\n\n table .", " {\n margin-top: ", ";\n margin-bottom: ", ";\n clear: both;\n\n &.image-wrap-left,\n &.image-wrap-right {\n clear: none;\n\n &:first-child {\n margin-top: ", ";\n }\n }\n }\n\n .", ".image-wrap-right\n + .", ".image-wrap-left {\n clear: both;\n }\n\n .", ".image-wrap-left\n + .", ".image-wrap-right,\n .", ".image-wrap-right\n + .", ".image-wrap-left,\n .", ".image-wrap-left\n + .", ".image-wrap-left,\n .", ".image-wrap-right\n + .", ".image-wrap-right {\n margin-right: 0;\n margin-left: 0;\n }\n\n ", "\n"])), richMediaClassName, richMediaClassName, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') && "@media all and (max-width: ".concat(wrappedMediaBreakoutPoint, "px) {\n div.mediaSingleView-content-wrap[layout='wrap-left'],\n div.mediaSingleView-content-wrap[data-layout='wrap-left'],\n div.mediaSingleView-content-wrap[layout='wrap-right'],\n div.mediaSingleView-content-wrap[data-layout='wrap-right'] {\n float: none;\n overflow: auto;\n margin: 12px 0;\n }\n }"));
14
+ var mediaSingleSharedStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n li .", " {\n margin: 0;\n }\n\n /* Hack for chrome to fix media single position\n inside a list when media is the first child */\n &.ua-chrome li > .mediaSingleView-content-wrap::before {\n content: '';\n display: block;\n height: 0;\n }\n\n &.ua-firefox {\n .mediaSingleView-content-wrap {\n user-select: none;\n }\n\n .captionView-content-wrap {\n user-select: text;\n }\n }\n\n .mediaSingleView-content-wrap[layout='center'] {\n clear: both;\n }\n\n table .", " {\n margin-top: ", ";\n margin-bottom: ", ";\n clear: both;\n\n &.image-wrap-left,\n &.image-wrap-right {\n clear: none;\n\n &:first-child {\n margin-top: ", ";\n }\n }\n }\n\n .", ".image-wrap-right\n + .", ".image-wrap-left {\n clear: both;\n }\n\n .", ".image-wrap-left\n + .", ".image-wrap-right,\n .", ".image-wrap-right\n + .", ".image-wrap-left,\n .", ".image-wrap-left\n + .", ".image-wrap-left,\n .", ".image-wrap-right\n + .", ".image-wrap-right {\n margin-right: 0;\n margin-left: 0;\n }\n\n @media all and (max-width: ", "px) {\n div.mediaSingleView-content-wrap[layout='wrap-left'],\n div.mediaSingleView-content-wrap[data-layout='wrap-left'],\n div.mediaSingleView-content-wrap[layout='wrap-right'],\n div.mediaSingleView-content-wrap[data-layout='wrap-right'] {\n float: none;\n overflow: auto;\n margin: ", " 0;\n }\n }\n"])), richMediaClassName, richMediaClassName, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, wrappedMediaBreakoutPoint, "var(--ds-space-150, 12px)");
16
15
  exports.mediaSingleSharedStyle = mediaSingleSharedStyle;
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
24
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
25
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "74.44.1";
27
+ var packageVersion = "74.45.1";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -13,7 +13,6 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
13
13
  var _react = _interopRequireDefault(require("react"));
14
14
  var _react2 = require("@emotion/react");
15
15
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
16
- var _mediaSingle = require("../../media-single");
17
16
  var _utils = require("../../utils");
18
17
  var _breakout = require("../../utils/breakout");
19
18
  var _excluded = ["children"];
@@ -89,12 +88,6 @@ function calcMaxWidth(layout, containerWidth) {
89
88
  return '100%';
90
89
  }
91
90
  }
92
- var getEffectiveFullWidth = function getEffectiveFullWidth(containerWidth, fullWidthMode) {
93
- if (fullWidthMode) {
94
- return '100%';
95
- }
96
- return "".concat((0, _mediaSingle.calcMediaSingleMaxWidth)(containerWidth), "px");
97
- };
98
91
  function calcMargin(layout) {
99
92
  switch (layout) {
100
93
  case 'wrap-right':
@@ -131,7 +124,7 @@ var MediaSingleDimensionHelper = function MediaSingleDimensionHelper(_ref) {
131
124
  isExtendedResizeExperienceOn = _ref.isExtendedResizeExperienceOn,
132
125
  _ref$isNestedNode = _ref.isNestedNode,
133
126
  isNestedNode = _ref$isNestedNode === void 0 ? false : _ref$isNestedNode;
134
- return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n\n ", "\n\n &[class*='not-resizing'] {\n ", "\n }\n\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), isExtendedResizeExperienceOn && "&[class*='is-resizing'] {\n .new-file-experience-wrapper {\n box-shadow: none !important;\n }\n\n ".concat(!isNestedNode && _utils.nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);", "\n }"), !isNestedNode && "".concat(_utils.nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);", "\n\n // override min-width to counteract max-width set by ResizerNext inline style\n ").concat(layout === 'full-width' && "min-width: ".concat(getEffectiveFullWidth(containerWidth, fullWidthMode), " !important;"), ";"), float(layout), calcMargin(layout), isImageAligned(layout));
127
+ return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n\n ", "\n\n &[class*='not-resizing'] {\n ", "\n }\n\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), isExtendedResizeExperienceOn && "&[class*='is-resizing'] {\n .new-file-experience-wrapper {\n box-shadow: none !important;\n }\n\n ".concat(!isNestedNode && _utils.nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);", "\n }"), !isNestedNode && "".concat(_utils.nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);"), float(layout), calcMargin(layout), isImageAligned(layout));
135
128
  };
136
129
  exports.MediaSingleDimensionHelper = MediaSingleDimensionHelper;
137
130
  var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
@@ -184,6 +184,7 @@ Object.defineProperty(exports, "canRenderDatasource", {
184
184
  return _datasource.canRenderDatasource;
185
185
  }
186
186
  });
187
+ exports.checkNodeDown = checkNodeDown;
187
188
  Object.defineProperty(exports, "clearMeasure", {
188
189
  enumerable: true,
189
190
  get: function get() {
@@ -292,6 +293,7 @@ Object.defineProperty(exports, "findChangedNodesFromTransaction", {
292
293
  return _nodes.findChangedNodesFromTransaction;
293
294
  }
294
295
  });
296
+ exports.findFarthestParentNode = void 0;
295
297
  Object.defineProperty(exports, "findFilepaths", {
296
298
  enumerable: true,
297
299
  get: function get() {
@@ -496,6 +498,7 @@ Object.defineProperty(exports, "insertNewLineWithAnalytics", {
496
498
  return _commands.insertNewLineWithAnalytics;
497
499
  }
498
500
  });
501
+ exports.insideTableCell = void 0;
499
502
  Object.defineProperty(exports, "isBulletList", {
500
503
  enumerable: true,
501
504
  get: function get() {
@@ -514,6 +517,7 @@ Object.defineProperty(exports, "isEmptyDocument", {
514
517
  return _document.isEmptyDocument;
515
518
  }
516
519
  });
520
+ exports.isEmptyNode = void 0;
517
521
  Object.defineProperty(exports, "isEmptyParagraph", {
518
522
  enumerable: true,
519
523
  get: function get() {
@@ -544,6 +548,7 @@ Object.defineProperty(exports, "isInLayoutColumn", {
544
548
  return _editorCoreUtils.isInLayoutColumn;
545
549
  }
546
550
  });
551
+ exports.isInListItem = void 0;
547
552
  Object.defineProperty(exports, "isLastItemMediaGroup", {
548
553
  enumerable: true,
549
554
  get: function get() {
@@ -586,6 +591,7 @@ Object.defineProperty(exports, "isNodeBeforeMediaNode", {
586
591
  return _nodes.isNodeBeforeMediaNode;
587
592
  }
588
593
  });
594
+ exports.isNodeEmpty = isNodeEmpty;
589
595
  Object.defineProperty(exports, "isNodeSelectedOrInRange", {
590
596
  enumerable: true,
591
597
  get: function get() {
@@ -640,6 +646,7 @@ Object.defineProperty(exports, "isRichMediaInsideOfBlockNode", {
640
646
  return _richMediaUtils.isRichMediaInsideOfBlockNode;
641
647
  }
642
648
  });
649
+ exports.isSelectionInsideLastNodeInDocument = isSelectionInsideLastNodeInDocument;
643
650
  Object.defineProperty(exports, "isSupportedInParent", {
644
651
  enumerable: true,
645
652
  get: function get() {
@@ -948,6 +955,7 @@ Object.defineProperty(exports, "withImageLoader", {
948
955
  return _imageLoader.withImageLoader;
949
956
  }
950
957
  });
958
+ var _utils = require("@atlaskit/editor-prosemirror/utils");
951
959
  var _annotation = require("./annotation");
952
960
  var _macro = require("./macro");
953
961
  var _browser = _interopRequireDefault(require("./browser"));
@@ -1005,4 +1013,146 @@ function shallowEqual() {
1005
1013
  return keys1.length === keys2.length && keys1.reduce(function (acc, key) {
1006
1014
  return acc && obj1[key] === obj2[key];
1007
1015
  }, true);
1016
+ }
1017
+ function isSelectionInsideLastNodeInDocument(selection) {
1018
+ var docNode = selection.$anchor.node(0);
1019
+ var rootNode = selection.$anchor.node(1);
1020
+ return docNode.lastChild === rootNode;
1021
+ }
1022
+ var isInListItem = function isInListItem(state) {
1023
+ return (0, _utils.hasParentNodeOfType)(state.schema.nodes.listItem)(state.selection);
1024
+ };
1025
+
1026
+ /**
1027
+ * Find the farthest node given a condition
1028
+ * @param predicate Function to check the node
1029
+ */
1030
+ exports.isInListItem = isInListItem;
1031
+ var findFarthestParentNode = function findFarthestParentNode(predicate) {
1032
+ return function ($pos) {
1033
+ var candidate = null;
1034
+ for (var i = $pos.depth; i > 0; i--) {
1035
+ var _node = $pos.node(i);
1036
+ if (predicate(_node)) {
1037
+ candidate = {
1038
+ pos: i > 0 ? $pos.before(i) : 0,
1039
+ start: $pos.start(i),
1040
+ depth: i,
1041
+ node: _node
1042
+ };
1043
+ }
1044
+ }
1045
+ return candidate;
1046
+ };
1047
+ };
1048
+ exports.findFarthestParentNode = findFarthestParentNode;
1049
+ var insideTableCell = function insideTableCell(state) {
1050
+ var _state$schema$nodes = state.schema.nodes,
1051
+ tableCell = _state$schema$nodes.tableCell,
1052
+ tableHeader = _state$schema$nodes.tableHeader;
1053
+ return (0, _utils.hasParentNodeOfType)([tableCell, tableHeader])(state.selection);
1054
+ };
1055
+
1056
+ /**
1057
+ * Traverse the document until an "ancestor" is found. Any nestable block can be an ancestor.
1058
+ */
1059
+ exports.insideTableCell = insideTableCell;
1060
+ function findAncestorPosition(doc, pos) {
1061
+ var nestableBlocks = ['blockquote', 'bulletList', 'orderedList'];
1062
+ if (pos.depth === 1) {
1063
+ return pos;
1064
+ }
1065
+ var node = pos.node(pos.depth);
1066
+ var newPos = pos;
1067
+ while (pos.depth >= 1) {
1068
+ pos = doc.resolve(pos.before(pos.depth));
1069
+ node = pos.node(pos.depth);
1070
+ if (node && nestableBlocks.indexOf(node.type.name) !== -1) {
1071
+ newPos = pos;
1072
+ }
1073
+ }
1074
+ return newPos;
1075
+ }
1076
+ function checkNodeDown(selection, doc, filter) {
1077
+ var ancestorDepth = findAncestorPosition(doc, selection.$to).depth;
1078
+
1079
+ // Top level node
1080
+ if (ancestorDepth === 0) {
1081
+ return false;
1082
+ }
1083
+ var res = doc.resolve(selection.$to.after(ancestorDepth));
1084
+ return res.nodeAfter ? filter(res.nodeAfter) : false;
1085
+ }
1086
+ var isEmptyNode = function isEmptyNode(schema) {
1087
+ var _schema$nodes = schema.nodes,
1088
+ doc = _schema$nodes.doc,
1089
+ paragraph = _schema$nodes.paragraph,
1090
+ codeBlock = _schema$nodes.codeBlock,
1091
+ blockquote = _schema$nodes.blockquote,
1092
+ panel = _schema$nodes.panel,
1093
+ heading = _schema$nodes.heading,
1094
+ listItem = _schema$nodes.listItem,
1095
+ bulletList = _schema$nodes.bulletList,
1096
+ orderedList = _schema$nodes.orderedList,
1097
+ taskList = _schema$nodes.taskList,
1098
+ taskItem = _schema$nodes.taskItem,
1099
+ decisionList = _schema$nodes.decisionList,
1100
+ decisionItem = _schema$nodes.decisionItem,
1101
+ media = _schema$nodes.media,
1102
+ mediaGroup = _schema$nodes.mediaGroup,
1103
+ mediaSingle = _schema$nodes.mediaSingle;
1104
+ var innerIsEmptyNode = function innerIsEmptyNode(node) {
1105
+ switch (node.type) {
1106
+ case media:
1107
+ case mediaGroup:
1108
+ case mediaSingle:
1109
+ return false;
1110
+ case paragraph:
1111
+ case codeBlock:
1112
+ case heading:
1113
+ case taskItem:
1114
+ case decisionItem:
1115
+ return node.content.size === 0;
1116
+ case blockquote:
1117
+ case panel:
1118
+ case listItem:
1119
+ return node.content.size === 2 && innerIsEmptyNode(node.content.firstChild);
1120
+ case bulletList:
1121
+ case orderedList:
1122
+ return node.content.size === 4 && innerIsEmptyNode(node.content.firstChild);
1123
+ case taskList:
1124
+ case decisionList:
1125
+ return node.content.size === 2 && innerIsEmptyNode(node.content.firstChild);
1126
+ case doc:
1127
+ var isEmpty = true;
1128
+ node.content.forEach(function (child) {
1129
+ isEmpty = isEmpty && innerIsEmptyNode(child);
1130
+ });
1131
+ return isEmpty;
1132
+ default:
1133
+ return isNodeEmpty(node);
1134
+ }
1135
+ };
1136
+ return innerIsEmptyNode;
1137
+ };
1138
+
1139
+ /**
1140
+ * Checks if a node has any content. Ignores node that only contain empty block nodes.
1141
+ */
1142
+ exports.isEmptyNode = isEmptyNode;
1143
+ function isNodeEmpty(node) {
1144
+ if (node && node.textContent) {
1145
+ return false;
1146
+ }
1147
+ if (!node || !node.childCount || node.childCount === 1 && (0, _editorCoreUtils.isEmptyParagraph)(node.firstChild)) {
1148
+ return true;
1149
+ }
1150
+ var block = [];
1151
+ var nonBlock = [];
1152
+ node.forEach(function (child) {
1153
+ child.isInline ? nonBlock.push(child) : block.push(child);
1154
+ });
1155
+ return !nonBlock.length && !block.filter(function (childNode) {
1156
+ return !!childNode.childCount && !(childNode.childCount === 1 && (0, _editorCoreUtils.isEmptyParagraph)(childNode.firstChild)) || childNode.isAtom;
1157
+ }).length;
1008
1158
  }
@@ -21,7 +21,7 @@ var nonWrappedLayouts = ['center', 'wide', 'full-width'];
21
21
  exports.nonWrappedLayouts = nonWrappedLayouts;
22
22
  var floatingLayouts = ['wrap-left', 'wrap-right'];
23
23
  exports.floatingLayouts = floatingLayouts;
24
- var isRichMediaInsideOfBlockNode = function isRichMediaInsideOfBlockNode(view, pos, includeMoreParentNodeTypes) {
24
+ var isRichMediaInsideOfBlockNode = function isRichMediaInsideOfBlockNode(view, pos) {
25
25
  if (typeof pos !== 'number' || isNaN(pos) || !view) {
26
26
  return false;
27
27
  }
@@ -29,11 +29,8 @@ var isRichMediaInsideOfBlockNode = function isRichMediaInsideOfBlockNode(view, p
29
29
  var _view$state$schema$no = view.state.schema.nodes,
30
30
  expand = _view$state$schema$no.expand,
31
31
  nestedExpand = _view$state$schema$no.nestedExpand,
32
- layoutColumn = _view$state$schema$no.layoutColumn,
33
- tableCell = _view$state$schema$no.tableCell,
34
- listItem = _view$state$schema$no.listItem;
35
- var parentNodeTypes = [expand, nestedExpand, layoutColumn];
36
- return !!(0, _utils.findParentNodeOfTypeClosestToPos)($pos, includeMoreParentNodeTypes ? [].concat(parentNodeTypes, [tableCell, listItem]) : parentNodeTypes);
32
+ layoutColumn = _view$state$schema$no.layoutColumn;
33
+ return !!(0, _utils.findParentNodeOfTypeClosestToPos)($pos, [expand, nestedExpand, layoutColumn]);
37
34
  };
38
35
  exports.isRichMediaInsideOfBlockNode = isRichMediaInsideOfBlockNode;
39
36
  var alignAttributes = function alignAttributes(layout, oldAttrs) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.44.1",
3
+ "version": "74.45.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,18 @@
1
1
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
2
  import React from 'react';
3
+ import { useIconThemed } from '../../quick-insert/use-icon-themed';
3
4
  export default function IconTable() {
5
+ const {
6
+ iconThemed
7
+ } = useIconThemed();
8
+ const cellBackgroundColour = iconThemed({
9
+ light: '#FFF',
10
+ dark: '#1D2125'
11
+ });
12
+ const headerBackgroundColour = iconThemed({
13
+ light: '#DFE1E6',
14
+ dark: '#5A6977'
15
+ });
4
16
  return /*#__PURE__*/React.createElement("svg", {
5
17
  focusable: "false",
6
18
  "aria-hidden": true,
@@ -10,24 +22,30 @@ export default function IconTable() {
10
22
  fill: "none",
11
23
  fillRule: "evenodd"
12
24
  }, /*#__PURE__*/React.createElement("path", {
13
- fill: "#FFF",
25
+ fill: iconThemed({
26
+ light: '#FFF',
27
+ dark: '#161A1D'
28
+ }),
14
29
  d: "M0 0h40v40H0z"
15
30
  }), /*#__PURE__*/React.createElement("g", {
16
- stroke: "#C1C7D0"
31
+ stroke: iconThemed({
32
+ light: '#C1C7D0',
33
+ dark: '#454F59'
34
+ })
17
35
  }, /*#__PURE__*/React.createElement("path", {
18
- fill: "#FFF",
36
+ fill: cellBackgroundColour,
19
37
  d: "M20 16h14v8H20z"
20
38
  }), /*#__PURE__*/React.createElement("path", {
21
39
  d: "M20 8h13a1 1 0 011 1v7H20V8z",
22
- fill: "#DFE1E6"
40
+ fill: headerBackgroundColour
23
41
  }), /*#__PURE__*/React.createElement("path", {
24
42
  d: "M20 24h14v7a1 1 0 01-1 1H20v-8zM6 16h14v8H6z",
25
- fill: "#FFF"
43
+ fill: cellBackgroundColour
26
44
  }), /*#__PURE__*/React.createElement("path", {
27
45
  d: "M7 8h13v8H6V9a1 1 0 011-1z",
28
- fill: "#DFE1E6"
46
+ fill: headerBackgroundColour
29
47
  }), /*#__PURE__*/React.createElement("path", {
30
48
  d: "M6 24h14v8H7a1 1 0 01-1-1v-7z",
31
- fill: "#FFF"
49
+ fill: cellBackgroundColour
32
50
  }))));
33
51
  }
@@ -132,21 +132,20 @@ const entireSelectionContainsMark = (mark, doc, fromPos, toPos) => {
132
132
  });
133
133
  return onlyContainsMark;
134
134
  };
135
- const toggleMarkInRange = mark => (state, dispatch) => {
136
- const {
137
- tr
138
- } = state;
139
- if (state.selection instanceof CellSelection) {
135
+ const toggleMarkInRange = mark => ({
136
+ tr
137
+ }) => {
138
+ if (tr.selection instanceof CellSelection) {
140
139
  let removeMark = true;
141
140
  const cells = [];
142
- state.selection.forEachCell((cell, cellPos) => {
141
+ tr.selection.forEachCell((cell, cellPos) => {
143
142
  cells.push({
144
143
  node: cell,
145
144
  pos: cellPos
146
145
  });
147
146
  const from = cellPos;
148
147
  const to = cellPos + cell.nodeSize;
149
- removeMark && (removeMark = entireSelectionContainsMark(mark, state.doc, from, to));
148
+ removeMark && (removeMark = entireSelectionContainsMark(mark, tr.doc, from, to));
150
149
  });
151
150
  for (let i = cells.length - 1; i >= 0; i--) {
152
151
  const cell = cells[i];
@@ -158,48 +157,42 @@ const toggleMarkInRange = mark => (state, dispatch) => {
158
157
  const {
159
158
  $from,
160
159
  $to
161
- } = state.selection;
160
+ } = tr.selection;
162
161
  // We decide to remove the mark only if the entire selection contains the mark
163
162
  // Examples with *bold* text
164
163
  // Scenario 1: Selection contains both bold and non-bold text -> bold entire selection
165
164
  // Scenario 2: Selection contains only bold text -> un-bold entire selection
166
165
  // Scenario 3: Selection contains no bold text -> bold entire selection
167
- const removeMark = entireSelectionContainsMark(mark, state.doc, $from.pos, $to.pos);
166
+ const removeMark = entireSelectionContainsMark(mark, tr.doc, $from.pos, $to.pos);
168
167
  applyMarkOnRange($from.pos, $to.pos, removeMark, mark, tr);
169
168
  }
170
169
  if (tr.docChanged) {
171
- if (dispatch) {
172
- dispatch(tr);
173
- }
174
- return true;
170
+ return tr;
175
171
  }
176
- return false;
172
+ return null;
177
173
  };
178
174
 
179
175
  /**
180
- * A wrapper over the default toggleMark, except when we have a selection
181
- * we only toggle marks on text nodes rather than inline nodes.
176
+ * A custom version of the ProseMirror toggleMark, where we only toggle marks
177
+ * on text nodes in the selection rather than all inline nodes.
182
178
  * @param markType
183
179
  * @param attrs
184
180
  */
185
- export const toggleMark = (markType, attrs) => (state, dispatch) => {
181
+ export const toggleMark = (markType, attrs) => ({
182
+ tr
183
+ }) => {
186
184
  const mark = markType.create(attrs);
187
185
 
188
186
  // For cursor selections we can use the default behaviour.
189
- if (state.selection instanceof TextSelection && state.selection.$cursor) {
190
- const {
191
- tr
192
- } = state;
193
- if (mark.isInSet(state.storedMarks || state.selection.$cursor.marks())) {
187
+ if (tr.selection instanceof TextSelection && tr.selection.$cursor) {
188
+ if (mark.isInSet(tr.storedMarks || tr.selection.$cursor.marks())) {
194
189
  tr.removeStoredMark(mark);
195
190
  } else {
196
191
  tr.addStoredMark(mark);
197
192
  }
198
- if (dispatch) {
199
- dispatch(tr);
200
- return true;
201
- }
202
- return false;
193
+ return tr;
203
194
  }
204
- return toggleMarkInRange(mark)(state, dispatch);
195
+ return toggleMarkInRange(mark)({
196
+ tr
197
+ });
205
198
  };
@@ -1,2 +1,2 @@
1
- export { transformSmartCharsMentionsAndEmojis, applyMarkOnRange, toggleMark, filterChildrenBetween } from './commands';
1
+ export { transformSmartCharsMentionsAndEmojis, applyMarkOnRange, filterChildrenBetween, toggleMark } from './commands';
2
2
  export { anyMarkActive } from './text-formatting';
@@ -5,6 +5,7 @@ export const MEDIA_SINGLE_HANDLE_MARGIN = 12;
5
5
  export const MEDIA_SINGLE_GUTTER_SIZE = MEDIA_SINGLE_HANDLE_MARGIN * 2;
6
6
  export const DEFAULT_IMAGE_WIDTH = 250;
7
7
  export const DEFAULT_IMAGE_HEIGHT = 200;
8
+ export const MEDIA_SINGLE_RESIZE_THROTTLE_TIME = 100;
8
9
  export let Layout = /*#__PURE__*/function (Layout) {
9
10
  Layout["FULL_WIDTH"] = "full-width";
10
11
  Layout["WIDE"] = "wide";
@@ -1,2 +1,2 @@
1
- export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts } from './constants';
1
+ export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts } from './constants';
2
2
  export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest } from './utils';
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "74.44.1";
3
+ const packageVersion = "74.45.1";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -1,7 +1,14 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
2
1
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
2
  import React from 'react';
3
+ import { useIconThemed } from '../use-icon-themed';
4
4
  export default function IconListOrdered() {
5
+ const {
6
+ iconThemed
7
+ } = useIconThemed();
8
+ const lineColour = iconThemed({
9
+ light: '#C1C7D0',
10
+ dark: '#454F59'
11
+ });
5
12
  return /*#__PURE__*/React.createElement("svg", {
6
13
  focusable: "false",
7
14
  "aria-hidden": true,
@@ -11,33 +18,39 @@ export default function IconListOrdered() {
11
18
  fill: "none",
12
19
  fillRule: "evenodd"
13
20
  }, /*#__PURE__*/React.createElement("path", {
14
- fill: "#FFF",
21
+ fill: iconThemed({
22
+ light: '#FFF',
23
+ dark: '#161A1D'
24
+ }),
15
25
  d: "M0 0h40v40H0z"
16
26
  }), /*#__PURE__*/React.createElement("g", {
17
27
  transform: "translate(9 9)"
18
28
  }, /*#__PURE__*/React.createElement("rect", {
19
- fill: "#C1C7D0",
29
+ fill: lineColour,
20
30
  x: 6,
21
31
  y: 10,
22
32
  width: 17,
23
33
  height: 2,
24
34
  rx: 1
25
35
  }), /*#__PURE__*/React.createElement("rect", {
26
- fill: "#C1C7D0",
36
+ fill: lineColour,
27
37
  x: 6,
28
38
  y: 2,
29
39
  width: 17,
30
40
  height: 2,
31
41
  rx: 1
32
42
  }), /*#__PURE__*/React.createElement("rect", {
33
- fill: "#C1C7D0",
43
+ fill: lineColour,
34
44
  x: 6,
35
45
  y: 18,
36
46
  width: 17,
37
47
  height: 2,
38
48
  rx: 1
39
49
  }), /*#__PURE__*/React.createElement("path", {
40
- fill: "#6C798F",
50
+ fill: iconThemed({
51
+ light: '#6C798F',
52
+ dark: '#5A6977'
53
+ }),
41
54
  d: "M1.159 4.996v-3.58h-.056L0 2.176v-.875L1.162.5H2.1v4.496zM0 9.97C0 9.094.67 8.5 1.648 8.5c.943 0 1.6.542 1.6 1.319 0 .492-.266.915-1.049 1.65l-.864.825v.056h1.98v.786H.052v-.66L1.53 11.03c.636-.62.795-.855.795-1.15 0-.363-.294-.62-.708-.62-.438 0-.739.288-.739.705v.019H0v-.016zm1.172 9.22v-.71h.554c.431 0 .724-.251.724-.623 0-.365-.283-.598-.727-.598-.441 0-.734.249-.76.642H.086c.032-.86.67-1.401 1.663-1.401.932 0 1.603.51 1.603 1.225 0 .526-.33.935-.838 1.04v.056c.624.07 1.014.485 1.014 1.083 0 .797-.75 1.373-1.785 1.373-1.015 0-1.701-.56-1.742-1.417h.91c.028.384.353.627.841.627.475 0 .806-.268.806-.655 0-.397-.312-.643-.822-.643h-.563z"
42
55
  }))));
43
56
  }
@@ -1,7 +1,17 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
2
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
1
  import React from 'react';
2
+ import { useIconThemed } from '../use-icon-themed';
4
3
  export default function IconList() {
4
+ const {
5
+ iconThemed
6
+ } = useIconThemed();
7
+ const dotColour = iconThemed({
8
+ light: '#6C798F',
9
+ dark: '#5A6977'
10
+ });
11
+ const lineColour = iconThemed({
12
+ light: '#C1C7D0',
13
+ dark: '#454F59'
14
+ });
5
15
  return /*#__PURE__*/React.createElement("svg", {
6
16
  focusable: "false",
7
17
  "aria-hidden": true,
@@ -11,44 +21,47 @@ export default function IconList() {
11
21
  fill: "none",
12
22
  fillRule: "evenodd"
13
23
  }, /*#__PURE__*/React.createElement("path", {
14
- fill: "#FFF",
24
+ fill: iconThemed({
25
+ light: '#FFF',
26
+ dark: '#161A1D'
27
+ }),
15
28
  d: "M0 0h40v40H0z"
16
29
  }), /*#__PURE__*/React.createElement("g", {
17
30
  transform: "translate(8 10)"
18
31
  }, /*#__PURE__*/React.createElement("rect", {
19
- fill: "#6C798F",
32
+ fill: dotColour,
20
33
  width: 4,
21
34
  height: 4,
22
35
  rx: 2
23
36
  }), /*#__PURE__*/React.createElement("rect", {
24
- fill: "#C1C7D0",
37
+ fill: lineColour,
25
38
  x: 7,
26
39
  y: 9,
27
40
  width: 17,
28
41
  height: 2,
29
42
  rx: 1
30
43
  }), /*#__PURE__*/React.createElement("rect", {
31
- fill: "#C1C7D0",
44
+ fill: lineColour,
32
45
  x: 7,
33
46
  y: 1,
34
47
  width: 17,
35
48
  height: 2,
36
49
  rx: 1
37
50
  }), /*#__PURE__*/React.createElement("rect", {
38
- fill: "#C1C7D0",
51
+ fill: lineColour,
39
52
  x: 7,
40
53
  y: 17,
41
54
  width: 17,
42
55
  height: 2,
43
56
  rx: 1
44
57
  }), /*#__PURE__*/React.createElement("rect", {
45
- fill: "#6C798F",
58
+ fill: dotColour,
46
59
  y: 8,
47
60
  width: 4,
48
61
  height: 4,
49
62
  rx: 2
50
63
  }), /*#__PURE__*/React.createElement("rect", {
51
- fill: "#6C798F",
64
+ fill: dotColour,
52
65
  y: 16,
53
66
  width: 4,
54
67
  height: 4,
@@ -1,7 +1,11 @@
1
1
  // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
2
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
3
  import React from 'react';
4
+ import { useIconThemed } from '../use-icon-themed';
4
5
  export default function IconQuote() {
6
+ const {
7
+ iconThemed
8
+ } = useIconThemed();
5
9
  return /*#__PURE__*/React.createElement("svg", {
6
10
  focusable: "false",
7
11
  "aria-hidden": true,
@@ -11,10 +15,16 @@ export default function IconQuote() {
11
15
  fill: "none",
12
16
  fillRule: "evenodd"
13
17
  }, /*#__PURE__*/React.createElement("path", {
14
- fill: "#FFF",
18
+ fill: iconThemed({
19
+ light: '#FFF',
20
+ dark: '#161A1D'
21
+ }),
15
22
  d: "M0 0h40v40H0z"
16
23
  }), /*#__PURE__*/React.createElement("rect", {
17
- fill: "#C1C7D0",
24
+ fill: iconThemed({
25
+ light: '#C1C7D0',
26
+ dark: '#454F59'
27
+ }),
18
28
  x: 6,
19
29
  y: 8,
20
30
  width: 2,
@@ -22,6 +32,9 @@ export default function IconQuote() {
22
32
  rx: 1
23
33
  }), /*#__PURE__*/React.createElement("path", {
24
34
  d: "M27.284 12c-1.888 0-3.422 1.577-3.422 3.522 0 1.944 1.534 3.521 3.422 3.521 3.245 0 1.365 6.118-2.727 6.755a.818.818 0 00-.695.806c0 .5.447.896.942.82C32.242 26.296 34.886 12 27.284 12m-9.86 0C15.533 12 14 13.577 14 15.522c0 1.944 1.533 3.521 3.424 3.521 3.243 0 1.363 6.118-2.73 6.755a.818.818 0 00-.694.806c0 .5.447.896.941.82C22.381 26.296 25.026 12 17.424 12",
25
- fill: "#6C798F"
35
+ fill: iconThemed({
36
+ light: '#6C798F',
37
+ dark: '#5A6977'
38
+ })
26
39
  })));
27
40
  }