@atlaskit/editor-plugin-text-formatting 0.4.6 → 0.4.8
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 +27 -15
- package/README.md +1 -1
- package/dist/cjs/commands/clear-formatting.js +3 -5
- package/dist/cjs/commands/text-formatting.js +4 -7
- package/dist/cjs/commands/transform-to-code.js +2 -3
- package/dist/cjs/commands.js +22 -36
- package/dist/cjs/plugin.js +15 -16
- package/dist/cjs/pm-plugins/clear-formatting-keymap.js +1 -2
- package/dist/cjs/pm-plugins/clear-formatting.js +3 -5
- package/dist/cjs/pm-plugins/cursor.js +2 -3
- package/dist/cjs/pm-plugins/input-rule.js +10 -18
- package/dist/cjs/pm-plugins/keymap.js +9 -1
- package/dist/cjs/pm-plugins/main.js +5 -5
- package/dist/cjs/pm-plugins/plugin-key.js +1 -2
- package/dist/cjs/pm-plugins/smart-input-rule.js +2 -3
- package/dist/cjs/ui/Toolbar/constants.js +4 -8
- package/dist/cjs/ui/Toolbar/dropdown-menu.js +2 -3
- package/dist/cjs/ui/Toolbar/hooks/clear-formatting-icon.js +2 -3
- package/dist/cjs/ui/Toolbar/hooks/formatting-icons.js +3 -5
- package/dist/cjs/ui/Toolbar/hooks/menu-state.js +2 -3
- package/dist/cjs/ui/Toolbar/hooks/responsive-toolbar-buttons.js +4 -7
- package/dist/cjs/ui/Toolbar/index.js +1 -2
- package/dist/cjs/ui/Toolbar/more-button.js +2 -3
- package/dist/cjs/ui/Toolbar/single-toolbar-buttons.js +2 -3
- package/dist/cjs/ui/Toolbar/types.js +2 -3
- package/dist/cjs/utils/cell-selection.js +2 -3
- package/dist/cjs/utils.js +6 -11
- package/dist/es2019/pm-plugins/keymap.js +11 -3
- package/dist/esm/commands/clear-formatting.js +1 -1
- package/dist/esm/commands.js +7 -7
- package/dist/esm/plugin.js +13 -13
- package/dist/esm/pm-plugins/input-rule.js +2 -2
- package/dist/esm/pm-plugins/keymap.js +11 -3
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/docs/0-intro.tsx +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-formatting
|
|
2
2
|
|
|
3
|
+
## 0.4.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#41634](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41634) [`e7cd20932b9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e7cd20932b9) - on windows, toggles mark when the capslock is on
|
|
8
|
+
|
|
9
|
+
## 0.4.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#39749](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39749) [`e6b69f455c3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e6b69f455c3) - Connect yarn changeset to packages, upgrade adf-schema
|
|
14
|
+
|
|
3
15
|
## 0.4.6
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -10,7 +22,7 @@
|
|
|
10
22
|
|
|
11
23
|
### Patch Changes
|
|
12
24
|
|
|
13
|
-
- [`37c62369dae`](https://bitbucket.org/atlassian/atlassian-frontend/commits/37c62369dae) - NO-ISSUE Import doc builder types from editor-common
|
|
25
|
+
- [#39984](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39984) [`37c62369dae`](https://bitbucket.org/atlassian/atlassian-frontend/commits/37c62369dae) - NO-ISSUE Import doc builder types from editor-common
|
|
14
26
|
|
|
15
27
|
## 0.4.4
|
|
16
28
|
|
|
@@ -22,20 +34,20 @@
|
|
|
22
34
|
|
|
23
35
|
### Patch Changes
|
|
24
36
|
|
|
25
|
-
- [`aeb5c9a01e8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/aeb5c9a01e8) - Delete adf-schema from AFE and rely on npm package for adf-schema
|
|
37
|
+
- [#39481](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39481) [`aeb5c9a01e8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/aeb5c9a01e8) - Delete adf-schema from AFE and rely on npm package for adf-schema
|
|
26
38
|
- [`4b4dcfe0bba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4b4dcfe0bba) - Delete adf-schema, use published version
|
|
27
39
|
|
|
28
40
|
## 0.4.2
|
|
29
41
|
|
|
30
42
|
### Patch Changes
|
|
31
43
|
|
|
32
|
-
- [`1b66c23221e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1b66c23221e) - Fix missing analytics parameter in media plugin.
|
|
44
|
+
- [#39628](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39628) [`1b66c23221e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1b66c23221e) - Fix missing analytics parameter in media plugin.
|
|
33
45
|
|
|
34
46
|
## 0.4.1
|
|
35
47
|
|
|
36
48
|
### Patch Changes
|
|
37
49
|
|
|
38
|
-
- [`6acf9830b36`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6acf9830b36) - Update feature flags plugin
|
|
50
|
+
- [#39304](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39304) [`6acf9830b36`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6acf9830b36) - Update feature flags plugin
|
|
39
51
|
(@atlaskit/editor-plugin-feature-flags) to use a named export
|
|
40
52
|
rather than default export to match other plugins.
|
|
41
53
|
|
|
@@ -51,7 +63,7 @@
|
|
|
51
63
|
|
|
52
64
|
### Minor Changes
|
|
53
65
|
|
|
54
|
-
- [`ad3c5c21079`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ad3c5c21079) - Updating all plugins with minor version to correct issue with semver.
|
|
66
|
+
- [#39325](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39325) [`ad3c5c21079`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ad3c5c21079) - Updating all plugins with minor version to correct issue with semver.
|
|
55
67
|
|
|
56
68
|
### Patch Changes
|
|
57
69
|
|
|
@@ -61,7 +73,7 @@
|
|
|
61
73
|
|
|
62
74
|
### Patch Changes
|
|
63
75
|
|
|
64
|
-
- [`8467bdcdf4f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8467bdcdf4f) - Removing `dependencies` prop from PluginInjectionAPI and changing
|
|
76
|
+
- [#39010](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39010) [`8467bdcdf4f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8467bdcdf4f) - Removing `dependencies` prop from PluginInjectionAPI and changing
|
|
65
77
|
signature of `NextEditorPlugin`.
|
|
66
78
|
|
|
67
79
|
Previously a `NextEditorPlugin` would be consumed as so:
|
|
@@ -91,51 +103,51 @@
|
|
|
91
103
|
|
|
92
104
|
### Patch Changes
|
|
93
105
|
|
|
94
|
-
- [`24e27147cbd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24e27147cbd) - Added atlaskit docs to all existing plugins.
|
|
106
|
+
- [#39177](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39177) [`24e27147cbd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24e27147cbd) - Added atlaskit docs to all existing plugins.
|
|
95
107
|
|
|
96
108
|
## 0.3.0
|
|
97
109
|
|
|
98
110
|
### Minor Changes
|
|
99
111
|
|
|
100
|
-
- [`4795a87a349`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4795a87a349) - Migrating some actions of `editor-plugin-list` to commands. Adding sharedState for `editor-plugin-text-formatting`.
|
|
112
|
+
- [#39023](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39023) [`4795a87a349`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4795a87a349) - Migrating some actions of `editor-plugin-list` to commands. Adding sharedState for `editor-plugin-text-formatting`.
|
|
101
113
|
|
|
102
114
|
## 0.2.5
|
|
103
115
|
|
|
104
116
|
### Patch Changes
|
|
105
117
|
|
|
106
|
-
- [`33cb07de05f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/33cb07de05f) - change adf-schema to fixed versioning
|
|
118
|
+
- [#38976](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38976) [`33cb07de05f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/33cb07de05f) - change adf-schema to fixed versioning
|
|
107
119
|
|
|
108
120
|
## 0.2.4
|
|
109
121
|
|
|
110
122
|
### Patch Changes
|
|
111
123
|
|
|
112
|
-
- [`967f4819f58`](https://bitbucket.org/atlassian/atlassian-frontend/commits/967f4819f58) - Introduce core plugin that is always injected into the pluginInjectionApi. This has a new action `execute` that replaces the existing `executeCommand` that was called from the `pluginInjectionApi`.
|
|
124
|
+
- [#38808](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38808) [`967f4819f58`](https://bitbucket.org/atlassian/atlassian-frontend/commits/967f4819f58) - Introduce core plugin that is always injected into the pluginInjectionApi. This has a new action `execute` that replaces the existing `executeCommand` that was called from the `pluginInjectionApi`.
|
|
113
125
|
- Updated dependencies
|
|
114
126
|
|
|
115
127
|
## 0.2.3
|
|
116
128
|
|
|
117
129
|
### Patch Changes
|
|
118
130
|
|
|
119
|
-
- [`f12aff135b6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f12aff135b6) - Extract Composition Plugin
|
|
131
|
+
- [#38577](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38577) [`f12aff135b6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f12aff135b6) - Extract Composition Plugin
|
|
120
132
|
|
|
121
133
|
## 0.2.2
|
|
122
134
|
|
|
123
135
|
### Patch Changes
|
|
124
136
|
|
|
125
|
-
- [`24fc3925d73`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24fc3925d73) - Add a new hook called `usePreset` accesed via `@atlaskit/editor-core/use-preset`. This hook can be used to safely access state and commands from outside the editor using `EditorContext`.
|
|
137
|
+
- [#38495](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38495) [`24fc3925d73`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24fc3925d73) - Add a new hook called `usePreset` accesed via `@atlaskit/editor-core/use-preset`. This hook can be used to safely access state and commands from outside the editor using `EditorContext`.
|
|
126
138
|
- Updated dependencies
|
|
127
139
|
|
|
128
140
|
## 0.2.1
|
|
129
141
|
|
|
130
142
|
### Patch Changes
|
|
131
143
|
|
|
132
|
-
- [`5365e42ef97`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5365e42ef97) - cleaned up more of the \* as keymaps imports to enable better tree-shaking
|
|
144
|
+
- [#38679](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38679) [`5365e42ef97`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5365e42ef97) - cleaned up more of the \* as keymaps imports to enable better tree-shaking
|
|
133
145
|
|
|
134
146
|
## 0.2.0
|
|
135
147
|
|
|
136
148
|
### Minor Changes
|
|
137
149
|
|
|
138
|
-
- [`43c51e0a282`](https://bitbucket.org/atlassian/atlassian-frontend/commits/43c51e0a282) - [ED-19431] Migrate all text-formatting plugin actions over to plugin commands
|
|
150
|
+
- [#38497](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38497) [`43c51e0a282`](https://bitbucket.org/atlassian/atlassian-frontend/commits/43c51e0a282) - [ED-19431] Migrate all text-formatting plugin actions over to plugin commands
|
|
139
151
|
|
|
140
152
|
### Patch Changes
|
|
141
153
|
|
|
@@ -145,4 +157,4 @@
|
|
|
145
157
|
|
|
146
158
|
### Patch Changes
|
|
147
159
|
|
|
148
|
-
- [`f3728ec49ab`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f3728ec49ab) - NO-ISSUE Switched analytics plugin to prod dependency to avoid type issues in CI
|
|
160
|
+
- [#38544](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38544) [`f3728ec49ab`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f3728ec49ab) - NO-ISSUE Switched analytics plugin to prod dependency to avoid type issues in CI
|
package/README.md
CHANGED
|
@@ -27,4 +27,4 @@ Please see [Atlaskit - Editor plugin text formatting](https://atlaskit.atlassian
|
|
|
27
27
|
For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
|
|
28
28
|
## License
|
|
29
29
|
---
|
|
30
|
-
Please see [Atlassian Frontend - License](https://
|
|
30
|
+
Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#License) for more licensing information.
|
|
@@ -10,10 +10,8 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
10
10
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
11
11
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
12
12
|
var _cellSelection2 = require("../utils/cell-selection");
|
|
13
|
-
var FORMATTING_NODE_TYPES = ['heading', 'blockquote'];
|
|
14
|
-
exports.
|
|
15
|
-
var FORMATTING_MARK_TYPES = ['em', 'code', 'strike', 'strong', 'underline', 'textColor', 'subsup'];
|
|
16
|
-
exports.FORMATTING_MARK_TYPES = FORMATTING_MARK_TYPES;
|
|
13
|
+
var FORMATTING_NODE_TYPES = exports.FORMATTING_NODE_TYPES = ['heading', 'blockquote'];
|
|
14
|
+
var FORMATTING_MARK_TYPES = exports.FORMATTING_MARK_TYPES = ['em', 'code', 'strike', 'strong', 'underline', 'textColor', 'subsup'];
|
|
17
15
|
var formatTypes = {
|
|
18
16
|
em: _analytics.ACTION_SUBJECT_ID.FORMAT_ITALIC,
|
|
19
17
|
code: _analytics.ACTION_SUBJECT_ID.FORMAT_CODE,
|
|
@@ -92,7 +90,7 @@ function clearFormatting(inputMethod, editorAnalyticsAPI) {
|
|
|
92
90
|
});
|
|
93
91
|
tr.setStoredMarks([]);
|
|
94
92
|
if (formattingCleared.length && inputMethod) {
|
|
95
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0
|
|
93
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
96
94
|
action: _analytics.ACTION.FORMATTED,
|
|
97
95
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
98
96
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
@@ -9,7 +9,7 @@ var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
|
9
9
|
var _mark = require("@atlaskit/editor-common/mark");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
11
|
var _utils = require("../utils");
|
|
12
|
-
var moveRight = function moveRight() {
|
|
12
|
+
var moveRight = exports.moveRight = function moveRight() {
|
|
13
13
|
return function (state, dispatch) {
|
|
14
14
|
var code = state.schema.marks.code;
|
|
15
15
|
var _ref = state.selection,
|
|
@@ -45,8 +45,7 @@ var moveRight = function moveRight() {
|
|
|
45
45
|
return false;
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
-
exports.
|
|
49
|
-
var moveLeft = function moveLeft() {
|
|
48
|
+
var moveLeft = exports.moveLeft = function moveLeft() {
|
|
50
49
|
return function (state, dispatch) {
|
|
51
50
|
var code = state.schema.marks.code;
|
|
52
51
|
var _ref2 = state.selection,
|
|
@@ -104,7 +103,6 @@ var moveLeft = function moveLeft() {
|
|
|
104
103
|
return false;
|
|
105
104
|
};
|
|
106
105
|
};
|
|
107
|
-
exports.moveLeft = moveLeft;
|
|
108
106
|
var createInlineCodeFromTextInput = function createInlineCodeFromTextInput(from, to, text) {
|
|
109
107
|
return function (state, dispatch) {
|
|
110
108
|
if (state.selection.empty) {
|
|
@@ -127,7 +125,7 @@ var createInlineCodeFromTextInput = function createInlineCodeFromTextInput(from,
|
|
|
127
125
|
return false;
|
|
128
126
|
};
|
|
129
127
|
};
|
|
130
|
-
var createInlineCodeFromTextInputWithAnalytics = function createInlineCodeFromTextInputWithAnalytics(editorAnalyticsAPI) {
|
|
128
|
+
var createInlineCodeFromTextInputWithAnalytics = exports.createInlineCodeFromTextInputWithAnalytics = function createInlineCodeFromTextInputWithAnalytics(editorAnalyticsAPI) {
|
|
131
129
|
return function (from, to, text) {
|
|
132
130
|
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
133
131
|
action: _analytics.ACTION.FORMATTED,
|
|
@@ -139,5 +137,4 @@ var createInlineCodeFromTextInputWithAnalytics = function createInlineCodeFromTe
|
|
|
139
137
|
}
|
|
140
138
|
})(createInlineCodeFromTextInput(from, to, text));
|
|
141
139
|
};
|
|
142
|
-
};
|
|
143
|
-
exports.createInlineCodeFromTextInputWithAnalytics = createInlineCodeFromTextInputWithAnalytics;
|
|
140
|
+
};
|
|
@@ -45,7 +45,7 @@ var isNodeTextBlock = function isNodeTextBlock(schema) {
|
|
|
45
45
|
return;
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
-
var transformSmartCharsMentionsAndEmojis = function transformSmartCharsMentionsAndEmojis(from, to, tr) {
|
|
48
|
+
var transformSmartCharsMentionsAndEmojis = exports.transformSmartCharsMentionsAndEmojis = function transformSmartCharsMentionsAndEmojis(from, to, tr) {
|
|
49
49
|
var schema = tr.doc.type.schema;
|
|
50
50
|
var _schema$nodes2 = schema.nodes,
|
|
51
51
|
mention = _schema$nodes2.mention,
|
|
@@ -64,5 +64,4 @@ var transformSmartCharsMentionsAndEmojis = function transformSmartCharsMentionsA
|
|
|
64
64
|
replaceSmartCharsToAscii(replacePosition, textToReplace, tr);
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
-
};
|
|
68
|
-
exports.transformSmartCharsMentionsAndEmojis = transformSmartCharsMentionsAndEmojis;
|
|
67
|
+
};
|
package/dist/cjs/commands.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.toggleUnderlineWithAnalytics = exports.toggleUnderline = exports.toggleSuperscriptWithAnalytics = exports.toggleSuperscript = exports.toggleSubscriptWithAnalytics = exports.toggleSubscript = exports.toggleStrongWithAnalytics = exports.toggleStrong = exports.toggleStrikeWithAnalytics = exports.toggleStrike = exports.toggleEmWithAnalytics = exports.toggleEm = exports.toggleCodeWithAnalytics = exports.toggleCode = void 0;
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
8
|
var _mark = require("@atlaskit/editor-common/mark");
|
|
9
|
-
var toggleEm = function toggleEm(_ref) {
|
|
9
|
+
var toggleEm = exports.toggleEm = function toggleEm(_ref) {
|
|
10
10
|
var tr = _ref.tr;
|
|
11
11
|
var em = tr.doc.type.schema.marks.em;
|
|
12
12
|
if (!em) {
|
|
@@ -17,8 +17,7 @@ var toggleEm = function toggleEm(_ref) {
|
|
|
17
17
|
tr: tr
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
|
-
exports.
|
|
21
|
-
var toggleEmWithAnalytics = function toggleEmWithAnalytics(editorAnalyticsApi) {
|
|
20
|
+
var toggleEmWithAnalytics = exports.toggleEmWithAnalytics = function toggleEmWithAnalytics(editorAnalyticsApi) {
|
|
22
21
|
return function (inputMethod) {
|
|
23
22
|
return function (_ref2) {
|
|
24
23
|
var tr = _ref2.tr;
|
|
@@ -29,7 +28,7 @@ var toggleEmWithAnalytics = function toggleEmWithAnalytics(editorAnalyticsApi) {
|
|
|
29
28
|
// No transaction to apply
|
|
30
29
|
return null;
|
|
31
30
|
}
|
|
32
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
31
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
33
32
|
action: _analytics.ACTION.FORMATTED,
|
|
34
33
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
35
34
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
@@ -42,8 +41,7 @@ var toggleEmWithAnalytics = function toggleEmWithAnalytics(editorAnalyticsApi) {
|
|
|
42
41
|
};
|
|
43
42
|
};
|
|
44
43
|
};
|
|
45
|
-
exports.
|
|
46
|
-
var toggleStrike = function toggleStrike(_ref3) {
|
|
44
|
+
var toggleStrike = exports.toggleStrike = function toggleStrike(_ref3) {
|
|
47
45
|
var tr = _ref3.tr;
|
|
48
46
|
var strike = tr.doc.type.schema.marks.strike;
|
|
49
47
|
if (!strike) {
|
|
@@ -54,8 +52,7 @@ var toggleStrike = function toggleStrike(_ref3) {
|
|
|
54
52
|
tr: tr
|
|
55
53
|
});
|
|
56
54
|
};
|
|
57
|
-
exports.
|
|
58
|
-
var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(editorAnalyticsApi) {
|
|
55
|
+
var toggleStrikeWithAnalytics = exports.toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(editorAnalyticsApi) {
|
|
59
56
|
return function (inputMethod) {
|
|
60
57
|
return function (_ref4) {
|
|
61
58
|
var tr = _ref4.tr;
|
|
@@ -66,7 +63,7 @@ var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(editorAnalyti
|
|
|
66
63
|
// No transaction to apply
|
|
67
64
|
return null;
|
|
68
65
|
}
|
|
69
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
66
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
70
67
|
action: _analytics.ACTION.FORMATTED,
|
|
71
68
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
72
69
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
@@ -79,8 +76,7 @@ var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(editorAnalyti
|
|
|
79
76
|
};
|
|
80
77
|
};
|
|
81
78
|
};
|
|
82
|
-
exports.
|
|
83
|
-
var toggleStrong = function toggleStrong(_ref5) {
|
|
79
|
+
var toggleStrong = exports.toggleStrong = function toggleStrong(_ref5) {
|
|
84
80
|
var tr = _ref5.tr;
|
|
85
81
|
var strong = tr.doc.type.schema.marks.strong;
|
|
86
82
|
if (!strong) {
|
|
@@ -91,8 +87,7 @@ var toggleStrong = function toggleStrong(_ref5) {
|
|
|
91
87
|
tr: tr
|
|
92
88
|
});
|
|
93
89
|
};
|
|
94
|
-
exports.
|
|
95
|
-
var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(editorAnalyticsApi) {
|
|
90
|
+
var toggleStrongWithAnalytics = exports.toggleStrongWithAnalytics = function toggleStrongWithAnalytics(editorAnalyticsApi) {
|
|
96
91
|
return function (inputMethod) {
|
|
97
92
|
return function (_ref6) {
|
|
98
93
|
var tr = _ref6.tr;
|
|
@@ -103,7 +98,7 @@ var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(editorAnalyti
|
|
|
103
98
|
// No transaction to apply
|
|
104
99
|
return null;
|
|
105
100
|
}
|
|
106
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
101
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
107
102
|
action: _analytics.ACTION.FORMATTED,
|
|
108
103
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
109
104
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
@@ -116,8 +111,7 @@ var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(editorAnalyti
|
|
|
116
111
|
};
|
|
117
112
|
};
|
|
118
113
|
};
|
|
119
|
-
exports.
|
|
120
|
-
var toggleUnderline = function toggleUnderline(_ref7) {
|
|
114
|
+
var toggleUnderline = exports.toggleUnderline = function toggleUnderline(_ref7) {
|
|
121
115
|
var tr = _ref7.tr;
|
|
122
116
|
var underline = tr.doc.type.schema.marks.underline;
|
|
123
117
|
if (!underline) {
|
|
@@ -128,8 +122,7 @@ var toggleUnderline = function toggleUnderline(_ref7) {
|
|
|
128
122
|
tr: tr
|
|
129
123
|
});
|
|
130
124
|
};
|
|
131
|
-
exports.
|
|
132
|
-
var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(editorAnalyticsApi) {
|
|
125
|
+
var toggleUnderlineWithAnalytics = exports.toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(editorAnalyticsApi) {
|
|
133
126
|
return function (inputMethod) {
|
|
134
127
|
return function (_ref8) {
|
|
135
128
|
var tr = _ref8.tr;
|
|
@@ -140,7 +133,7 @@ var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(editorA
|
|
|
140
133
|
// No transaction to apply
|
|
141
134
|
return null;
|
|
142
135
|
}
|
|
143
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
136
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
144
137
|
action: _analytics.ACTION.FORMATTED,
|
|
145
138
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
146
139
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
@@ -153,8 +146,7 @@ var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(editorA
|
|
|
153
146
|
};
|
|
154
147
|
};
|
|
155
148
|
};
|
|
156
|
-
exports.
|
|
157
|
-
var toggleSuperscript = function toggleSuperscript(_ref9) {
|
|
149
|
+
var toggleSuperscript = exports.toggleSuperscript = function toggleSuperscript(_ref9) {
|
|
158
150
|
var tr = _ref9.tr;
|
|
159
151
|
var subsup = tr.doc.type.schema.marks.subsup;
|
|
160
152
|
if (!subsup) {
|
|
@@ -167,8 +159,7 @@ var toggleSuperscript = function toggleSuperscript(_ref9) {
|
|
|
167
159
|
tr: tr
|
|
168
160
|
});
|
|
169
161
|
};
|
|
170
|
-
exports.
|
|
171
|
-
var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(editorAnalyticsApi) {
|
|
162
|
+
var toggleSuperscriptWithAnalytics = exports.toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(editorAnalyticsApi) {
|
|
172
163
|
return function (inputMethod) {
|
|
173
164
|
return function (_ref10) {
|
|
174
165
|
var tr = _ref10.tr;
|
|
@@ -179,7 +170,7 @@ var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(edi
|
|
|
179
170
|
// No transaction to apply
|
|
180
171
|
return null;
|
|
181
172
|
}
|
|
182
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
173
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
183
174
|
action: _analytics.ACTION.FORMATTED,
|
|
184
175
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
185
176
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
@@ -192,8 +183,7 @@ var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(edi
|
|
|
192
183
|
};
|
|
193
184
|
};
|
|
194
185
|
};
|
|
195
|
-
exports.
|
|
196
|
-
var toggleSubscript = function toggleSubscript(_ref11) {
|
|
186
|
+
var toggleSubscript = exports.toggleSubscript = function toggleSubscript(_ref11) {
|
|
197
187
|
var tr = _ref11.tr;
|
|
198
188
|
var subsup = tr.doc.type.schema.marks.subsup;
|
|
199
189
|
if (!subsup) {
|
|
@@ -206,8 +196,7 @@ var toggleSubscript = function toggleSubscript(_ref11) {
|
|
|
206
196
|
tr: tr
|
|
207
197
|
});
|
|
208
198
|
};
|
|
209
|
-
exports.
|
|
210
|
-
var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(editorAnalyticsApi) {
|
|
199
|
+
var toggleSubscriptWithAnalytics = exports.toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(editorAnalyticsApi) {
|
|
211
200
|
return function (inputMethod) {
|
|
212
201
|
return function (_ref12) {
|
|
213
202
|
var tr = _ref12.tr;
|
|
@@ -218,7 +207,7 @@ var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(editorA
|
|
|
218
207
|
// No transaction to apply
|
|
219
208
|
return null;
|
|
220
209
|
}
|
|
221
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
210
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
222
211
|
action: _analytics.ACTION.FORMATTED,
|
|
223
212
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
224
213
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
@@ -231,8 +220,7 @@ var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(editorA
|
|
|
231
220
|
};
|
|
232
221
|
};
|
|
233
222
|
};
|
|
234
|
-
exports.
|
|
235
|
-
var toggleCode = function toggleCode(_ref13) {
|
|
223
|
+
var toggleCode = exports.toggleCode = function toggleCode(_ref13) {
|
|
236
224
|
var tr = _ref13.tr;
|
|
237
225
|
var code = tr.doc.type.schema.marks.code;
|
|
238
226
|
if (!code) {
|
|
@@ -243,8 +231,7 @@ var toggleCode = function toggleCode(_ref13) {
|
|
|
243
231
|
tr: tr
|
|
244
232
|
});
|
|
245
233
|
};
|
|
246
|
-
exports.
|
|
247
|
-
var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(editorAnalyticsApi) {
|
|
234
|
+
var toggleCodeWithAnalytics = exports.toggleCodeWithAnalytics = function toggleCodeWithAnalytics(editorAnalyticsApi) {
|
|
248
235
|
return function (inputMethod) {
|
|
249
236
|
return function (_ref14) {
|
|
250
237
|
var tr = _ref14.tr;
|
|
@@ -255,7 +242,7 @@ var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(editorAnalyticsAp
|
|
|
255
242
|
// No transaction to apply
|
|
256
243
|
return null;
|
|
257
244
|
}
|
|
258
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
245
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
259
246
|
action: _analytics.ACTION.FORMATTED,
|
|
260
247
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
261
248
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
@@ -267,5 +254,4 @@ var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(editorAnalyticsAp
|
|
|
267
254
|
return newTr;
|
|
268
255
|
};
|
|
269
256
|
};
|
|
270
|
-
};
|
|
271
|
-
exports.toggleCodeWithAnalytics = toggleCodeWithAnalytics;
|
|
257
|
+
};
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -21,7 +21,7 @@ var _Toolbar = _interopRequireDefault(require("./ui/Toolbar"));
|
|
|
21
21
|
* Text formatting plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
22
22
|
* from `@atlaskit/editor-core`.
|
|
23
23
|
*/
|
|
24
|
-
var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
24
|
+
var textFormattingPlugin = exports.textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
25
25
|
var _api$analytics7, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12, _api$analytics13;
|
|
26
26
|
var options = _ref.config,
|
|
27
27
|
api = _ref.api;
|
|
@@ -54,7 +54,7 @@ var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
54
54
|
plugin: function plugin(_ref2) {
|
|
55
55
|
var _api$analytics;
|
|
56
56
|
var dispatch = _ref2.dispatch;
|
|
57
|
-
return (0, _main.plugin)(dispatch, api === null || api === void 0
|
|
57
|
+
return (0, _main.plugin)(dispatch, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
58
58
|
}
|
|
59
59
|
}, {
|
|
60
60
|
name: 'textFormattingCursor',
|
|
@@ -66,13 +66,13 @@ var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
66
66
|
plugin: function plugin(_ref3) {
|
|
67
67
|
var _api$analytics2;
|
|
68
68
|
var schema = _ref3.schema;
|
|
69
|
-
return (0, _inputRule.default)(schema, api === null || api === void 0
|
|
69
|
+
return (0, _inputRule.default)(schema, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
70
70
|
}
|
|
71
71
|
}, {
|
|
72
72
|
name: 'textFormattingSmartRule',
|
|
73
73
|
plugin: function plugin() {
|
|
74
74
|
var _api$analytics3;
|
|
75
|
-
return !(options !== null && options !== void 0 && options.disableSmartTextCompletion) ? (0, _smartInputRule.default)(api === null || api === void 0
|
|
75
|
+
return !(options !== null && options !== void 0 && options.disableSmartTextCompletion) ? (0, _smartInputRule.default)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions) : undefined;
|
|
76
76
|
}
|
|
77
77
|
}, {
|
|
78
78
|
name: 'textFormattingClear',
|
|
@@ -84,14 +84,14 @@ var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
84
84
|
name: 'textFormattingClearKeymap',
|
|
85
85
|
plugin: function plugin() {
|
|
86
86
|
var _api$analytics4;
|
|
87
|
-
return (0, _clearFormattingKeymap.default)(api === null || api === void 0
|
|
87
|
+
return (0, _clearFormattingKeymap.default)(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
88
88
|
}
|
|
89
89
|
}, {
|
|
90
90
|
name: 'textFormattingKeymap',
|
|
91
91
|
plugin: function plugin(_ref5) {
|
|
92
92
|
var _api$analytics5;
|
|
93
93
|
var schema = _ref5.schema;
|
|
94
|
-
return (0, _keymap.default)(schema, api === null || api === void 0
|
|
94
|
+
return (0, _keymap.default)(schema, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
95
95
|
}
|
|
96
96
|
}];
|
|
97
97
|
},
|
|
@@ -124,20 +124,19 @@ var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
124
124
|
editorView: editorView,
|
|
125
125
|
isToolbarDisabled: disabled,
|
|
126
126
|
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu),
|
|
127
|
-
editorAnalyticsAPI: api === null || api === void 0
|
|
127
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
131
|
},
|
|
132
132
|
commands: {
|
|
133
|
-
toggleSuperscript: (0, _commands.toggleSuperscriptWithAnalytics)(api === null || api === void 0
|
|
134
|
-
toggleSubscript: (0, _commands.toggleSubscriptWithAnalytics)(api === null || api === void 0
|
|
135
|
-
toggleStrike: (0, _commands.toggleStrikeWithAnalytics)(api === null || api === void 0
|
|
136
|
-
toggleCode: (0, _commands.toggleCodeWithAnalytics)(api === null || api === void 0
|
|
137
|
-
toggleUnderline: (0, _commands.toggleUnderlineWithAnalytics)(api === null || api === void 0
|
|
138
|
-
toggleEm: (0, _commands.toggleEmWithAnalytics)(api === null || api === void 0
|
|
139
|
-
toggleStrong: (0, _commands.toggleStrongWithAnalytics)(api === null || api === void 0
|
|
133
|
+
toggleSuperscript: (0, _commands.toggleSuperscriptWithAnalytics)(api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions),
|
|
134
|
+
toggleSubscript: (0, _commands.toggleSubscriptWithAnalytics)(api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions),
|
|
135
|
+
toggleStrike: (0, _commands.toggleStrikeWithAnalytics)(api === null || api === void 0 || (_api$analytics9 = api.analytics) === null || _api$analytics9 === void 0 ? void 0 : _api$analytics9.actions),
|
|
136
|
+
toggleCode: (0, _commands.toggleCodeWithAnalytics)(api === null || api === void 0 || (_api$analytics10 = api.analytics) === null || _api$analytics10 === void 0 ? void 0 : _api$analytics10.actions),
|
|
137
|
+
toggleUnderline: (0, _commands.toggleUnderlineWithAnalytics)(api === null || api === void 0 || (_api$analytics11 = api.analytics) === null || _api$analytics11 === void 0 ? void 0 : _api$analytics11.actions),
|
|
138
|
+
toggleEm: (0, _commands.toggleEmWithAnalytics)(api === null || api === void 0 || (_api$analytics12 = api.analytics) === null || _api$analytics12 === void 0 ? void 0 : _api$analytics12.actions),
|
|
139
|
+
toggleStrong: (0, _commands.toggleStrongWithAnalytics)(api === null || api === void 0 || (_api$analytics13 = api.analytics) === null || _api$analytics13 === void 0 ? void 0 : _api$analytics13.actions)
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
|
-
};
|
|
143
|
-
exports.textFormattingPlugin = textFormattingPlugin;
|
|
142
|
+
};
|
|
@@ -14,5 +14,4 @@ function keymapPlugin(editorAnalyticsAPI) {
|
|
|
14
14
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.clearFormatting.common, (0, _clearFormatting.clearFormattingWithAnalytics)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsAPI), list);
|
|
15
15
|
return (0, _keymap.keymap)(list);
|
|
16
16
|
}
|
|
17
|
-
var _default = keymapPlugin;
|
|
18
|
-
exports.default = _default;
|
|
17
|
+
var _default = exports.default = keymapPlugin;
|
|
@@ -7,9 +7,8 @@ exports.pluginKey = exports.plugin = void 0;
|
|
|
7
7
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _utils = require("../utils");
|
|
10
|
-
var pluginKey = new _state.PluginKey('clearFormattingPlugin');
|
|
11
|
-
exports.
|
|
12
|
-
var plugin = function plugin(dispatch) {
|
|
10
|
+
var pluginKey = exports.pluginKey = new _state.PluginKey('clearFormattingPlugin');
|
|
11
|
+
var plugin = exports.plugin = function plugin(dispatch) {
|
|
13
12
|
return new _safePlugin.SafePlugin({
|
|
14
13
|
state: {
|
|
15
14
|
init: function init(_config, state) {
|
|
@@ -32,5 +31,4 @@ var plugin = function plugin(dispatch) {
|
|
|
32
31
|
},
|
|
33
32
|
key: pluginKey
|
|
34
33
|
});
|
|
35
|
-
};
|
|
36
|
-
exports.plugin = plugin;
|
|
34
|
+
};
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
-
var _default = new _safePlugin.SafePlugin({
|
|
9
|
+
var _default = exports.default = new _safePlugin.SafePlugin({
|
|
10
10
|
props: {
|
|
11
11
|
handleClick: function handleClick(view, clickPos, event) {
|
|
12
12
|
// Don't apply in Edge as per ED-4546
|
|
@@ -51,5 +51,4 @@ var _default = new _safePlugin.SafePlugin({
|
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
});
|
|
55
|
-
exports.default = _default;
|
|
54
|
+
});
|
|
@@ -32,7 +32,7 @@ var ValidAutoformatChars = /*#__PURE__*/function (ValidAutoformatChars) {
|
|
|
32
32
|
ValidAutoformatChars["CODE"] = "`";
|
|
33
33
|
return ValidAutoformatChars;
|
|
34
34
|
}(ValidAutoformatChars || {});
|
|
35
|
-
var ValidCombinations = (_ValidCombinations = {}, (0, _defineProperty2.default)(_ValidCombinations, ValidAutoformatChars.STRIKE, [
|
|
35
|
+
var ValidCombinations = exports.ValidCombinations = (_ValidCombinations = {}, (0, _defineProperty2.default)(_ValidCombinations, ValidAutoformatChars.STRIKE, [
|
|
36
36
|
// e.g: _~~lol~~_
|
|
37
37
|
ValidAutoformatChars.ITALIC,
|
|
38
38
|
// e.g: __~~lol~~__
|
|
@@ -59,10 +59,9 @@ ValidAutoformatChars.STRIKE,
|
|
|
59
59
|
ValidAutoformatChars.STRONG_MARKDOWN]), (0, _defineProperty2.default)(_ValidCombinations, ValidAutoformatChars.CODE, [
|
|
60
60
|
// e.g: loko (`some code`
|
|
61
61
|
'( ']), _ValidCombinations);
|
|
62
|
-
exports.ValidCombinations = ValidCombinations;
|
|
63
62
|
function addMark(markType, schema, char) {
|
|
64
63
|
return function (state, match, start, end) {
|
|
65
|
-
var _schema$marks
|
|
64
|
+
var _schema$marks;
|
|
66
65
|
var doc = state.doc,
|
|
67
66
|
schema = state.schema,
|
|
68
67
|
tr = state.tr;
|
|
@@ -70,7 +69,7 @@ function addMark(markType, schema, char) {
|
|
|
70
69
|
|
|
71
70
|
// fixes the following case: my `*name` is *
|
|
72
71
|
// expected result: should ignore special characters inside "code"
|
|
73
|
-
if (textPrefix !== char || schema !== null && schema !== void 0 && (_schema$marks = schema.marks) !== null && _schema$marks !== void 0 && (_schema$marks
|
|
72
|
+
if (textPrefix !== char || schema !== null && schema !== void 0 && (_schema$marks = schema.marks) !== null && _schema$marks !== void 0 && (_schema$marks = _schema$marks.code) !== null && _schema$marks !== void 0 && _schema$marks.isInSet(doc.resolve(start + 1).marks())) {
|
|
74
73
|
return null;
|
|
75
74
|
}
|
|
76
75
|
|
|
@@ -156,17 +155,12 @@ var buildRegex = function buildRegex(char) {
|
|
|
156
155
|
var replacedRegex = String.prototype.hasOwnProperty('replaceAll') ? baseRegex.replaceAll('X', escapedChar) : baseRegex.replace(/X/g, escapedChar);
|
|
157
156
|
return new ReverseRegexExp(replacedRegex);
|
|
158
157
|
};
|
|
159
|
-
var strongRegex1 = buildRegex(ValidAutoformatChars.STRONG);
|
|
160
|
-
exports.
|
|
161
|
-
var
|
|
162
|
-
exports.
|
|
163
|
-
var
|
|
164
|
-
exports.
|
|
165
|
-
var italicRegex2 = buildRegex(ValidAutoformatChars.ITALIC_MARKDOWN);
|
|
166
|
-
exports.italicRegex2 = italicRegex2;
|
|
167
|
-
var strikeRegex = buildRegex(ValidAutoformatChars.STRIKE);
|
|
168
|
-
exports.strikeRegex = strikeRegex;
|
|
169
|
-
var codeRegex = buildRegex(ValidAutoformatChars.CODE);
|
|
158
|
+
var strongRegex1 = exports.strongRegex1 = buildRegex(ValidAutoformatChars.STRONG);
|
|
159
|
+
var strongRegex2 = exports.strongRegex2 = buildRegex(ValidAutoformatChars.STRONG_MARKDOWN);
|
|
160
|
+
var italicRegex1 = exports.italicRegex1 = buildRegex(ValidAutoformatChars.ITALIC);
|
|
161
|
+
var italicRegex2 = exports.italicRegex2 = buildRegex(ValidAutoformatChars.ITALIC_MARKDOWN);
|
|
162
|
+
var strikeRegex = exports.strikeRegex = buildRegex(ValidAutoformatChars.STRIKE);
|
|
163
|
+
var codeRegex = exports.codeRegex = buildRegex(ValidAutoformatChars.CODE);
|
|
170
164
|
|
|
171
165
|
/**
|
|
172
166
|
* Create input rules for strong mark
|
|
@@ -174,7 +168,6 @@ var codeRegex = buildRegex(ValidAutoformatChars.CODE);
|
|
|
174
168
|
* @param {Schema} schema
|
|
175
169
|
* @returns {InputRuleWrapper[]}
|
|
176
170
|
*/
|
|
177
|
-
exports.codeRegex = codeRegex;
|
|
178
171
|
function getStrongInputRules(schema, editorAnalyticsAPI) {
|
|
179
172
|
var ruleWithStrongAnalytics = (0, _utils.inputRuleWithAnalytics)({
|
|
180
173
|
action: _analytics.ACTION.FORMATTED,
|
|
@@ -270,5 +263,4 @@ function inputRulePlugin(schema, editorAnalyticsAPI) {
|
|
|
270
263
|
}
|
|
271
264
|
return;
|
|
272
265
|
}
|
|
273
|
-
var _default = inputRulePlugin;
|
|
274
|
-
exports.default = _default;
|
|
266
|
+
var _default = exports.default = inputRulePlugin;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = keymapPlugin;
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
8
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
9
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
10
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
10
11
|
var _commands = require("../commands");
|
|
11
12
|
function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
@@ -31,5 +32,12 @@ function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
|
31
32
|
if (schema.marks.underline) {
|
|
32
33
|
(0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.toggleUnderline.common, (0, _commands.toggleUnderlineWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
33
34
|
}
|
|
34
|
-
return
|
|
35
|
+
return new _safePlugin.SafePlugin({
|
|
36
|
+
props: {
|
|
37
|
+
handleKeyDown: function handleKeyDown(view, event) {
|
|
38
|
+
var keyboardEvent = (0, _keymaps.isCapsLockOnAndModifyKeyboardEvent)(event);
|
|
39
|
+
return (0, _keymap.keydownHandler)(list)(view, keyboardEvent);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
35
43
|
}
|