@atlaskit/editor-plugin-text-formatting 1.2.0 → 1.2.2

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,42 @@
1
1
  # @atlaskit/editor-plugin-text-formatting
2
2
 
3
+ ## 1.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#78224](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78224) [`6b4c9dd4ad34`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b4c9dd4ad34) - ED-22219: adf-schema updated to 35.5.2
8
+ - Updated dependencies
9
+
10
+ ## 1.2.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [#75482](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75482) [`18b5a6fb910a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/18b5a6fb910a) - # MAJOR CHANGE to `@atlaskit/prosemirror-input-rules` package.
15
+
16
+ ## WHY?
17
+
18
+ Removing editor-common dependencies from prosemirror-input-rules package.
19
+
20
+ This makes it easier for editor updates because it simplifies our dependency graph.
21
+
22
+ ## WHAT and HOW?
23
+
24
+ These are no longer available via `@atlaskit/prosemirror-input-rules` but are available from `@atlaskit/editor-common/types`:
25
+
26
+ - InputRuleWrapper
27
+ - InputRuleHandler
28
+ - OnHandlerApply
29
+ - createRule
30
+
31
+ These have changed from a `SafePlugin` to a `SafePluginSpec`. In order to update your code you need to instantiate a `SafePlugin` (ie. `new SafePlugin(createPlugin( ... ))`).
32
+
33
+ `SafePlugin` exists in `@atlaskit/editor-common/safe-plugin`.
34
+
35
+ - createPlugin
36
+ - createInputRulePlugin
37
+
38
+ - Updated dependencies
39
+
3
40
  ## 1.2.0
4
41
 
5
42
  ### Minor Changes
@@ -18,6 +18,7 @@ var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/w
18
18
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
19
19
  var _analytics = require("@atlaskit/editor-common/analytics");
20
20
  var _mark = require("@atlaskit/editor-common/mark");
21
+ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
21
22
  var _utils = require("@atlaskit/editor-common/utils");
22
23
  var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
23
24
  var _ValidCombinations;
@@ -179,8 +180,8 @@ function getStrongInputRules(schema, editorAnalyticsAPI) {
179
180
  }
180
181
  }, editorAnalyticsAPI);
181
182
  // **string** or __strong__ should bold the text
182
- var doubleUnderscoreRule = (0, _prosemirrorInputRules.createRule)(strongRegex1, addMark(schema.marks.strong, schema, ValidAutoformatChars.STRONG));
183
- var doubleAsterixRule = (0, _prosemirrorInputRules.createRule)(strongRegex2, addMark(schema.marks.strong, schema, ValidAutoformatChars.STRONG_MARKDOWN));
183
+ var doubleUnderscoreRule = (0, _utils.createRule)(strongRegex1, addMark(schema.marks.strong, schema, ValidAutoformatChars.STRONG));
184
+ var doubleAsterixRule = (0, _utils.createRule)(strongRegex2, addMark(schema.marks.strong, schema, ValidAutoformatChars.STRONG_MARKDOWN));
184
185
  return [ruleWithStrongAnalytics(doubleUnderscoreRule), ruleWithStrongAnalytics(doubleAsterixRule)];
185
186
  }
186
187
 
@@ -200,8 +201,8 @@ function getItalicInputRules(schema, editorAnalyticsAPI) {
200
201
  inputMethod: _analytics.INPUT_METHOD.FORMATTING
201
202
  }
202
203
  }, editorAnalyticsAPI);
203
- var underscoreRule = (0, _prosemirrorInputRules.createRule)(italicRegex1, addMark(schema.marks.em, schema, ValidAutoformatChars.ITALIC));
204
- var asterixRule = (0, _prosemirrorInputRules.createRule)(italicRegex2, addMark(schema.marks.em, schema, ValidAutoformatChars.ITALIC_MARKDOWN));
204
+ var underscoreRule = (0, _utils.createRule)(italicRegex1, addMark(schema.marks.em, schema, ValidAutoformatChars.ITALIC));
205
+ var asterixRule = (0, _utils.createRule)(italicRegex2, addMark(schema.marks.em, schema, ValidAutoformatChars.ITALIC_MARKDOWN));
205
206
  return [ruleWithItalicAnalytics(underscoreRule), ruleWithItalicAnalytics(asterixRule)];
206
207
  }
207
208
 
@@ -221,7 +222,7 @@ function getStrikeInputRules(schema, editorAnalyticsAPI) {
221
222
  inputMethod: _analytics.INPUT_METHOD.FORMATTING
222
223
  }
223
224
  }, editorAnalyticsAPI);
224
- var doubleTildeRule = (0, _prosemirrorInputRules.createRule)(strikeRegex, addMark(schema.marks.strike, schema, ValidAutoformatChars.STRIKE));
225
+ var doubleTildeRule = (0, _utils.createRule)(strikeRegex, addMark(schema.marks.strike, schema, ValidAutoformatChars.STRIKE));
225
226
  return [ruleWithStrikeAnalytics(doubleTildeRule)];
226
227
  }
227
228
 
@@ -241,7 +242,7 @@ function getCodeInputRules(schema, editorAnalyticsAPI) {
241
242
  inputMethod: _analytics.INPUT_METHOD.FORMATTING
242
243
  }
243
244
  }, editorAnalyticsAPI);
244
- var backTickRule = (0, _prosemirrorInputRules.createRule)(codeRegex, addMark(schema.marks.code, schema, ValidAutoformatChars.CODE));
245
+ var backTickRule = (0, _utils.createRule)(codeRegex, addMark(schema.marks.code, schema, ValidAutoformatChars.CODE));
245
246
  return [ruleWithCodeAnalytics(backTickRule)];
246
247
  }
247
248
  function inputRulePlugin(schema, editorAnalyticsAPI) {
@@ -259,7 +260,7 @@ function inputRulePlugin(schema, editorAnalyticsAPI) {
259
260
  rules.push.apply(rules, (0, _toConsumableArray2.default)(getCodeInputRules(schema, editorAnalyticsAPI)));
260
261
  }
261
262
  if (rules.length !== 0) {
262
- return (0, _prosemirrorInputRules.createPlugin)('text-formatting', rules);
263
+ return new _safePlugin.SafePlugin((0, _prosemirrorInputRules.createPlugin)('text-formatting', rules));
263
264
  }
264
265
  return;
265
266
  }
@@ -9,6 +9,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _analytics = require("@atlaskit/editor-common/analytics");
12
+ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
13
  var _utils = require("@atlaskit/editor-common/utils");
13
14
  var _state = require("@atlaskit/editor-prosemirror/state");
14
15
  var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
@@ -38,7 +39,7 @@ function replaceTextUsingCaptureGroup(text) {
38
39
  };
39
40
  }
40
41
  function createReplacementRule(to, from) {
41
- return (0, _prosemirrorInputRules.createRule)(from, replaceTextUsingCaptureGroup(to));
42
+ return (0, _utils.createRule)(from, replaceTextUsingCaptureGroup(to));
42
43
  }
43
44
 
44
45
  /**
@@ -64,7 +65,7 @@ function createReplacementRules(replMap, replacementRuleWithAnalytics) {
64
65
  function createSingleQuotesRules() {
65
66
  return [
66
67
  // wrapped text
67
- (0, _prosemirrorInputRules.createRule)(/(\s|^)'(\S+.*\S+)'$/, function (state, match, start, end) {
68
+ (0, _utils.createRule)(/(\s|^)'(\S+.*\S+)'$/, function (state, match, start, end) {
68
69
  var OPEN_SMART_QUOTE_CHAR = '‘';
69
70
  var CLOSED_SMART_QUOTE_CHAR = '’';
70
71
  var _match2 = (0, _slicedToArray2.default)(match, 3),
@@ -171,5 +172,5 @@ function getPunctuationRules(editorAnalyticsAPI) {
171
172
  })));
172
173
  }
173
174
  var _default = exports.default = function _default(editorAnalyticsAPI) {
174
- return (0, _prosemirrorInputRules.createPlugin)('text-formatting:smart-input', [].concat((0, _toConsumableArray2.default)(getProductRules(editorAnalyticsAPI)), (0, _toConsumableArray2.default)(getSymbolRules(editorAnalyticsAPI)), (0, _toConsumableArray2.default)(getPunctuationRules(editorAnalyticsAPI))));
175
+ return new _safePlugin.SafePlugin((0, _prosemirrorInputRules.createPlugin)('text-formatting:smart-input', [].concat((0, _toConsumableArray2.default)(getProductRules(editorAnalyticsAPI)), (0, _toConsumableArray2.default)(getSymbolRules(editorAnalyticsAPI)), (0, _toConsumableArray2.default)(getPunctuationRules(editorAnalyticsAPI)))));
175
176
  };
@@ -1,7 +1,8 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { transformSmartCharsMentionsAndEmojis } from '@atlaskit/editor-common/mark';
3
- import { inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
4
- import { createPlugin, createRule, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
3
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
+ import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
5
+ import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
5
6
  var ValidAutoformatChars = /*#__PURE__*/function (ValidAutoformatChars) {
6
7
  ValidAutoformatChars["STRONG"] = "__";
7
8
  ValidAutoformatChars["STRIKE"] = "~~";
@@ -235,7 +236,7 @@ export function inputRulePlugin(schema, editorAnalyticsAPI) {
235
236
  rules.push(...getCodeInputRules(schema, editorAnalyticsAPI));
236
237
  }
237
238
  if (rules.length !== 0) {
238
- return createPlugin('text-formatting', rules);
239
+ return new SafePlugin(createPlugin('text-formatting', rules));
239
240
  }
240
241
  return;
241
242
  }
@@ -1,7 +1,8 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, PUNC, SYMBOL } from '@atlaskit/editor-common/analytics';
2
- import { inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
2
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
3
4
  import { Selection } from '@atlaskit/editor-prosemirror/state';
4
- import { createPlugin, createRule } from '@atlaskit/prosemirror-input-rules';
5
+ import { createPlugin } from '@atlaskit/prosemirror-input-rules';
5
6
 
6
7
  /**
7
8
  * Creates an InputRuleHandler that will match on a regular expression of the
@@ -152,4 +153,4 @@ function getPunctuationRules(editorAnalyticsAPI) {
152
153
  const singleQuoteRules = createSingleQuotesRules();
153
154
  return [...dashEllipsisRules, ...doubleQuoteRules, ...singleQuoteRules.map(rule => punctuationRuleWithAnalytics(PUNC.QUOTE_SINGLE)(rule))];
154
155
  }
155
- export default (editorAnalyticsAPI => createPlugin('text-formatting:smart-input', [...getProductRules(editorAnalyticsAPI), ...getSymbolRules(editorAnalyticsAPI), ...getPunctuationRules(editorAnalyticsAPI)]));
156
+ export default (editorAnalyticsAPI => new SafePlugin(createPlugin('text-formatting:smart-input', [...getProductRules(editorAnalyticsAPI), ...getSymbolRules(editorAnalyticsAPI), ...getPunctuationRules(editorAnalyticsAPI)])));
@@ -12,8 +12,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
12
12
  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; } }
13
13
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
14
14
  import { transformSmartCharsMentionsAndEmojis } from '@atlaskit/editor-common/mark';
15
- import { inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
16
- import { createPlugin, createRule, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
15
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
16
+ import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
17
+ import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
17
18
  var ValidAutoformatChars = /*#__PURE__*/function (ValidAutoformatChars) {
18
19
  ValidAutoformatChars["STRONG"] = "__";
19
20
  ValidAutoformatChars["STRIKE"] = "~~";
@@ -250,7 +251,7 @@ export function inputRulePlugin(schema, editorAnalyticsAPI) {
250
251
  rules.push.apply(rules, _toConsumableArray(getCodeInputRules(schema, editorAnalyticsAPI)));
251
252
  }
252
253
  if (rules.length !== 0) {
253
- return createPlugin('text-formatting', rules);
254
+ return new SafePlugin(createPlugin('text-formatting', rules));
254
255
  }
255
256
  return;
256
257
  }
@@ -2,9 +2,10 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, PUNC, SYMBOL } from '@atlaskit/editor-common/analytics';
5
- import { inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
5
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
+ import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
6
7
  import { Selection } from '@atlaskit/editor-prosemirror/state';
7
- import { createPlugin, createRule } from '@atlaskit/prosemirror-input-rules';
8
+ import { createPlugin } from '@atlaskit/prosemirror-input-rules';
8
9
 
9
10
  /**
10
11
  * Creates an InputRuleHandler that will match on a regular expression of the
@@ -165,5 +166,5 @@ function getPunctuationRules(editorAnalyticsAPI) {
165
166
  })));
166
167
  }
167
168
  export default (function (editorAnalyticsAPI) {
168
- return createPlugin('text-formatting:smart-input', [].concat(_toConsumableArray(getProductRules(editorAnalyticsAPI)), _toConsumableArray(getSymbolRules(editorAnalyticsAPI)), _toConsumableArray(getPunctuationRules(editorAnalyticsAPI))));
169
+ return new SafePlugin(createPlugin('text-formatting:smart-input', [].concat(_toConsumableArray(getProductRules(editorAnalyticsAPI)), _toConsumableArray(getSymbolRules(editorAnalyticsAPI)), _toConsumableArray(getPunctuationRules(editorAnalyticsAPI)))));
169
170
  });
@@ -1,5 +1,5 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
4
4
  declare enum ValidAutoformatChars {
5
5
  STRONG = "__",
@@ -1,3 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- declare const _default: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/safe-plugin").SafePlugin<any>;
2
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ declare const _default: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => SafePlugin<any>;
3
4
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
4
4
  declare enum ValidAutoformatChars {
5
5
  STRONG = "__",
@@ -1,3 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- declare const _default: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/safe-plugin").SafePlugin<any>;
2
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ declare const _default: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => SafePlugin<any>;
3
4
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-formatting",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Text-formatting plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,14 +32,14 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/adf-schema": "^35.5.1",
36
- "@atlaskit/editor-common": "^78.3.0",
35
+ "@atlaskit/adf-schema": "^35.5.2",
36
+ "@atlaskit/editor-common": "^78.10.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
38
38
  "@atlaskit/editor-prosemirror": "3.0.0",
39
39
  "@atlaskit/editor-shared-styles": "^2.9.0",
40
40
  "@atlaskit/editor-tables": "^2.5.0",
41
- "@atlaskit/icon": "^22.0.0",
42
- "@atlaskit/prosemirror-input-rules": "^2.4.0",
41
+ "@atlaskit/icon": "^22.1.0",
42
+ "@atlaskit/prosemirror-input-rules": "^3.0.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@emotion/react": "^11.7.1",
45
45
  "react-intl-next": "npm:react-intl@^5.18.1"