@atlaskit/editor-core 187.37.4 → 187.37.5

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 (49) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/labs/next/presets/universal.js +2 -1
  3. package/dist/cjs/plugins/index.js +0 -7
  4. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +2 -2
  5. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
  6. package/dist/cjs/ui/ContentStyles/index.js +20 -18
  7. package/dist/cjs/version-wrapper.js +1 -1
  8. package/dist/es2019/labs/next/presets/universal.js +2 -1
  9. package/dist/es2019/plugins/index.js +0 -1
  10. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +2 -2
  11. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -2
  12. package/dist/es2019/ui/ContentStyles/index.js +19 -3
  13. package/dist/es2019/version-wrapper.js +1 -1
  14. package/dist/esm/labs/next/presets/universal.js +2 -1
  15. package/dist/esm/plugins/index.js +0 -1
  16. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +2 -2
  17. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +2 -2
  18. package/dist/esm/ui/ContentStyles/index.js +10 -8
  19. package/dist/esm/version-wrapper.js +1 -1
  20. package/dist/types/plugins/index.d.ts +0 -1
  21. package/dist/types/plugins/insert-block/types.d.ts +1 -1
  22. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  23. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +1 -1
  24. package/package.json +2 -1
  25. package/dist/cjs/plugins/rule/commands.js +0 -22
  26. package/dist/cjs/plugins/rule/index.js +0 -80
  27. package/dist/cjs/plugins/rule/pm-plugins/input-rule.js +0 -76
  28. package/dist/cjs/plugins/rule/pm-plugins/keymap.js +0 -21
  29. package/dist/cjs/plugins/rule/styles.js +0 -16
  30. package/dist/es2019/plugins/rule/commands.js +0 -11
  31. package/dist/es2019/plugins/rule/index.js +0 -71
  32. package/dist/es2019/plugins/rule/pm-plugins/input-rule.js +0 -73
  33. package/dist/es2019/plugins/rule/pm-plugins/keymap.js +0 -11
  34. package/dist/es2019/plugins/rule/styles.js +0 -20
  35. package/dist/esm/plugins/rule/commands.js +0 -15
  36. package/dist/esm/plugins/rule/index.js +0 -72
  37. package/dist/esm/plugins/rule/pm-plugins/input-rule.js +0 -67
  38. package/dist/esm/plugins/rule/pm-plugins/keymap.js +0 -13
  39. package/dist/esm/plugins/rule/styles.js +0 -8
  40. package/dist/types/plugins/rule/commands.d.ts +0 -3
  41. package/dist/types/plugins/rule/index.d.ts +0 -13
  42. package/dist/types/plugins/rule/pm-plugins/input-rule.d.ts +0 -9
  43. package/dist/types/plugins/rule/pm-plugins/keymap.d.ts +0 -5
  44. package/dist/types/plugins/rule/styles.d.ts +0 -2
  45. package/dist/types-ts4.5/plugins/rule/commands.d.ts +0 -3
  46. package/dist/types-ts4.5/plugins/rule/index.d.ts +0 -16
  47. package/dist/types-ts4.5/plugins/rule/pm-plugins/input-rule.d.ts +0 -9
  48. package/dist/types-ts4.5/plugins/rule/pm-plugins/keymap.d.ts +0 -5
  49. package/dist/types-ts4.5/plugins/rule/styles.d.ts +0 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.37.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1f6e908f2bd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1f6e908f2bd) - Workaround invalid getPos error occuring for TableComponent
8
+ - [`94662d7c5af`](https://bitbucket.org/atlassian/atlassian-frontend/commits/94662d7c5af) - Extracted rule plugin from editor-core to editor-plugin-rule.
9
+ - Updated dependencies
10
+
3
11
  ## 187.37.4
4
12
 
5
13
  ### Patch Changes
@@ -9,6 +9,7 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _api = require("../../../selection-api/api");
11
11
  var _plugins = require("../../../plugins");
12
+ var _editorPluginRule = require("@atlaskit/editor-plugin-rule");
12
13
  var _editorPluginEmoji = require("@atlaskit/editor-plugin-emoji");
13
14
  var _editorPluginList = require("@atlaskit/editor-plugin-list");
14
15
  var _editorPluginImageUpload = require("@atlaskit/editor-plugin-image-upload");
@@ -74,7 +75,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
74
75
  return builder;
75
76
  }).add([_editorPluginList.listPlugin, {
76
77
  restartNumberedLists: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedLists
77
- }]).maybeAdd(_plugins.rulePlugin, function (plugin, builder) {
78
+ }]).maybeAdd(_editorPluginRule.rulePlugin, function (plugin, builder) {
78
79
  if (props.allowRule) {
79
80
  return builder.add(plugin);
80
81
  }
@@ -275,12 +275,6 @@ Object.defineProperty(exports, "quickInsertPlugin", {
275
275
  return _quickInsert.default;
276
276
  }
277
277
  });
278
- Object.defineProperty(exports, "rulePlugin", {
279
- enumerable: true,
280
- get: function get() {
281
- return _rule.default;
282
- }
283
- });
284
278
  Object.defineProperty(exports, "saveOnEnterPlugin", {
285
279
  enumerable: true,
286
280
  get: function get() {
@@ -369,7 +363,6 @@ var _panel = _interopRequireDefault(require("./panel"));
369
363
  var _paste = _interopRequireDefault(require("./paste"));
370
364
  var _placeholder = _interopRequireDefault(require("./placeholder"));
371
365
  var _placeholderText = _interopRequireDefault(require("./placeholder-text"));
372
- var _rule = _interopRequireDefault(require("./rule"));
373
366
  var _quickInsert = _interopRequireDefault(require("./quick-insert"));
374
367
  var _saveOnEnter = _interopRequireDefault(require("./save-on-enter"));
375
368
  var _submitEditor = _interopRequireDefault(require("./submit-editor"));
@@ -35,11 +35,11 @@ var isMediaGroupSelectedFromProps = function isMediaGroupSelectedFromProps(props
35
35
  /**
36
36
  * ED-19831
37
37
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
38
- * directly to confluence since this bug is now iun production.
38
+ * directly to confluence since this bug is now in production.
39
39
  */
40
40
  var pos;
41
41
  try {
42
- pos = typeof props.getPos === 'function' ? props.getPos() : undefined;
42
+ pos = props.getPos ? props.getPos() : undefined;
43
43
  } catch (e) {
44
44
  pos = undefined;
45
45
  }
@@ -473,11 +473,11 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
473
473
  /**
474
474
  * ED-19831
475
475
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
476
- * directly to confluence since this bug is now iun production.
476
+ * directly to confluence since this bug is now in production.
477
477
  */
478
478
  var pos;
479
479
  try {
480
- pos = typeof getPos === 'function' ? getPos() : undefined;
480
+ pos = getPos ? getPos() : undefined;
481
481
  } catch (e) {
482
482
  pos = undefined;
483
483
  }
@@ -18,36 +18,38 @@ var _commonStyles = require("@atlaskit/editor-plugin-table/ui/common-styles");
18
18
  var _styles4 = require("../../plugins/placeholder/styles");
19
19
  var _styles5 = require("../../plugins/block-type/styles");
20
20
  var _styles6 = require("../../plugins/code-block/styles");
21
- var _styles7 = require("../../plugins/rule/styles");
22
- var _styles8 = require("../../plugins/media/styles");
23
- var _styles9 = require("../../plugins/layout/styles");
24
- var _styles10 = require("../../plugins/panel/styles");
25
- var _styles11 = require("../../plugins/fake-text-cursor/styles");
26
- var _styles12 = require("../../plugins/placeholder-text/styles");
27
- var _styles13 = require("../../plugins/extension/ui/styles");
28
- var _styles14 = require("../../plugins/expand/ui/styles");
21
+ var _styles7 = require("../../plugins/media/styles");
22
+ var _styles8 = require("../../plugins/layout/styles");
23
+ var _styles9 = require("../../plugins/panel/styles");
24
+ var _styles10 = require("../../plugins/fake-text-cursor/styles");
25
+ var _styles11 = require("../../plugins/placeholder-text/styles");
26
+ var _styles12 = require("../../plugins/extension/ui/styles");
27
+ var _styles13 = require("../../plugins/expand/ui/styles");
29
28
  var _style = require("../../plugins/media/pm-plugins/alt-text/style");
30
- var _styles15 = require("../../plugins/find-replace/styles");
31
- var _styles16 = require("../../plugins/tasks-and-decisions/styles");
32
- var _styles17 = require("../../plugins/status/styles");
33
- var _styles18 = require("../../plugins/date/styles");
29
+ var _styles14 = require("../../plugins/find-replace/styles");
30
+ var _styles15 = require("../../plugins/tasks-and-decisions/styles");
31
+ var _styles16 = require("../../plugins/status/styles");
32
+ var _styles17 = require("../../plugins/date/styles");
34
33
  var _getInlineNodeViewProducer = require("../../nodeviews/getInlineNodeViewProducer.styles");
35
34
  var _utils = require("@atlaskit/editor-common/utils");
36
35
  var _emoji = require("@atlaskit/editor-common/emoji");
37
36
  var _colors = require("@atlaskit/theme/colors");
38
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
37
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
39
38
  /** @jsx jsx */
40
39
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41
40
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
42
41
  var linkStyles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", "\n }\n"])), _styles.linkSharedStyle);
43
42
  exports.linkStyles = linkStyles;
44
- var mentionsStyles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n &.", " [data-mention-id] > span {\n ", "\n\n /* need to specify dark text colour because personal mentions\n (in dark blue) have white text by default */\n color: ", ";\n }\n }\n\n .danger {\n .", ".", "\n > span\n > span\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n background-color: ", ";\n }\n .", " > span > span > span {\n background-color: ", ";\n color: ", ";\n }\n }\n"])), _mention.MentionSharedCssClassName.MENTION_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Background]), "var(--ds-text-subtle, ".concat(_colors.N500, ")"), _mention.MentionSharedCssClassName.MENTION_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder, "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackgroundWithOpacity, ")"), _mention.MentionSharedCssClassName.MENTION_CONTAINER, "var(--ds-background-neutral, ".concat(_colors.N30A, ")"), "var(--ds-text-subtle, ".concat(_colors.N500, ")"));
45
- var listsStyles = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n li {\n position: relative;\n\n > p:not(:first-child) {\n margin: ", " 0 0 0;\n }\n\n // In SSR the above rule will apply to all p tags because first-child would be a style tag.\n // The following rule resets the first p tag back to its original margin\n // defined in packages/editor/editor-common/src/styles/shared/paragraph.ts\n > style:first-child + p {\n margin-top: ", ";\n }\n }\n\n & :not([data-node-type='decisionList']) > li {\n ", "\n }\n }\n"])), "var(--ds-space-050, 4px)", _editorSharedStyles.blockNodesVerticalMargin, _utils.browser.safari ? _styles.codeBlockInListSafariFix : '');
46
- var emojiStyles = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", " {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), _emoji.EmojiSharedCssClassName.EMOJI_CONTAINER, _emoji.EmojiSharedCssClassName.EMOJI_NODE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, _editorSharedStyles.akEditorSelectedNodeClassName, _emoji.EmojiSharedCssClassName.EMOJI_SPRITE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket, _editorSharedStyles.SelectionStyle.BoxShadow]));
43
+ var ruleStyles = function ruleStyles(props) {
44
+ return (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", ";\n\n hr {\n cursor: pointer;\n padding: ", " 0;\n margin: calc(", "em - 4px) 0;\n background-clip: content-box;\n\n &.", " {\n outline: none;\n background-color: ", ";\n }\n }\n }\n"])), (0, _styles.ruleSharedStyles)(props), "var(--ds-space-050, 4px)", _editorSharedStyles.akEditorLineHeight, _editorSharedStyles.akEditorSelectedNodeClassName, "var(--ds-border-selected, ".concat(_editorSharedStyles.akEditorSelectedBorderColor, ")"));
45
+ };
46
+ var mentionsStyles = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n &.", " [data-mention-id] > span {\n ", "\n\n /* need to specify dark text colour because personal mentions\n (in dark blue) have white text by default */\n color: ", ";\n }\n }\n\n .danger {\n .", ".", "\n > span\n > span\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n background-color: ", ";\n }\n .", " > span > span > span {\n background-color: ", ";\n color: ", ";\n }\n }\n"])), _mention.MentionSharedCssClassName.MENTION_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Background]), "var(--ds-text-subtle, ".concat(_colors.N500, ")"), _mention.MentionSharedCssClassName.MENTION_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder, "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackgroundWithOpacity, ")"), _mention.MentionSharedCssClassName.MENTION_CONTAINER, "var(--ds-background-neutral, ".concat(_colors.N30A, ")"), "var(--ds-text-subtle, ".concat(_colors.N500, ")"));
47
+ var listsStyles = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n li {\n position: relative;\n\n > p:not(:first-child) {\n margin: ", " 0 0 0;\n }\n\n // In SSR the above rule will apply to all p tags because first-child would be a style tag.\n // The following rule resets the first p tag back to its original margin\n // defined in packages/editor/editor-common/src/styles/shared/paragraph.ts\n > style:first-child + p {\n margin-top: ", ";\n }\n }\n\n & :not([data-node-type='decisionList']) > li {\n ", "\n }\n }\n"])), "var(--ds-space-050, 4px)", _editorSharedStyles.blockNodesVerticalMargin, _utils.browser.safari ? _styles.codeBlockInListSafariFix : '');
48
+ var emojiStyles = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", " {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), _emoji.EmojiSharedCssClassName.EMOJI_CONTAINER, _emoji.EmojiSharedCssClassName.EMOJI_NODE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, _editorSharedStyles.akEditorSelectedNodeClassName, _emoji.EmojiSharedCssClassName.EMOJI_SPRITE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket, _editorSharedStyles.SelectionStyle.BoxShadow]));
47
49
  var contentStyles = function contentStyles(props) {
48
- return (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
50
+ return (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
49
51
  theme: props.theme
50
- }), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles12.placeholderTextStyles, _styles4.placeholderStyles, (0, _styles6.codeBlockStyles)(props), (0, _styles5.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, (0, _styles7.ruleStyles)(props), _styles8.mediaStyles, (0, _styles9.layoutStyles)(props), _styles2.telepointerStyle, _styles3.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles10.panelStyles)(props), _styles11.fakeCursorStyles, mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles13.extensionStyles, (0, _styles14.expandStyles)(props), _styles15.findReplaceStyles, _styles16.taskDecisionStyles, _styles17.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _styles18.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
52
+ }), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles11.placeholderTextStyles, _styles4.placeholderStyles, (0, _styles6.codeBlockStyles)(props), (0, _styles5.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, ruleStyles(props), _styles7.mediaStyles, (0, _styles8.layoutStyles)(props), _styles2.telepointerStyle, _styles3.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles9.panelStyles)(props), _styles10.fakeCursorStyles, mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles12.extensionStyles, (0, _styles13.expandStyles)(props), _styles14.findReplaceStyles, _styles15.taskDecisionStyles, _styles16.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _styles17.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
51
53
  };
52
54
  var createEditorContentStyle = function createEditorContentStyle(styles) {
53
55
  return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.37.4";
9
+ var version = "187.37.5";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,5 +1,6 @@
1
1
  import { createEditorSelectionAPI } from '../../../selection-api/api';
2
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
2
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
3
+ import { rulePlugin } from '@atlaskit/editor-plugin-rule';
3
4
  import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
4
5
  import { listPlugin } from '@atlaskit/editor-plugin-list';
5
6
  import { imageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
@@ -20,7 +20,6 @@ export { default as panelPlugin } from './panel';
20
20
  export { default as pastePlugin } from './paste';
21
21
  export { default as placeholderPlugin } from './placeholder';
22
22
  export { default as placeholderTextPlugin } from './placeholder-text';
23
- export { default as rulePlugin } from './rule';
24
23
  export { default as quickInsertPlugin } from './quick-insert';
25
24
  export { default as saveOnEnterPlugin } from './save-on-enter';
26
25
  export { default as submitEditorPlugin } from './submit-editor';
@@ -16,11 +16,11 @@ const isMediaGroupSelectedFromProps = props => {
16
16
  /**
17
17
  * ED-19831
18
18
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
19
- * directly to confluence since this bug is now iun production.
19
+ * directly to confluence since this bug is now in production.
20
20
  */
21
21
  let pos;
22
22
  try {
23
- pos = typeof props.getPos === 'function' ? props.getPos() : undefined;
23
+ pos = props.getPos ? props.getPos() : undefined;
24
24
  } catch (e) {
25
25
  pos = undefined;
26
26
  }
@@ -377,11 +377,11 @@ class MediaSingleNodeView extends ReactNodeView {
377
377
  /**
378
378
  * ED-19831
379
379
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
380
- * directly to confluence since this bug is now iun production.
380
+ * directly to confluence since this bug is now in production.
381
381
  */
382
382
  let pos;
383
383
  try {
384
- pos = typeof getPos === 'function' ? getPos() : undefined;
384
+ pos = getPos ? getPos() : undefined;
385
385
  } catch (e) {
386
386
  pos = undefined;
387
387
  }
@@ -2,7 +2,7 @@
2
2
  import React, { useMemo } from 'react';
3
3
  import { jsx, css, useTheme } from '@emotion/react';
4
4
  import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles, gridStyles, smartCardStyles, embedCardStyles, codeBlockInListSafariFix, unsupportedStyles } from '@atlaskit/editor-common/styles';
5
- import { akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackgroundWithOpacity, akEditorSelectedNodeClassName, blockNodesVerticalMargin, editorFontSize, getSelectionStyles, SelectionStyle } from '@atlaskit/editor-shared-styles';
5
+ import { akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackgroundWithOpacity, akEditorSelectedNodeClassName, blockNodesVerticalMargin, editorFontSize, getSelectionStyles, SelectionStyle, akEditorLineHeight, akEditorSelectedBorderColor } from '@atlaskit/editor-shared-styles';
6
6
  import { MentionSharedCssClassName } from '@atlaskit/editor-common/mention';
7
7
  import { telepointerStyle } from '../../plugins/collab-edit/styles';
8
8
  import { gapCursorStyles } from '../../plugins/selection/gap-cursor/styles';
@@ -10,7 +10,6 @@ import { tableStyles } from '@atlaskit/editor-plugin-table/ui/common-styles';
10
10
  import { placeholderStyles } from '../../plugins/placeholder/styles';
11
11
  import { blocktypeStyles } from '../../plugins/block-type/styles';
12
12
  import { codeBlockStyles } from '../../plugins/code-block/styles';
13
- import { ruleStyles } from '../../plugins/rule/styles';
14
13
  import { mediaStyles } from '../../plugins/media/styles';
15
14
  import { layoutStyles } from '../../plugins/layout/styles';
16
15
  import { panelStyles } from '../../plugins/panel/styles';
@@ -24,7 +23,7 @@ import { taskDecisionStyles } from '../../plugins/tasks-and-decisions/styles';
24
23
  import { statusStyles } from '../../plugins/status/styles';
25
24
  import { dateStyles } from '../../plugins/date/styles';
26
25
  import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
27
- import { linkSharedStyle, codeMarkSharedStyles } from '@atlaskit/editor-common/styles';
26
+ import { linkSharedStyle, codeMarkSharedStyles, ruleSharedStyles } from '@atlaskit/editor-common/styles';
28
27
  import { browser } from '@atlaskit/editor-common/utils';
29
28
  import { EmojiSharedCssClassName } from '@atlaskit/editor-common/emoji';
30
29
  import { N500, N30A } from '@atlaskit/theme/colors';
@@ -33,6 +32,23 @@ export const linkStyles = css`
33
32
  ${linkSharedStyle}
34
33
  }
35
34
  `;
35
+ const ruleStyles = props => css`
36
+ .ProseMirror {
37
+ ${ruleSharedStyles(props)};
38
+
39
+ hr {
40
+ cursor: pointer;
41
+ padding: ${"var(--ds-space-050, 4px)"} 0;
42
+ margin: calc(${akEditorLineHeight}em - 4px) 0;
43
+ background-clip: content-box;
44
+
45
+ &.${akEditorSelectedNodeClassName} {
46
+ outline: none;
47
+ background-color: ${`var(--ds-border-selected, ${akEditorSelectedBorderColor})`};
48
+ }
49
+ }
50
+ }
51
+ `;
36
52
  const mentionsStyles = css`
37
53
  .${MentionSharedCssClassName.MENTION_CONTAINER} {
38
54
  &.${akEditorSelectedNodeClassName} [data-mention-id] > span {
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.37.4";
2
+ export const version = "187.37.5";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -3,7 +3,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import { createEditorSelectionAPI } from '../../../selection-api/api';
6
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
6
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
7
+ import { rulePlugin } from '@atlaskit/editor-plugin-rule';
7
8
  import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
8
9
  import { listPlugin } from '@atlaskit/editor-plugin-list';
9
10
  import { imageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
@@ -20,7 +20,6 @@ export { default as panelPlugin } from './panel';
20
20
  export { default as pastePlugin } from './paste';
21
21
  export { default as placeholderPlugin } from './placeholder';
22
22
  export { default as placeholderTextPlugin } from './placeholder-text';
23
- export { default as rulePlugin } from './rule';
24
23
  export { default as quickInsertPlugin } from './quick-insert';
25
24
  export { default as saveOnEnterPlugin } from './save-on-enter';
26
25
  export { default as submitEditorPlugin } from './submit-editor';
@@ -28,11 +28,11 @@ var isMediaGroupSelectedFromProps = function isMediaGroupSelectedFromProps(props
28
28
  /**
29
29
  * ED-19831
30
30
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
31
- * directly to confluence since this bug is now iun production.
31
+ * directly to confluence since this bug is now in production.
32
32
  */
33
33
  var pos;
34
34
  try {
35
- pos = typeof props.getPos === 'function' ? props.getPos() : undefined;
35
+ pos = props.getPos ? props.getPos() : undefined;
36
36
  } catch (e) {
37
37
  pos = undefined;
38
38
  }
@@ -464,11 +464,11 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
464
464
  /**
465
465
  * ED-19831
466
466
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
467
- * directly to confluence since this bug is now iun production.
467
+ * directly to confluence since this bug is now in production.
468
468
  */
469
469
  var pos;
470
470
  try {
471
- pos = typeof getPos === 'function' ? getPos() : undefined;
471
+ pos = getPos ? getPos() : undefined;
472
472
  } catch (e) {
473
473
  pos = undefined;
474
474
  }
@@ -1,10 +1,10 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
3
3
  /** @jsx jsx */
4
4
  import React, { useMemo } from 'react';
5
5
  import { jsx, css, useTheme } from '@emotion/react';
6
6
  import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles, gridStyles, smartCardStyles, embedCardStyles, codeBlockInListSafariFix, unsupportedStyles } from '@atlaskit/editor-common/styles';
7
- import { akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackgroundWithOpacity, akEditorSelectedNodeClassName, blockNodesVerticalMargin, editorFontSize, getSelectionStyles, SelectionStyle } from '@atlaskit/editor-shared-styles';
7
+ import { akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackgroundWithOpacity, akEditorSelectedNodeClassName, blockNodesVerticalMargin, editorFontSize, getSelectionStyles, SelectionStyle, akEditorLineHeight, akEditorSelectedBorderColor } from '@atlaskit/editor-shared-styles';
8
8
  import { MentionSharedCssClassName } from '@atlaskit/editor-common/mention';
9
9
  import { telepointerStyle } from '../../plugins/collab-edit/styles';
10
10
  import { gapCursorStyles } from '../../plugins/selection/gap-cursor/styles';
@@ -12,7 +12,6 @@ import { tableStyles } from '@atlaskit/editor-plugin-table/ui/common-styles';
12
12
  import { placeholderStyles } from '../../plugins/placeholder/styles';
13
13
  import { blocktypeStyles } from '../../plugins/block-type/styles';
14
14
  import { codeBlockStyles } from '../../plugins/code-block/styles';
15
- import { ruleStyles } from '../../plugins/rule/styles';
16
15
  import { mediaStyles } from '../../plugins/media/styles';
17
16
  import { layoutStyles } from '../../plugins/layout/styles';
18
17
  import { panelStyles } from '../../plugins/panel/styles';
@@ -26,16 +25,19 @@ import { taskDecisionStyles } from '../../plugins/tasks-and-decisions/styles';
26
25
  import { statusStyles } from '../../plugins/status/styles';
27
26
  import { dateStyles } from '../../plugins/date/styles';
28
27
  import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
29
- import { linkSharedStyle, codeMarkSharedStyles } from '@atlaskit/editor-common/styles';
28
+ import { linkSharedStyle, codeMarkSharedStyles, ruleSharedStyles } from '@atlaskit/editor-common/styles';
30
29
  import { browser } from '@atlaskit/editor-common/utils';
31
30
  import { EmojiSharedCssClassName } from '@atlaskit/editor-common/emoji';
32
31
  import { N500, N30A } from '@atlaskit/theme/colors';
33
32
  export var linkStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n ", "\n }\n"])), linkSharedStyle);
34
- var mentionsStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", " {\n &.", " [data-mention-id] > span {\n ", "\n\n /* need to specify dark text colour because personal mentions\n (in dark blue) have white text by default */\n color: ", ";\n }\n }\n\n .danger {\n .", ".", "\n > span\n > span\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n background-color: ", ";\n }\n .", " > span > span > span {\n background-color: ", ";\n color: ", ";\n }\n }\n"])), MentionSharedCssClassName.MENTION_CONTAINER, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Background]), "var(--ds-text-subtle, ".concat(N500, ")"), MentionSharedCssClassName.MENTION_CONTAINER, akEditorSelectedNodeClassName, akEditorSelectedBorderSize, akEditorDeleteBorder, "var(--ds-background-danger, ".concat(akEditorDeleteBackgroundWithOpacity, ")"), MentionSharedCssClassName.MENTION_CONTAINER, "var(--ds-background-neutral, ".concat(N30A, ")"), "var(--ds-text-subtle, ".concat(N500, ")"));
35
- var listsStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ProseMirror {\n li {\n position: relative;\n\n > p:not(:first-child) {\n margin: ", " 0 0 0;\n }\n\n // In SSR the above rule will apply to all p tags because first-child would be a style tag.\n // The following rule resets the first p tag back to its original margin\n // defined in packages/editor/editor-common/src/styles/shared/paragraph.ts\n > style:first-child + p {\n margin-top: ", ";\n }\n }\n\n & :not([data-node-type='decisionList']) > li {\n ", "\n }\n }\n"])), "var(--ds-space-050, 4px)", blockNodesVerticalMargin, browser.safari ? codeBlockInListSafariFix : '');
36
- var emojiStyles = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", " {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), EmojiSharedCssClassName.EMOJI_CONTAINER, EmojiSharedCssClassName.EMOJI_NODE, EmojiSharedCssClassName.EMOJI_IMAGE, akEditorSelectedNodeClassName, EmojiSharedCssClassName.EMOJI_SPRITE, EmojiSharedCssClassName.EMOJI_IMAGE, getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.BoxShadow]));
33
+ var ruleStyles = function ruleStyles(props) {
34
+ return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror {\n ", ";\n\n hr {\n cursor: pointer;\n padding: ", " 0;\n margin: calc(", "em - 4px) 0;\n background-clip: content-box;\n\n &.", " {\n outline: none;\n background-color: ", ";\n }\n }\n }\n"])), ruleSharedStyles(props), "var(--ds-space-050, 4px)", akEditorLineHeight, akEditorSelectedNodeClassName, "var(--ds-border-selected, ".concat(akEditorSelectedBorderColor, ")"));
35
+ };
36
+ var mentionsStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", " {\n &.", " [data-mention-id] > span {\n ", "\n\n /* need to specify dark text colour because personal mentions\n (in dark blue) have white text by default */\n color: ", ";\n }\n }\n\n .danger {\n .", ".", "\n > span\n > span\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n background-color: ", ";\n }\n .", " > span > span > span {\n background-color: ", ";\n color: ", ";\n }\n }\n"])), MentionSharedCssClassName.MENTION_CONTAINER, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Background]), "var(--ds-text-subtle, ".concat(N500, ")"), MentionSharedCssClassName.MENTION_CONTAINER, akEditorSelectedNodeClassName, akEditorSelectedBorderSize, akEditorDeleteBorder, "var(--ds-background-danger, ".concat(akEditorDeleteBackgroundWithOpacity, ")"), MentionSharedCssClassName.MENTION_CONTAINER, "var(--ds-background-neutral, ".concat(N30A, ")"), "var(--ds-text-subtle, ".concat(N500, ")"));
37
+ var listsStyles = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .ProseMirror {\n li {\n position: relative;\n\n > p:not(:first-child) {\n margin: ", " 0 0 0;\n }\n\n // In SSR the above rule will apply to all p tags because first-child would be a style tag.\n // The following rule resets the first p tag back to its original margin\n // defined in packages/editor/editor-common/src/styles/shared/paragraph.ts\n > style:first-child + p {\n margin-top: ", ";\n }\n }\n\n & :not([data-node-type='decisionList']) > li {\n ", "\n }\n }\n"])), "var(--ds-space-050, 4px)", blockNodesVerticalMargin, browser.safari ? codeBlockInListSafariFix : '');
38
+ var emojiStyles = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", " {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), EmojiSharedCssClassName.EMOJI_CONTAINER, EmojiSharedCssClassName.EMOJI_NODE, EmojiSharedCssClassName.EMOJI_IMAGE, akEditorSelectedNodeClassName, EmojiSharedCssClassName.EMOJI_SPRITE, EmojiSharedCssClassName.EMOJI_IMAGE, getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.BoxShadow]));
37
39
  var contentStyles = function contentStyles(props) {
38
- return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), editorFontSize({
40
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), editorFontSize({
39
41
  theme: props.theme
40
42
  }), whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, shadowSharedStyle, InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", placeholderTextStyles, placeholderStyles, codeBlockStyles(props), blocktypeStyles(props), codeMarkSharedStyles(props), textColorStyles, listsStyles, ruleStyles(props), mediaStyles, layoutStyles(props), telepointerStyle, gapCursorStyles, tableStyles(props), panelStyles(props), fakeCursorStyles, mentionsStyles, emojiStyles, tasksAndDecisionsStyles, gridStyles, linkStyles, blockMarksSharedStyles, dateSharedStyle, extensionStyles, expandStyles(props), findReplaceStyles, taskDecisionStyles, statusStyles, annotationSharedStyles(props), smartCardStyles, smartCardSharedStyles, dateStyles, embedCardStyles, unsupportedStyles, resizerStyles, ClassNames.FLOATING_TOOLBAR_COMPONENT);
41
43
  };
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.37.4";
2
+ export var version = "187.37.5";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -20,7 +20,6 @@ export { default as panelPlugin } from './panel';
20
20
  export { default as pastePlugin } from './paste';
21
21
  export { default as placeholderPlugin } from './placeholder';
22
22
  export { default as placeholderTextPlugin } from './placeholder-text';
23
- export { default as rulePlugin } from './rule';
24
23
  export { default as quickInsertPlugin } from './quick-insert';
25
24
  export { default as saveOnEnterPlugin } from './save-on-enter';
26
25
  export { default as submitEditorPlugin } from './submit-editor';
@@ -11,7 +11,7 @@ import type quickInsertPlugin from '../quick-insert';
11
11
  import type blockTypePlugin from '../block-type';
12
12
  import type codeBlockPlugin from '../code-block';
13
13
  import type panelPlugin from '../panel';
14
- import type { RulePlugin } from '../rule';
14
+ import type { RulePlugin } from '@atlaskit/editor-plugin-rule';
15
15
  export type InsertBlockPluginDependencies = [
16
16
  FeatureFlagsPlugin,
17
17
  OptionalPlugin<typeof tablesPlugin>,
@@ -20,7 +20,6 @@ export { default as panelPlugin } from './panel';
20
20
  export { default as pastePlugin } from './paste';
21
21
  export { default as placeholderPlugin } from './placeholder';
22
22
  export { default as placeholderTextPlugin } from './placeholder-text';
23
- export { default as rulePlugin } from './rule';
24
23
  export { default as quickInsertPlugin } from './quick-insert';
25
24
  export { default as saveOnEnterPlugin } from './save-on-enter';
26
25
  export { default as submitEditorPlugin } from './submit-editor';
@@ -11,7 +11,7 @@ import type quickInsertPlugin from '../quick-insert';
11
11
  import type blockTypePlugin from '../block-type';
12
12
  import type codeBlockPlugin from '../code-block';
13
13
  import type panelPlugin from '../panel';
14
- import type { RulePlugin } from '../rule';
14
+ import type { RulePlugin } from '@atlaskit/editor-plugin-rule';
15
15
  export type InsertBlockPluginDependencies = [
16
16
  FeatureFlagsPlugin,
17
17
  OptionalPlugin<typeof tablesPlugin>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.37.4",
3
+ "version": "187.37.5",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -76,6 +76,7 @@
76
76
  "@atlaskit/editor-plugin-hyperlink": "^0.4.0",
77
77
  "@atlaskit/editor-plugin-image-upload": "^0.2.0",
78
78
  "@atlaskit/editor-plugin-list": "^1.2.0",
79
+ "@atlaskit/editor-plugin-rule": "^0.1.0",
79
80
  "@atlaskit/editor-plugin-table": "^2.12.0",
80
81
  "@atlaskit/editor-plugin-text-formatting": "^0.4.0",
81
82
  "@atlaskit/editor-plugin-type-ahead": "^0.2.0",
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.insertHorizontalRule = void 0;
7
- var _inputRule = require("./pm-plugins/input-rule");
8
- var insertHorizontalRule = function insertHorizontalRule(featureFlags, editorAnalyticsAPI) {
9
- return function (inputMethod) {
10
- return function (state, dispatch) {
11
- var tr = (0, _inputRule.createHorizontalRule)(state, featureFlags, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
12
- if (tr) {
13
- if (dispatch) {
14
- dispatch(tr);
15
- }
16
- return true;
17
- }
18
- return false;
19
- };
20
- };
21
- };
22
- exports.insertHorizontalRule = insertHorizontalRule;
@@ -1,80 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _adfSchema = require("@atlaskit/adf-schema");
10
- var _analytics = require("@atlaskit/editor-common/analytics");
11
- var _messages = require("@atlaskit/editor-common/messages");
12
- var _quickInsert = require("@atlaskit/editor-common/quick-insert");
13
- var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
14
- var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
15
- var _commands = require("./commands");
16
- var rulePlugin = function rulePlugin(_ref) {
17
- var _api$featureFlags, _api$analytics;
18
- var api = _ref.api;
19
- var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
20
- return {
21
- name: 'rule',
22
- nodes: function nodes() {
23
- return [{
24
- name: 'rule',
25
- node: _adfSchema.rule
26
- }];
27
- },
28
- actions: {
29
- insertHorizontalRule: (0, _commands.insertHorizontalRule)(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
30
- },
31
- pmPlugins: function pmPlugins() {
32
- return [{
33
- name: 'ruleInputRule',
34
- plugin: function plugin(_ref2) {
35
- var _api$analytics2;
36
- var schema = _ref2.schema;
37
- return (0, _inputRule.default)(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
38
- }
39
- }, {
40
- name: 'ruleKeymap',
41
- plugin: function plugin() {
42
- var _api$analytics3;
43
- return (0, _keymap.default)(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
44
- }
45
- }];
46
- },
47
- pluginsOptions: {
48
- quickInsert: function quickInsert(_ref3) {
49
- var formatMessage = _ref3.formatMessage;
50
- return [{
51
- id: 'rule',
52
- title: formatMessage(_messages.toolbarInsertBlockMessages.horizontalRule),
53
- description: formatMessage(_messages.toolbarInsertBlockMessages.horizontalRuleDescription),
54
- keywords: ['horizontal', 'rule', 'line', 'hr'],
55
- priority: 1200,
56
- keyshortcut: '---',
57
- icon: function icon() {
58
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconDivider, null);
59
- },
60
- action: function action(insert, state) {
61
- var _api$analytics4;
62
- var tr = insert(state.schema.nodes.rule.createChecked());
63
- api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.attachAnalyticsEvent({
64
- action: _analytics.ACTION.INSERTED,
65
- actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
66
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.DIVIDER,
67
- attributes: {
68
- inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
69
- },
70
- eventType: _analytics.EVENT_TYPE.TRACK
71
- })(tr);
72
- return tr;
73
- }
74
- }];
75
- }
76
- }
77
- };
78
- };
79
- var _default = rulePlugin;
80
- exports.default = _default;
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.createHorizontalRule = void 0;
7
- exports.inputRulePlugin = inputRulePlugin;
8
- var _model = require("@atlaskit/editor-prosemirror/model");
9
- var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
10
- var _insert = require("@atlaskit/editor-common/insert");
11
- var _utils = require("@atlaskit/editor-prosemirror/utils");
12
- var _analytics = require("@atlaskit/editor-common/analytics");
13
- var createHorizontalRule = function createHorizontalRule(state, featureFlags, start, end, inputMethod, editorAnalyticsAPI) {
14
- if (!state.selection.empty) {
15
- return null;
16
- }
17
- var tr = null;
18
- var rule = state.schema.nodes.rule;
19
- var newInsertionBehaviour = featureFlags.newInsertionBehaviour;
20
- if (newInsertionBehaviour) {
21
- /**
22
- * This is a workaround to get rid of the typeahead text when using quick insert
23
- * Once we insert *nothing*, we get a new transaction, so we can use the new selection
24
- * without considering the extra text after the `/` command.
25
- **/
26
- tr = state.tr.replaceWith(start, end, _model.Fragment.empty);
27
- tr = (0, _insert.safeInsert)(rule.createChecked(), tr.selection.from)(tr);
28
- }
29
- if (!tr) {
30
- tr = state.tr.replaceRange(start, end, new _model.Slice(_model.Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
31
- }
32
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
33
- action: _analytics.ACTION.INSERTED,
34
- actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
35
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.DIVIDER,
36
- attributes: {
37
- inputMethod: inputMethod
38
- },
39
- eventType: _analytics.EVENT_TYPE.TRACK
40
- })(tr);
41
- return tr;
42
- };
43
- exports.createHorizontalRule = createHorizontalRule;
44
- var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI) {
45
- var listItem = state.schema.nodes.listItem;
46
- if ((0, _utils.hasParentNodeOfType)(listItem)(state.selection)) {
47
- return null;
48
- }
49
- return createHorizontalRule(state, featureFlags, start, end, _analytics.INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
50
- };
51
- function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
52
- var rules = [];
53
- if (schema.nodes.rule) {
54
- // '---' and '***' for hr
55
- rules.push((0, _prosemirrorInputRules.createRule)(/^(\-\-\-|\*\*\*)$/, function (state, _match, start, end) {
56
- return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
57
- }));
58
-
59
- // '---' and '***' after shift+enter for hr
60
- rules.push((0, _prosemirrorInputRules.createRule)(new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "(\\-\\-\\-|\\*\\*\\*)")), function (state, _match, start, end) {
61
- var hardBreak = state.schema.nodes.hardBreak;
62
- if (state.doc.resolve(start).nodeAfter.type !== hardBreak) {
63
- return null;
64
- }
65
- return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
66
- }));
67
- }
68
- if (rules.length !== 0) {
69
- return (0, _prosemirrorInputRules.createPlugin)('rule', rules, {
70
- isBlockNodeRule: true
71
- });
72
- }
73
- return;
74
- }
75
- var _default = inputRulePlugin;
76
- exports.default = _default;
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- exports.keymapPlugin = keymapPlugin;
8
- var _keymap = require("@atlaskit/editor-prosemirror/keymap");
9
- var _keymaps = require("@atlaskit/editor-common/keymaps");
10
- var _analytics = require("@atlaskit/editor-common/analytics");
11
- var _commands = require("../commands");
12
- function keymapPlugin(featureFlags, editorAnalyticsAPI) {
13
- var list = {};
14
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.insertRule.common, (0, _commands.insertHorizontalRule)(featureFlags, editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
15
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.escape.common, function () {
16
- return true;
17
- }, list);
18
- return (0, _keymap.keymap)(list);
19
- }
20
- var _default = keymapPlugin;
21
- exports.default = _default;
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.ruleStyles = void 0;
8
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
- var _react = require("@emotion/react");
10
- var _styles = require("@atlaskit/editor-common/styles");
11
- var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
- var _templateObject;
13
- var ruleStyles = function ruleStyles(props) {
14
- return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", ";\n\n hr {\n cursor: pointer;\n padding: 4px 0;\n margin: calc(", "em - 4px) 0;\n background-clip: content-box;\n\n &.", " {\n outline: none;\n background-color: ", ";\n }\n }\n }\n"])), (0, _styles.ruleSharedStyles)(props), _editorSharedStyles.akEditorLineHeight, _editorSharedStyles.akEditorSelectedNodeClassName, "var(--ds-border-selected, ".concat(_editorSharedStyles.akEditorSelectedBorderColor, ")"));
15
- };
16
- exports.ruleStyles = ruleStyles;
@@ -1,11 +0,0 @@
1
- import { createHorizontalRule } from './pm-plugins/input-rule';
2
- export const insertHorizontalRule = (featureFlags, editorAnalyticsAPI) => inputMethod => (state, dispatch) => {
3
- const tr = createHorizontalRule(state, featureFlags, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
4
- if (tr) {
5
- if (dispatch) {
6
- dispatch(tr);
7
- }
8
- return true;
9
- }
10
- return false;
11
- };
@@ -1,71 +0,0 @@
1
- import React from 'react';
2
- import { rule } from '@atlaskit/adf-schema';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
- import { IconDivider } from '@atlaskit/editor-common/quick-insert';
6
- import inputRulePlugin from './pm-plugins/input-rule';
7
- import keymapPlugin from './pm-plugins/keymap';
8
- import { insertHorizontalRule } from './commands';
9
- const rulePlugin = ({
10
- api
11
- }) => {
12
- var _api$featureFlags, _api$analytics;
13
- const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
14
- return {
15
- name: 'rule',
16
- nodes() {
17
- return [{
18
- name: 'rule',
19
- node: rule
20
- }];
21
- },
22
- actions: {
23
- insertHorizontalRule: insertHorizontalRule(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
24
- },
25
- pmPlugins() {
26
- return [{
27
- name: 'ruleInputRule',
28
- plugin: ({
29
- schema
30
- }) => {
31
- var _api$analytics2;
32
- return inputRulePlugin(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
33
- }
34
- }, {
35
- name: 'ruleKeymap',
36
- plugin: () => {
37
- var _api$analytics3;
38
- return keymapPlugin(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
39
- }
40
- }];
41
- },
42
- pluginsOptions: {
43
- quickInsert: ({
44
- formatMessage
45
- }) => [{
46
- id: 'rule',
47
- title: formatMessage(messages.horizontalRule),
48
- description: formatMessage(messages.horizontalRuleDescription),
49
- keywords: ['horizontal', 'rule', 'line', 'hr'],
50
- priority: 1200,
51
- keyshortcut: '---',
52
- icon: () => /*#__PURE__*/React.createElement(IconDivider, null),
53
- action(insert, state) {
54
- var _api$analytics4;
55
- let tr = insert(state.schema.nodes.rule.createChecked());
56
- api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.attachAnalyticsEvent({
57
- action: ACTION.INSERTED,
58
- actionSubject: ACTION_SUBJECT.DOCUMENT,
59
- actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
60
- attributes: {
61
- inputMethod: INPUT_METHOD.QUICK_INSERT
62
- },
63
- eventType: EVENT_TYPE.TRACK
64
- })(tr);
65
- return tr;
66
- }
67
- }]
68
- }
69
- };
70
- };
71
- export default rulePlugin;
@@ -1,73 +0,0 @@
1
- import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
2
- import { createRule, createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
3
- import { safeInsert } from '@atlaskit/editor-common/insert';
4
- import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
- export const createHorizontalRule = (state, featureFlags, start, end, inputMethod, editorAnalyticsAPI) => {
7
- if (!state.selection.empty) {
8
- return null;
9
- }
10
- let tr = null;
11
- const {
12
- rule
13
- } = state.schema.nodes;
14
- const {
15
- newInsertionBehaviour
16
- } = featureFlags;
17
- if (newInsertionBehaviour) {
18
- /**
19
- * This is a workaround to get rid of the typeahead text when using quick insert
20
- * Once we insert *nothing*, we get a new transaction, so we can use the new selection
21
- * without considering the extra text after the `/` command.
22
- **/
23
- tr = state.tr.replaceWith(start, end, Fragment.empty);
24
- tr = safeInsert(rule.createChecked(), tr.selection.from)(tr);
25
- }
26
- if (!tr) {
27
- tr = state.tr.replaceRange(start, end, new Slice(Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
28
- }
29
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
30
- action: ACTION.INSERTED,
31
- actionSubject: ACTION_SUBJECT.DOCUMENT,
32
- actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
33
- attributes: {
34
- inputMethod
35
- },
36
- eventType: EVENT_TYPE.TRACK
37
- })(tr);
38
- return tr;
39
- };
40
- const createHorizontalRuleAutoformat = (state, featureFlags, start, end, editorAnalyticsAPI) => {
41
- const {
42
- listItem
43
- } = state.schema.nodes;
44
- if (hasParentNodeOfType(listItem)(state.selection)) {
45
- return null;
46
- }
47
- return createHorizontalRule(state, featureFlags, start, end, INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
48
- };
49
- export function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
50
- const rules = [];
51
- if (schema.nodes.rule) {
52
- // '---' and '***' for hr
53
- rules.push(createRule(/^(\-\-\-|\*\*\*)$/, (state, _match, start, end) => createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI)));
54
-
55
- // '---' and '***' after shift+enter for hr
56
- rules.push(createRule(new RegExp(`${leafNodeReplacementCharacter}(\\-\\-\\-|\\*\\*\\*)`), (state, _match, start, end) => {
57
- const {
58
- hardBreak
59
- } = state.schema.nodes;
60
- if (state.doc.resolve(start).nodeAfter.type !== hardBreak) {
61
- return null;
62
- }
63
- return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
64
- }));
65
- }
66
- if (rules.length !== 0) {
67
- return createPlugin('rule', rules, {
68
- isBlockNodeRule: true
69
- });
70
- }
71
- return;
72
- }
73
- export default inputRulePlugin;
@@ -1,11 +0,0 @@
1
- import { keymap } from '@atlaskit/editor-prosemirror/keymap';
2
- import { bindKeymapWithCommand, insertRule, escape } from '@atlaskit/editor-common/keymaps';
3
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { insertHorizontalRule } from '../commands';
5
- export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
6
- const list = {};
7
- bindKeymapWithCommand(insertRule.common, insertHorizontalRule(featureFlags, editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
8
- bindKeymapWithCommand(escape.common, () => true, list);
9
- return keymap(list);
10
- }
11
- export default keymapPlugin;
@@ -1,20 +0,0 @@
1
- import { css } from '@emotion/react';
2
- import { ruleSharedStyles } from '@atlaskit/editor-common/styles';
3
- import { akEditorLineHeight, akEditorSelectedBorderColor, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
4
- export const ruleStyles = props => css`
5
- .ProseMirror {
6
- ${ruleSharedStyles(props)};
7
-
8
- hr {
9
- cursor: pointer;
10
- padding: 4px 0;
11
- margin: calc(${akEditorLineHeight}em - 4px) 0;
12
- background-clip: content-box;
13
-
14
- &.${akEditorSelectedNodeClassName} {
15
- outline: none;
16
- background-color: ${`var(--ds-border-selected, ${akEditorSelectedBorderColor})`};
17
- }
18
- }
19
- }
20
- `;
@@ -1,15 +0,0 @@
1
- import { createHorizontalRule } from './pm-plugins/input-rule';
2
- export var insertHorizontalRule = function insertHorizontalRule(featureFlags, editorAnalyticsAPI) {
3
- return function (inputMethod) {
4
- return function (state, dispatch) {
5
- var tr = createHorizontalRule(state, featureFlags, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
6
- if (tr) {
7
- if (dispatch) {
8
- dispatch(tr);
9
- }
10
- return true;
11
- }
12
- return false;
13
- };
14
- };
15
- };
@@ -1,72 +0,0 @@
1
- import React from 'react';
2
- import { rule } from '@atlaskit/adf-schema';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
- import { IconDivider } from '@atlaskit/editor-common/quick-insert';
6
- import inputRulePlugin from './pm-plugins/input-rule';
7
- import keymapPlugin from './pm-plugins/keymap';
8
- import { insertHorizontalRule } from './commands';
9
- var rulePlugin = function rulePlugin(_ref) {
10
- var _api$featureFlags, _api$analytics;
11
- var api = _ref.api;
12
- var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
13
- return {
14
- name: 'rule',
15
- nodes: function nodes() {
16
- return [{
17
- name: 'rule',
18
- node: rule
19
- }];
20
- },
21
- actions: {
22
- insertHorizontalRule: insertHorizontalRule(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
23
- },
24
- pmPlugins: function pmPlugins() {
25
- return [{
26
- name: 'ruleInputRule',
27
- plugin: function plugin(_ref2) {
28
- var _api$analytics2;
29
- var schema = _ref2.schema;
30
- return inputRulePlugin(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
31
- }
32
- }, {
33
- name: 'ruleKeymap',
34
- plugin: function plugin() {
35
- var _api$analytics3;
36
- return keymapPlugin(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
37
- }
38
- }];
39
- },
40
- pluginsOptions: {
41
- quickInsert: function quickInsert(_ref3) {
42
- var formatMessage = _ref3.formatMessage;
43
- return [{
44
- id: 'rule',
45
- title: formatMessage(messages.horizontalRule),
46
- description: formatMessage(messages.horizontalRuleDescription),
47
- keywords: ['horizontal', 'rule', 'line', 'hr'],
48
- priority: 1200,
49
- keyshortcut: '---',
50
- icon: function icon() {
51
- return /*#__PURE__*/React.createElement(IconDivider, null);
52
- },
53
- action: function action(insert, state) {
54
- var _api$analytics4;
55
- var tr = insert(state.schema.nodes.rule.createChecked());
56
- api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.attachAnalyticsEvent({
57
- action: ACTION.INSERTED,
58
- actionSubject: ACTION_SUBJECT.DOCUMENT,
59
- actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
60
- attributes: {
61
- inputMethod: INPUT_METHOD.QUICK_INSERT
62
- },
63
- eventType: EVENT_TYPE.TRACK
64
- })(tr);
65
- return tr;
66
- }
67
- }];
68
- }
69
- }
70
- };
71
- };
72
- export default rulePlugin;
@@ -1,67 +0,0 @@
1
- import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
2
- import { createRule, createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
3
- import { safeInsert } from '@atlaskit/editor-common/insert';
4
- import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
- export var createHorizontalRule = function createHorizontalRule(state, featureFlags, start, end, inputMethod, editorAnalyticsAPI) {
7
- if (!state.selection.empty) {
8
- return null;
9
- }
10
- var tr = null;
11
- var rule = state.schema.nodes.rule;
12
- var newInsertionBehaviour = featureFlags.newInsertionBehaviour;
13
- if (newInsertionBehaviour) {
14
- /**
15
- * This is a workaround to get rid of the typeahead text when using quick insert
16
- * Once we insert *nothing*, we get a new transaction, so we can use the new selection
17
- * without considering the extra text after the `/` command.
18
- **/
19
- tr = state.tr.replaceWith(start, end, Fragment.empty);
20
- tr = safeInsert(rule.createChecked(), tr.selection.from)(tr);
21
- }
22
- if (!tr) {
23
- tr = state.tr.replaceRange(start, end, new Slice(Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
24
- }
25
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
26
- action: ACTION.INSERTED,
27
- actionSubject: ACTION_SUBJECT.DOCUMENT,
28
- actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
29
- attributes: {
30
- inputMethod: inputMethod
31
- },
32
- eventType: EVENT_TYPE.TRACK
33
- })(tr);
34
- return tr;
35
- };
36
- var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI) {
37
- var listItem = state.schema.nodes.listItem;
38
- if (hasParentNodeOfType(listItem)(state.selection)) {
39
- return null;
40
- }
41
- return createHorizontalRule(state, featureFlags, start, end, INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
42
- };
43
- export function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
44
- var rules = [];
45
- if (schema.nodes.rule) {
46
- // '---' and '***' for hr
47
- rules.push(createRule(/^(\-\-\-|\*\*\*)$/, function (state, _match, start, end) {
48
- return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
49
- }));
50
-
51
- // '---' and '***' after shift+enter for hr
52
- rules.push(createRule(new RegExp("".concat(leafNodeReplacementCharacter, "(\\-\\-\\-|\\*\\*\\*)")), function (state, _match, start, end) {
53
- var hardBreak = state.schema.nodes.hardBreak;
54
- if (state.doc.resolve(start).nodeAfter.type !== hardBreak) {
55
- return null;
56
- }
57
- return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
58
- }));
59
- }
60
- if (rules.length !== 0) {
61
- return createPlugin('rule', rules, {
62
- isBlockNodeRule: true
63
- });
64
- }
65
- return;
66
- }
67
- export default inputRulePlugin;
@@ -1,13 +0,0 @@
1
- import { keymap } from '@atlaskit/editor-prosemirror/keymap';
2
- import { bindKeymapWithCommand, insertRule, escape } from '@atlaskit/editor-common/keymaps';
3
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { insertHorizontalRule } from '../commands';
5
- export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
6
- var list = {};
7
- bindKeymapWithCommand(insertRule.common, insertHorizontalRule(featureFlags, editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
8
- bindKeymapWithCommand(escape.common, function () {
9
- return true;
10
- }, list);
11
- return keymap(list);
12
- }
13
- export default keymapPlugin;
@@ -1,8 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
- import { css } from '@emotion/react';
4
- import { ruleSharedStyles } from '@atlaskit/editor-common/styles';
5
- import { akEditorLineHeight, akEditorSelectedBorderColor, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
6
- export var ruleStyles = function ruleStyles(props) {
7
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n ", ";\n\n hr {\n cursor: pointer;\n padding: 4px 0;\n margin: calc(", "em - 4px) 0;\n background-clip: content-box;\n\n &.", " {\n outline: none;\n background-color: ", ";\n }\n }\n }\n"])), ruleSharedStyles(props), akEditorLineHeight, akEditorSelectedNodeClassName, "var(--ds-border-selected, ".concat(akEditorSelectedBorderColor, ")"));
8
- };
@@ -1,3 +0,0 @@
1
- import type { FeatureFlags, Command } from '@atlaskit/editor-common/types';
2
- import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- export declare const insertHorizontalRule: (featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT) => Command;
@@ -1,13 +0,0 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import { insertHorizontalRule } from './commands';
3
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
4
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
- export type RulePlugin = NextEditorPlugin<'rule', {
6
- pluginConfiguration: undefined;
7
- dependencies: [FeatureFlagsPlugin, OptionalPlugin<AnalyticsPlugin>];
8
- actions: {
9
- insertHorizontalRule: ReturnType<typeof insertHorizontalRule>;
10
- };
11
- }>;
12
- declare const rulePlugin: RulePlugin;
13
- export default rulePlugin;
@@ -1,9 +0,0 @@
1
- import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
5
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
6
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
- export declare const createHorizontalRule: (state: EditorState, featureFlags: FeatureFlags, start: number, end: number, inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Transaction | null;
8
- export declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
9
- export default inputRulePlugin;
@@ -1,5 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
- export declare function keymapPlugin(featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
5
- export default keymapPlugin;
@@ -1,2 +0,0 @@
1
- import { ThemeProps } from '@atlaskit/theme/types';
2
- export declare const ruleStyles: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
@@ -1,3 +0,0 @@
1
- import type { FeatureFlags, Command } from '@atlaskit/editor-common/types';
2
- import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- export declare const insertHorizontalRule: (featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT) => Command;
@@ -1,16 +0,0 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import { insertHorizontalRule } from './commands';
3
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
4
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
- export type RulePlugin = NextEditorPlugin<'rule', {
6
- pluginConfiguration: undefined;
7
- dependencies: [
8
- FeatureFlagsPlugin,
9
- OptionalPlugin<AnalyticsPlugin>
10
- ];
11
- actions: {
12
- insertHorizontalRule: ReturnType<typeof insertHorizontalRule>;
13
- };
14
- }>;
15
- declare const rulePlugin: RulePlugin;
16
- export default rulePlugin;
@@ -1,9 +0,0 @@
1
- import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
5
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
6
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
- export declare const createHorizontalRule: (state: EditorState, featureFlags: FeatureFlags, start: number, end: number, inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Transaction | null;
8
- export declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
9
- export default inputRulePlugin;
@@ -1,5 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
- export declare function keymapPlugin(featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
5
- export default keymapPlugin;
@@ -1,2 +0,0 @@
1
- import { ThemeProps } from '@atlaskit/theme/types';
2
- export declare const ruleStyles: (props: ThemeProps) => import("@emotion/react").SerializedStyles;