@atlaskit/editor-core 151.0.0 → 151.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/cjs/create-editor/create-plugins-list.js +8 -1
  3. package/dist/cjs/labs/next/presets/default.js +3 -1
  4. package/dist/cjs/plugins/code-bidi-warning/index.js +28 -0
  5. package/dist/cjs/plugins/code-bidi-warning/plugin-key.js +11 -0
  6. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/main.js +52 -0
  7. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +128 -0
  8. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/reducer.js +12 -0
  9. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/types.js +5 -0
  10. package/dist/cjs/plugins/code-block/index.js +12 -8
  11. package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +19 -5
  12. package/dist/cjs/plugins/code-block/pm-plugins/main.js +21 -4
  13. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
  14. package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
  15. package/dist/cjs/plugins/index.js +8 -0
  16. package/dist/cjs/plugins/rank.js +1 -1
  17. package/dist/cjs/plugins/status/styles.js +1 -1
  18. package/dist/cjs/version-wrapper.js +1 -1
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/create-editor/create-plugins-list.js +9 -2
  21. package/dist/es2019/labs/next/presets/default.js +3 -1
  22. package/dist/es2019/plugins/code-bidi-warning/index.js +21 -0
  23. package/dist/es2019/plugins/code-bidi-warning/plugin-key.js +2 -0
  24. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +41 -0
  25. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +99 -0
  26. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
  27. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
  28. package/dist/es2019/plugins/code-block/index.js +8 -2
  29. package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +19 -4
  30. package/dist/es2019/plugins/code-block/pm-plugins/main.js +58 -39
  31. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
  32. package/dist/es2019/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -1
  33. package/dist/es2019/plugins/index.js +2 -1
  34. package/dist/es2019/plugins/rank.js +1 -1
  35. package/dist/es2019/plugins/status/styles.js +3 -0
  36. package/dist/es2019/version-wrapper.js +1 -1
  37. package/dist/es2019/version.json +1 -1
  38. package/dist/esm/create-editor/create-plugins-list.js +9 -2
  39. package/dist/esm/labs/next/presets/default.js +3 -1
  40. package/dist/esm/plugins/code-bidi-warning/index.js +20 -0
  41. package/dist/esm/plugins/code-bidi-warning/plugin-key.js +2 -0
  42. package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +39 -0
  43. package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +106 -0
  44. package/dist/esm/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
  45. package/dist/esm/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
  46. package/dist/esm/plugins/code-block/index.js +12 -8
  47. package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +19 -5
  48. package/dist/esm/plugins/code-block/pm-plugins/main.js +20 -4
  49. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
  50. package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
  51. package/dist/esm/plugins/index.js +2 -1
  52. package/dist/esm/plugins/rank.js +1 -1
  53. package/dist/esm/plugins/status/styles.js +1 -1
  54. package/dist/esm/version-wrapper.js +1 -1
  55. package/dist/esm/version.json +1 -1
  56. package/dist/types/plugins/code-bidi-warning/index.d.ts +5 -0
  57. package/dist/types/plugins/code-bidi-warning/plugin-key.d.ts +2 -0
  58. package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +5 -0
  59. package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +8 -0
  60. package/dist/types/plugins/code-bidi-warning/pm-plugins/reducer.d.ts +3 -0
  61. package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +6 -0
  62. package/dist/types/plugins/code-block/index.d.ts +1 -1
  63. package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +22 -2
  64. package/dist/types/plugins/code-block/pm-plugins/main.d.ts +7 -1
  65. package/dist/types/plugins/code-block/types.d.ts +2 -0
  66. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  67. package/dist/types/plugins/hyperlink/HyperlinkToolbarAppearance.d.ts +1 -1
  68. package/dist/types/plugins/index.d.ts +1 -0
  69. package/dist/types/types/feature-flags.d.ts +9 -0
  70. package/package.json +6 -6
@@ -9,8 +9,7 @@ import { IconCode } from '../quick-insert/assets';
9
9
  import { messages } from '../block-type/messages';
10
10
  import refreshBrowserSelectionOnChange from './refresh-browser-selection';
11
11
 
12
- var codeBlockPlugin = function codeBlockPlugin() {
13
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
+ var codeBlockPlugin = function codeBlockPlugin(options) {
14
13
  return {
15
14
  name: 'codeBlock',
16
15
  nodes: function nodes() {
@@ -22,8 +21,13 @@ var codeBlockPlugin = function codeBlockPlugin() {
22
21
  pmPlugins: function pmPlugins() {
23
22
  return [{
24
23
  name: 'codeBlock',
25
- plugin: function plugin() {
26
- return createPlugin(options.useLongPressSelection);
24
+ plugin: function plugin(_ref) {
25
+ var reactContext = _ref.reactContext;
26
+ return createPlugin({
27
+ useLongPressSelection: options.useLongPressSelection,
28
+ reactContext: reactContext,
29
+ appearance: options.appearance
30
+ });
27
31
  }
28
32
  }, {
29
33
  name: 'codeBlockIDEKeyBindings',
@@ -32,8 +36,8 @@ var codeBlockPlugin = function codeBlockPlugin() {
32
36
  }
33
37
  }, {
34
38
  name: 'codeBlockKeyMap',
35
- plugin: function plugin(_ref) {
36
- var schema = _ref.schema;
39
+ plugin: function plugin(_ref2) {
40
+ var schema = _ref2.schema;
37
41
  return keymap(schema);
38
42
  }
39
43
  }];
@@ -44,8 +48,8 @@ var codeBlockPlugin = function codeBlockPlugin() {
44
48
  refreshBrowserSelectionOnChange(props.originalTransaction, props.newEditorState);
45
49
  },
46
50
  pluginsOptions: {
47
- quickInsert: function quickInsert(_ref2) {
48
- var formatMessage = _ref2.formatMessage;
51
+ quickInsert: function quickInsert(_ref3) {
52
+ var formatMessage = _ref3.formatMessage;
49
53
  return [{
50
54
  id: 'codeblock',
51
55
  title: formatMessage(messages.codeblock),
@@ -32,7 +32,7 @@ var toDOM = function toDOM(node) {
32
32
  };
33
33
 
34
34
  export var CodeBlockView = /*#__PURE__*/function () {
35
- function CodeBlockView(_node, view, getPos) {
35
+ function CodeBlockView(_node, view, getPos, codeBidiWarningOptions) {
36
36
  var _this = this;
37
37
 
38
38
  _classCallCheck(this, CodeBlockView);
@@ -66,6 +66,7 @@ export var CodeBlockView = /*#__PURE__*/function () {
66
66
  dom = _DOMSerializer$render.dom,
67
67
  contentDOM = _DOMSerializer$render.contentDOM;
68
68
 
69
+ this.codeBidiWarningOptions = codeBidiWarningOptions;
69
70
  this.getPos = getPos;
70
71
  this.view = view;
71
72
  this.node = _node;
@@ -118,7 +119,10 @@ export var CodeBlockView = /*#__PURE__*/function () {
118
119
  ReactDOM.render( /*#__PURE__*/React.createElement(CodeBlock, {
119
120
  text: node.textContent,
120
121
  language: node.attrs.language,
121
- showLineNumbers: false
122
+ showLineNumbers: false,
123
+ codeBidiWarnings: this.codeBidiWarningOptions.enabled,
124
+ codeBidiWarningLabel: this.codeBidiWarningOptions.label,
125
+ codeBidiWarningTooltipEnabled: this.codeBidiWarningOptions.tooltipEnabled
122
126
  }), highlighting);
123
127
  this.measure(performance.now() - start);
124
128
  content === null || content === void 0 ? void 0 : content.setAttribute('data-debounce', 'false');
@@ -151,14 +155,24 @@ export var CodeBlockView = /*#__PURE__*/function () {
151
155
  value: function ignoreMutation(record) {
152
156
  var _this$highlighting$co, _this$highlighting;
153
157
 
154
- return record.target === this.lineNumberGutter || record.target.parentNode === this.lineNumberGutter || ((_this$highlighting$co = (_this$highlighting = this.highlighting) === null || _this$highlighting === void 0 ? void 0 : _this$highlighting.contains(record.target)) !== null && _this$highlighting$co !== void 0 ? _this$highlighting$co : false);
158
+ var lineNumberChanges = record.target === this.lineNumberGutter || record.target.parentNode === this.lineNumberGutter;
159
+ var outsideTheCodeBlockChanges = (_this$highlighting$co = (_this$highlighting = this.highlighting) === null || _this$highlighting === void 0 ? void 0 : _this$highlighting.contains(record.target)) !== null && _this$highlighting$co !== void 0 ? _this$highlighting$co : false;
160
+ var codeBidiWarningDecorationChanges = record.type === 'attributes' && record.attributeName === 'aria-describedby';
161
+ return lineNumberChanges || outsideTheCodeBlockChanges || codeBidiWarningDecorationChanges;
155
162
  }
156
163
  }]);
157
164
 
158
165
  return CodeBlockView;
159
166
  }();
160
- export var highlightingCodeBlockNodeView = function highlightingCodeBlockNodeView() {
167
+ export var highlightingCodeBlockNodeView = function highlightingCodeBlockNodeView(_ref) {
168
+ var codeBidiWarnings = _ref.codeBidiWarnings,
169
+ codeBidiWarningLabel = _ref.codeBidiWarningLabel,
170
+ codeBidiWarningTooltipEnabled = _ref.codeBidiWarningTooltipEnabled;
161
171
  return function (node, view, getPos) {
162
- return new CodeBlockView(node, view, getPos);
172
+ return new CodeBlockView(node, view, getPos, {
173
+ label: codeBidiWarningLabel,
174
+ enabled: codeBidiWarnings,
175
+ tooltipEnabled: codeBidiWarningTooltipEnabled
176
+ });
163
177
  };
164
178
  };
@@ -5,6 +5,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
6
 
7
7
  import { Plugin, NodeSelection } from 'prosemirror-state';
8
+ import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
8
9
  import { codeBlockNodeView } from '../nodeviews/code-block';
9
10
  import { highlightingCodeBlockNodeView } from '../nodeviews/highlighting-code-block';
10
11
  import { createSelectionClickHandler } from '../../selection/utils';
@@ -13,8 +14,13 @@ import { ACTIONS } from './actions';
13
14
  import { findCodeBlock } from '../utils';
14
15
  import { codeBlockClassNames } from '../ui/class-names';
15
16
  import { getFeatureFlags } from '../../feature-flags-context';
16
- export var createPlugin = function createPlugin() {
17
- var useLongPressSelection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
17
+ export var createPlugin = function createPlugin(_ref) {
18
+ var _ref$useLongPressSele = _ref.useLongPressSelection,
19
+ useLongPressSelection = _ref$useLongPressSele === void 0 ? false : _ref$useLongPressSele,
20
+ reactContext = _ref.reactContext,
21
+ appearance = _ref.appearance;
22
+ var intl = reactContext().intl;
23
+ var codeBidiWarningLabel = intl.formatMessage(codeBidiWarningMessages.label);
18
24
  return new Plugin({
19
25
  state: {
20
26
  init: function init(_, state) {
@@ -52,8 +58,18 @@ export var createPlugin = function createPlugin() {
52
58
  props: {
53
59
  nodeViews: {
54
60
  codeBlock: function codeBlock(node, view, getPos) {
55
- var featureFlags = getFeatureFlags(view.state);
56
- var createCodeBlockNodeView = featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? highlightingCodeBlockNodeView() : codeBlockNodeView();
61
+ var featureFlags = getFeatureFlags(view.state); // The appearance being mobile indicates we are in an editor being
62
+ // rendered by mobile bridge in a web view.
63
+ // The tooltip is likely to have unexpected behaviour there, with being cut
64
+ // off, so we disable it. This is also to keep the behaviour consistent with
65
+ // the rendering in the mobile Native Renderer.
66
+
67
+ var codeBidiWarningTooltipEnabled = appearance !== 'mobile';
68
+ var createCodeBlockNodeView = featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? highlightingCodeBlockNodeView({
69
+ codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
70
+ codeBidiWarningLabel: codeBidiWarningLabel,
71
+ codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
72
+ }) : codeBlockNodeView();
57
73
  return createCodeBlockNodeView(node, view, getPos);
58
74
  }
59
75
  },
@@ -13,7 +13,7 @@ import { browser } from '@atlaskit/editor-common';
13
13
  */
14
14
 
15
15
  export function createFeatureFlagsFromProps(props) {
16
- var _props$allowTextColor, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$featureFlags10, _props$featureFlags11, _props$allowTables5, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27;
16
+ var _props$allowTextColor, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$featureFlags10, _props$featureFlags11, _props$allowTables5, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29;
17
17
 
18
18
  var normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
19
19
  return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
@@ -43,6 +43,7 @@ export function createFeatureFlagsFromProps(props) {
43
43
  enableViewUpdateSubscription: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22.enableViewUpdateSubscription) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23.enableViewUpdateSubscription) : false),
44
44
  collabAvatarScroll: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.collabAvatarScroll) : false),
45
45
  ufo: Boolean(typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.ufo) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.ufo) : false),
46
- codeBlockSyntaxHighlighting: Boolean(typeof normalizedFeatureFlags.codeBlockSyntaxHighlighting === 'boolean' ? !!normalizedFeatureFlags.codeBlockSyntaxHighlighting && !browser.safari : false)
46
+ codeBlockSyntaxHighlighting: Boolean(typeof normalizedFeatureFlags.codeBlockSyntaxHighlighting === 'boolean' ? !!normalizedFeatureFlags.codeBlockSyntaxHighlighting && !browser.safari : false),
47
+ codeBidiWarnings: Boolean(typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.codeBidiWarnings) === 'boolean' ? !!((_props$featureFlags29 = props.featureFlags) !== null && _props$featureFlags29 !== void 0 && _props$featureFlags29.codeBidiWarnings) : true)
47
48
  });
48
49
  }
@@ -158,10 +158,10 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
158
158
  }
159
159
 
160
160
  _createClass(HyperlinkToolbarAppearance, [{
161
- key: "componentWillReceiveProps",
161
+ key: "UNSAFE_componentWillReceiveProps",
162
162
  value: // needed so we display the right state on the Toolbar while the same Toolbar
163
163
  // instance is visible and we click other link
164
- function componentWillReceiveProps(nextProps) {
164
+ function UNSAFE_componentWillReceiveProps(nextProps) {
165
165
  if (nextProps.url !== this.props.url) {
166
166
  this.resolveUrl(nextProps.url);
167
167
  }
@@ -60,4 +60,5 @@ export { default as mobileSelectionPlugin } from './mobile-selection';
60
60
  export { default as clipboardPlugin } from './clipboard';
61
61
  export { default as undoRedoPlugin } from './undo-redo';
62
62
  export { default as avatarGroupPlugin } from './avatar-group';
63
- export { default as viewUpdateSubscriptionPlugin } from './view-update-subscription';
63
+ export { default as viewUpdateSubscriptionPlugin } from './view-update-subscription';
64
+ export { default as codeBidiWarningPlugin } from './code-bidi-warning';
@@ -6,7 +6,7 @@ export default {
6
6
  // https://product-fabric.atlassian.net/wiki/spaces/E/pages/1113098008/Selection+Guide#Special-Cases
7
7
  'expandKeymap', 'tableSelectionKeymap', 'tableKeymap', 'captionKeymap', // selection keymap needs to be above gap cursor keymap so it can set node selections from
8
8
  // left/right arrows
9
- 'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaKeymap', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription'],
9
+ 'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaKeymap', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'inlineCode'],
10
10
  nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
11
11
  marks: [// Inline marks
12
12
  'link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'typeAheadQuery', // Block marks
@@ -5,4 +5,4 @@ var _templateObject;
5
5
  import { css } from 'styled-components';
6
6
  import { StatusSharedCssClassName } from '@atlaskit/editor-common';
7
7
  import { SelectionStyle, getSelectionStyles, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
8
- export var statusStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n display: inline-block;\n\n > span {\n display: inline-block;\n cursor: pointer;\n line-height: 0; /* Prevent responsive layouts increasing height of container. */\n }\n\n &.", "\n .", "\n > span {\n ", "\n }\n }\n\n .danger {\n .", " > span {\n background-color: ", ";\n }\n\n .", ".", "\n .", "\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n }\n }\n"])), StatusSharedCssClassName.STATUS_CONTAINER, akEditorSelectedNodeClassName, StatusSharedCssClassName.STATUS_LOZENGE, getSelectionStyles([SelectionStyle.BoxShadow]), StatusSharedCssClassName.STATUS_LOZENGE, akEditorDeleteBackgroundWithOpacity, StatusSharedCssClassName.STATUS_CONTAINER, akEditorSelectedNodeClassName, StatusSharedCssClassName.STATUS_LOZENGE, akEditorSelectedBorderSize, akEditorDeleteBorder);
8
+ export var statusStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n // these two styles can be removed when displayInlineBlockForInlineNodes is enabled by default\n // as it will make all inline nodes inline-block by default\n display: inline-block;\n user-select: all;\n\n > span {\n display: inline-block;\n cursor: pointer;\n line-height: 0; /* Prevent responsive layouts increasing height of container. */\n }\n\n &.", "\n .", "\n > span {\n ", "\n }\n }\n\n .danger {\n .", " > span {\n background-color: ", ";\n }\n\n .", ".", "\n .", "\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n }\n }\n"])), StatusSharedCssClassName.STATUS_CONTAINER, akEditorSelectedNodeClassName, StatusSharedCssClassName.STATUS_LOZENGE, getSelectionStyles([SelectionStyle.BoxShadow]), StatusSharedCssClassName.STATUS_LOZENGE, akEditorDeleteBackgroundWithOpacity, StatusSharedCssClassName.STATUS_CONTAINER, akEditorSelectedNodeClassName, StatusSharedCssClassName.STATUS_LOZENGE, akEditorSelectedBorderSize, akEditorDeleteBorder);
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "151.0.0";
2
+ export var version = "151.2.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "151.0.0",
3
+ "version": "151.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,5 @@
1
+ import type { EditorPlugin, EditorProps } from '../../types';
2
+ declare const codeBidiWarning: ({ appearance, }: {
3
+ appearance: EditorProps['appearance'];
4
+ }) => EditorPlugin;
5
+ export default codeBidiWarning;
@@ -0,0 +1,2 @@
1
+ import { PluginKey } from 'prosemirror-state';
2
+ export declare const codeBidiWarningPluginKey: PluginKey<any, any>;
@@ -0,0 +1,5 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import type { EditorProps, PMPluginFactoryParams } from '../../../types';
3
+ export declare const createPlugin: ({ dispatch, reactContext }: PMPluginFactoryParams, { appearance }: {
4
+ appearance: EditorProps['appearance'];
5
+ }) => Plugin<any, import("prosemirror-model").Schema<any, any>>;
@@ -0,0 +1,8 @@
1
+ import { DecorationSet } from 'prosemirror-view';
2
+ import { Node as PmNode } from 'prosemirror-model';
3
+ export declare const createPluginState: (dispatch: import("../../../event-dispatcher").Dispatch<any>, initialState: import("./types").CodeBidiWarningPluginState | ((state: import("prosemirror-state").EditorState<any>) => import("./types").CodeBidiWarningPluginState)) => import("prosemirror-state").StateField<import("./types").CodeBidiWarningPluginState, import("prosemirror-model").Schema<any, any>>, getPluginState: (state: import("prosemirror-state").EditorState<any>) => import("./types").CodeBidiWarningPluginState;
4
+ export declare function createBidiWarningsDecorationSetFromDoc({ doc, codeBidiWarningLabel, tooltipEnabled, }: {
5
+ doc: PmNode<any>;
6
+ codeBidiWarningLabel: string;
7
+ tooltipEnabled: boolean;
8
+ }): DecorationSet<any>;
@@ -0,0 +1,3 @@
1
+ import { CodeBidiWarningPluginState } from './types';
2
+ declare const _default: (pluginState: CodeBidiWarningPluginState, action: unknown) => CodeBidiWarningPluginState;
3
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { DecorationSet } from 'prosemirror-view';
2
+ export declare type CodeBidiWarningPluginState = {
3
+ decorationSet: DecorationSet;
4
+ codeBidiWarningLabel: string;
5
+ tooltipEnabled: boolean;
6
+ };
@@ -1,4 +1,4 @@
1
1
  import { EditorPlugin } from '../../types';
2
2
  import { CodeBlockOptions } from './types';
3
- declare const codeBlockPlugin: (options?: CodeBlockOptions) => EditorPlugin;
3
+ declare const codeBlockPlugin: (options: CodeBlockOptions) => EditorPlugin;
4
4
  export default codeBlockPlugin;
@@ -2,6 +2,20 @@ import { EditorView } from 'prosemirror-view';
2
2
  import { Node } from 'prosemirror-model';
3
3
  import { getPosHandlerNode, getPosHandler } from '../../../nodeviews/';
4
4
  import React from 'react';
5
+ declare type CodeBidiWarningOptions = {
6
+ label: string;
7
+ /**
8
+ * Intended to be disabled when used in a mobile view, such as in the editor
9
+ * via mobile bridge, where the tooltip could end up being cut off of otherwise
10
+ * not work as expected.
11
+ */
12
+ tooltipEnabled: boolean;
13
+ /**
14
+ * Indicates if code bidi warning should be used, was created to allow
15
+ * disabling code bidi warnings via a feature flag in products.
16
+ */
17
+ enabled?: boolean;
18
+ };
5
19
  export declare class CodeBlockView {
6
20
  node: Node;
7
21
  dom: HTMLElement;
@@ -11,11 +25,12 @@ export declare class CodeBlockView {
11
25
  highlighter: React.ReactElement | null;
12
26
  getPos: getPosHandlerNode;
13
27
  view: EditorView;
28
+ codeBidiWarningOptions: CodeBidiWarningOptions;
14
29
  measurements: number[];
15
30
  count: number;
16
31
  shouldDebounce: boolean;
17
32
  timer: number | null;
18
- constructor(node: Node, view: EditorView, getPos: getPosHandlerNode);
33
+ constructor(node: Node, view: EditorView, getPos: getPosHandlerNode, codeBidiWarningOptions: CodeBidiWarningOptions);
19
34
  private measure;
20
35
  private highlight;
21
36
  private ensureLineNumbers;
@@ -25,4 +40,9 @@ export declare class CodeBlockView {
25
40
  target: Element;
26
41
  }): boolean;
27
42
  }
28
- export declare const highlightingCodeBlockNodeView: () => (node: Node, view: EditorView, getPos: getPosHandler) => CodeBlockView;
43
+ export declare const highlightingCodeBlockNodeView: ({ codeBidiWarnings, codeBidiWarningLabel, codeBidiWarningTooltipEnabled, }: {
44
+ codeBidiWarnings?: boolean | undefined;
45
+ codeBidiWarningLabel: string;
46
+ codeBidiWarningTooltipEnabled: boolean;
47
+ }) => (node: Node, view: EditorView, getPos: getPosHandler) => CodeBlockView;
48
+ export {};
@@ -1,2 +1,8 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
- export declare const createPlugin: (useLongPressSelection?: boolean) => Plugin<any, any>;
2
+ import type { EditorProps } from '../../../types';
3
+ import { EditorReactContext } from '../../../types/editor-react-context';
4
+ export declare const createPlugin: ({ useLongPressSelection, reactContext, appearance, }: {
5
+ useLongPressSelection?: boolean | undefined;
6
+ reactContext: () => EditorReactContext;
7
+ appearance: EditorProps['appearance'];
8
+ }) => Plugin<any, any>;
@@ -1,4 +1,6 @@
1
+ import type { EditorAppearance } from '../../types';
1
2
  import { LongPressSelectionPluginOptions } from '../selection/types';
2
3
  export interface CodeBlockOptions extends LongPressSelectionPluginOptions {
3
4
  allowCopyToClipboard?: boolean;
5
+ appearance: EditorAppearance | undefined;
4
6
  }
@@ -4,4 +4,4 @@ import type { FeatureFlags } from '../../types/feature-flags';
4
4
  *
5
5
  * Useful for analytics and analysis purposes.
6
6
  */
7
- export declare function getEnabledFeatureFlagKeys(featureFlags: FeatureFlags): ("newInsertionBehaviour" | "interactiveExpand" | "placeholderBracketHint" | "placeholderHints" | "moreTextColors" | "findReplace" | "findReplaceMatchCase" | "extensionLocalIdGeneration" | "keyboardAccessibleDatepicker" | "addColumnWithCustomStep" | "undoRedoButtons" | "catchAllTracking" | "nextEmojiNodeView" | "stickyHeadersOptimization" | "initialRenderOptimization" | "mouseMoveOptimization" | "tableRenderOptimization" | "tableOverflowShadowsOptimization" | "codeBlockSyntaxHighlighting" | "queueAnalytics" | "extendFloatingToolbar" | "displayInlineBlockForInlineNodes" | "useUnpredictableInputRule" | "showAvatarGroupAsPlugin" | "errorBoundaryDocStructure" | "synchronyErrorDocStructure" | "enableViewUpdateSubscription" | "collabAvatarScroll" | "ufo")[];
7
+ export declare function getEnabledFeatureFlagKeys(featureFlags: FeatureFlags): ("newInsertionBehaviour" | "interactiveExpand" | "placeholderBracketHint" | "placeholderHints" | "moreTextColors" | "findReplace" | "findReplaceMatchCase" | "extensionLocalIdGeneration" | "keyboardAccessibleDatepicker" | "addColumnWithCustomStep" | "undoRedoButtons" | "catchAllTracking" | "nextEmojiNodeView" | "stickyHeadersOptimization" | "initialRenderOptimization" | "mouseMoveOptimization" | "tableRenderOptimization" | "tableOverflowShadowsOptimization" | "codeBlockSyntaxHighlighting" | "codeBidiWarnings" | "queueAnalytics" | "extendFloatingToolbar" | "displayInlineBlockForInlineNodes" | "useUnpredictableInputRule" | "showAvatarGroupAsPlugin" | "errorBoundaryDocStructure" | "synchronyErrorDocStructure" | "enableViewUpdateSubscription" | "collabAvatarScroll" | "ufo")[];
@@ -23,6 +23,6 @@ export declare class HyperlinkToolbarAppearance extends Component<HyperlinkToolb
23
23
  private getProvider;
24
24
  private resolveUrl;
25
25
  componentDidMount: () => Promise<void>;
26
- componentWillReceiveProps(nextProps: HyperlinkToolbarAppearanceProps): void;
26
+ UNSAFE_componentWillReceiveProps(nextProps: HyperlinkToolbarAppearanceProps): void;
27
27
  render(): JSX.Element | null;
28
28
  }
@@ -63,3 +63,4 @@ export { default as clipboardPlugin } from './clipboard';
63
63
  export { default as undoRedoPlugin } from './undo-redo';
64
64
  export { default as avatarGroupPlugin } from './avatar-group';
65
65
  export { default as viewUpdateSubscriptionPlugin } from './view-update-subscription';
66
+ export { default as codeBidiWarningPlugin } from './code-bidi-warning';
@@ -179,6 +179,15 @@ export declare type FeatureFlags = {
179
179
  * @default false
180
180
  */
181
181
  codeBlockSyntaxHighlighting?: boolean;
182
+ /**
183
+ * @description
184
+ * Disables decorating code snippets with bidi character warnings
185
+ * when they are used in inline code and code blocks.
186
+ *
187
+ * @see https://product-fabric.atlassian.net/browse/ED-13860
188
+ * @default true
189
+ */
190
+ codeBidiWarnings?: boolean;
182
191
  /**
183
192
  * @description
184
193
  * Yield to user interaction work before sending analytics
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "151.0.0",
3
+ "version": "151.2.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -38,11 +38,11 @@
38
38
  "@atlaskit/button": "^16.1.0",
39
39
  "@atlaskit/calendar": "^12.1.0",
40
40
  "@atlaskit/checkbox": "^12.3.0",
41
- "@atlaskit/code": "^14.1.0",
41
+ "@atlaskit/code": "^14.3.0",
42
42
  "@atlaskit/date": "^0.8.0",
43
43
  "@atlaskit/datetime-picker": "^11.1.0",
44
44
  "@atlaskit/droplist": "^11.0.0",
45
- "@atlaskit/editor-common": "^60.2.0",
45
+ "@atlaskit/editor-common": "^60.3.0",
46
46
  "@atlaskit/editor-json-transformer": "^8.6.0",
47
47
  "@atlaskit/editor-markdown-transformer": "^4.1.0",
48
48
  "@atlaskit/editor-shared-styles": "^1.6.0",
@@ -137,7 +137,7 @@
137
137
  "devDependencies": {
138
138
  "@atlaskit/atlassian-navigation": "^1.2.0",
139
139
  "@atlaskit/breadcrumbs": "11.4.0",
140
- "@atlaskit/code": "^14.1.0",
140
+ "@atlaskit/code": "^14.3.0",
141
141
  "@atlaskit/collab-provider": "7.1.0",
142
142
  "@atlaskit/docs": "*",
143
143
  "@atlaskit/drawer": "^7.0.0",
@@ -155,7 +155,7 @@
155
155
  "@atlaskit/page-layout": "^1.0.1",
156
156
  "@atlaskit/profilecard": "^15.8.0",
157
157
  "@atlaskit/pubsub": "^6.0.0",
158
- "@atlaskit/renderer": "^82.0.0",
158
+ "@atlaskit/renderer": "^82.2.0",
159
159
  "@atlaskit/section-message": "^6.1.0",
160
160
  "@atlaskit/share": "*",
161
161
  "@atlaskit/smart-card": "^16.2.0",
@@ -169,7 +169,7 @@
169
169
  "@atlaskit/webdriver-runner": "*",
170
170
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
171
171
  "@atlassian/search-provider": "2.1.15",
172
- "@atlassian/ufo": "^0.0.28",
172
+ "@atlassian/ufo": "^0.0.29",
173
173
  "@testing-library/react": "^8.0.1",
174
174
  "@testing-library/react-hooks": "^1.0.4",
175
175
  "@types/jscodeshift": "^0.11.0",