@atlaskit/editor-common 74.31.0 → 74.32.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2b54c3b0d24`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2b54c3b0d24) - [ED-19203] Decouple text-formatting plugin and editor-core
8
+
3
9
  ## 74.31.0
4
10
 
5
11
  ### Minor Changes
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  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; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "74.31.0";
19
+ var packageVersion = "74.32.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
24
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
25
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "74.31.0";
27
+ var packageVersion = "74.32.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -442,6 +442,12 @@ Object.defineProperty(exports, "hasVisibleContent", {
442
442
  return _document.hasVisibleContent;
443
443
  }
444
444
  });
445
+ Object.defineProperty(exports, "inputRuleWithAnalytics", {
446
+ enumerable: true,
447
+ get: function get() {
448
+ return _inputRules.inputRuleWithAnalytics;
449
+ }
450
+ });
445
451
  Object.defineProperty(exports, "insertContentDeleteRange", {
446
452
  enumerable: true,
447
453
  get: function get() {
@@ -933,6 +939,7 @@ var _richMediaUtils = require("./rich-media-utils");
933
939
  var _privacyFilter = require("./filter/privacy-filter");
934
940
  var _datasource = require("./datasource");
935
941
  var _commands = require("./commands");
942
+ var _inputRules = require("./input-rules");
936
943
  // prosemirror-history does not export its plugin key
937
944
  var pmHistoryPluginKey = 'history$';
938
945
  exports.pmHistoryPluginKey = pmHistoryPluginKey;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.inputRuleWithAnalytics = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
+ // Roughly based on atlassian-frontend/packages/editor/editor-core/src/utils/input-rules.ts but with the Editor Analytics API that's injected in plugins
12
+ var inputRuleWithAnalytics = function inputRuleWithAnalytics(getPayload, analyticsApi) {
13
+ return function (originalRule) {
14
+ var onHandlerApply = function onHandlerApply(state, tr, matchResult) {
15
+ var payload = typeof getPayload === 'function' ? getPayload(state, matchResult) : getPayload;
16
+ analyticsApi === null || analyticsApi === void 0 ? void 0 : analyticsApi.attachAnalyticsEvent(payload)(tr);
17
+ if (originalRule.onHandlerApply) {
18
+ originalRule.onHandlerApply(state, tr, matchResult);
19
+ }
20
+ };
21
+ return _objectSpread(_objectSpread({}, originalRule), {}, {
22
+ onHandlerApply: onHandlerApply
23
+ });
24
+ };
25
+ };
26
+ exports.inputRuleWithAnalytics = inputRuleWithAnalytics;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.31.0",
3
+ "version": "74.32.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "74.31.0";
3
+ const packageVersion = "74.32.0";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -0,0 +1 @@
1
+ export {};
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
8
8
  import { borderRadius } from '@atlaskit/theme/constants';
9
9
  import Layer from '../Layer';
10
10
  const packageName = "@atlaskit/editor-common";
11
- const packageVersion = "74.31.0";
11
+ const packageVersion = "74.32.0";
12
12
  const halfFocusRing = 1;
13
13
  const dropOffset = '0, 8';
14
14
  class DropList extends Component {
@@ -50,4 +50,5 @@ export function shallowEqual(obj1 = {}, obj2 = {}) {
50
50
  const keys1 = Object.keys(obj1);
51
51
  const keys2 = Object.keys(obj2);
52
52
  return keys1.length === keys2.length && keys1.reduce((acc, key) => acc && obj1[key] === obj2[key], true);
53
- }
53
+ }
54
+ export { inputRuleWithAnalytics } from './input-rules';
@@ -0,0 +1,16 @@
1
+ // Roughly based on atlassian-frontend/packages/editor/editor-core/src/utils/input-rules.ts but with the Editor Analytics API that's injected in plugins
2
+ export const inputRuleWithAnalytics = (getPayload, analyticsApi) => {
3
+ return originalRule => {
4
+ const onHandlerApply = (state, tr, matchResult) => {
5
+ const payload = typeof getPayload === 'function' ? getPayload(state, matchResult) : getPayload;
6
+ analyticsApi === null || analyticsApi === void 0 ? void 0 : analyticsApi.attachAnalyticsEvent(payload)(tr);
7
+ if (originalRule.onHandlerApply) {
8
+ originalRule.onHandlerApply(state, tr, matchResult);
9
+ }
10
+ };
11
+ return {
12
+ ...originalRule,
13
+ onHandlerApply
14
+ };
15
+ };
16
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.31.0",
3
+ "version": "74.32.0",
4
4
  "sideEffects": false
5
5
  }
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "74.31.0";
9
+ var packageVersion = "74.32.0";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -0,0 +1 @@
1
+ export {};
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
18
18
  import { borderRadius } from '@atlaskit/theme/constants';
19
19
  import Layer from '../Layer';
20
20
  var packageName = "@atlaskit/editor-common";
21
- var packageVersion = "74.31.0";
21
+ var packageVersion = "74.32.0";
22
22
  var halfFocusRing = 1;
23
23
  var dropOffset = '0, 8';
24
24
  var DropList = /*#__PURE__*/function (_Component) {
@@ -54,4 +54,5 @@ export function shallowEqual() {
54
54
  return keys1.length === keys2.length && keys1.reduce(function (acc, key) {
55
55
  return acc && obj1[key] === obj2[key];
56
56
  }, true);
57
- }
57
+ }
58
+ export { inputRuleWithAnalytics } from './input-rules';
@@ -0,0 +1,18 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ // Roughly based on atlassian-frontend/packages/editor/editor-core/src/utils/input-rules.ts but with the Editor Analytics API that's injected in plugins
5
+ export var inputRuleWithAnalytics = function inputRuleWithAnalytics(getPayload, analyticsApi) {
6
+ return function (originalRule) {
7
+ var onHandlerApply = function onHandlerApply(state, tr, matchResult) {
8
+ var payload = typeof getPayload === 'function' ? getPayload(state, matchResult) : getPayload;
9
+ analyticsApi === null || analyticsApi === void 0 ? void 0 : analyticsApi.attachAnalyticsEvent(payload)(tr);
10
+ if (originalRule.onHandlerApply) {
11
+ originalRule.onHandlerApply(state, tr, matchResult);
12
+ }
13
+ };
14
+ return _objectSpread(_objectSpread({}, originalRule), {}, {
15
+ onHandlerApply: onHandlerApply
16
+ });
17
+ };
18
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.31.0",
3
+ "version": "74.32.0",
4
4
  "sideEffects": false
5
5
  }
@@ -41,3 +41,4 @@ export type { DatasourceModalType } from './datasource';
41
41
  export type { ImageUploadPluginReferenceEventBase, ImageUploadPluginReferenceEventDragEvent, ImageUploadPluginReferenceEventClipboardEvent, ImageUploadPluginReferenceEvent, } from './image-upload-reference-event';
42
42
  export type { HeadingLevels, NormalTextLevel, HeadingLevelsAndNormalText, } from './block-type';
43
43
  export type { ColumnResizingPluginState } from './tables';
44
+ export type { InputRuleHandler, OnHandlerApply, InputRuleWrapper, } from './input-rules';
@@ -0,0 +1,8 @@
1
+ import type { EditorState, Transaction } from 'prosemirror-state';
2
+ export type InputRuleHandler = (state: EditorState, matchResult: RegExpExecArray, start: number, end: number) => Transaction | null;
3
+ export type OnHandlerApply = (state: EditorState, tr: Transaction, matchResult: RegExpExecArray) => void;
4
+ export interface InputRuleWrapper {
5
+ match: RegExp;
6
+ handler: InputRuleHandler;
7
+ onHandlerApply?: OnHandlerApply;
8
+ }
@@ -58,3 +58,4 @@ export { canRenderDatasource } from './datasource';
58
58
  export { filterCommand, walkPrevNode, walkNextNode, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp, } from './commands';
59
59
  export type { WalkNode } from './commands';
60
60
  export declare function shallowEqual(obj1?: any, obj2?: any): boolean;
61
+ export { inputRuleWithAnalytics } from './input-rules';
@@ -0,0 +1,7 @@
1
+ import type { EditorState } from 'prosemirror-state';
2
+ import type { EditorAnalyticsAPI } from '../analytics';
3
+ import type { AnalyticsEventPayload } from '../analytics/types';
4
+ import type { InputRuleWrapper } from '../types/input-rules';
5
+ type GetPayload = AnalyticsEventPayload | ((state: EditorState, matchResult: RegExpExecArray) => AnalyticsEventPayload);
6
+ export declare const inputRuleWithAnalytics: (getPayload: GetPayload, analyticsApi: EditorAnalyticsAPI | undefined) => (originalRule: InputRuleWrapper) => InputRuleWrapper;
7
+ export {};
@@ -41,3 +41,4 @@ export type { DatasourceModalType } from './datasource';
41
41
  export type { ImageUploadPluginReferenceEventBase, ImageUploadPluginReferenceEventDragEvent, ImageUploadPluginReferenceEventClipboardEvent, ImageUploadPluginReferenceEvent, } from './image-upload-reference-event';
42
42
  export type { HeadingLevels, NormalTextLevel, HeadingLevelsAndNormalText, } from './block-type';
43
43
  export type { ColumnResizingPluginState } from './tables';
44
+ export type { InputRuleHandler, OnHandlerApply, InputRuleWrapper, } from './input-rules';
@@ -0,0 +1,8 @@
1
+ import type { EditorState, Transaction } from 'prosemirror-state';
2
+ export type InputRuleHandler = (state: EditorState, matchResult: RegExpExecArray, start: number, end: number) => Transaction | null;
3
+ export type OnHandlerApply = (state: EditorState, tr: Transaction, matchResult: RegExpExecArray) => void;
4
+ export interface InputRuleWrapper {
5
+ match: RegExp;
6
+ handler: InputRuleHandler;
7
+ onHandlerApply?: OnHandlerApply;
8
+ }
@@ -58,3 +58,4 @@ export { canRenderDatasource } from './datasource';
58
58
  export { filterCommand, walkPrevNode, walkNextNode, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp, } from './commands';
59
59
  export type { WalkNode } from './commands';
60
60
  export declare function shallowEqual(obj1?: any, obj2?: any): boolean;
61
+ export { inputRuleWithAnalytics } from './input-rules';
@@ -0,0 +1,7 @@
1
+ import type { EditorState } from 'prosemirror-state';
2
+ import type { EditorAnalyticsAPI } from '../analytics';
3
+ import type { AnalyticsEventPayload } from '../analytics/types';
4
+ import type { InputRuleWrapper } from '../types/input-rules';
5
+ type GetPayload = AnalyticsEventPayload | ((state: EditorState, matchResult: RegExpExecArray) => AnalyticsEventPayload);
6
+ export declare const inputRuleWithAnalytics: (getPayload: GetPayload, analyticsApi: EditorAnalyticsAPI | undefined) => (originalRule: InputRuleWrapper) => InputRuleWrapper;
7
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.31.0",
3
+ "version": "74.32.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"