@atlaskit/editor-plugin-text-formatting 0.4.7 → 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 +6 -0
- 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/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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
|
+
|
|
3
9
|
## 0.4.7
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -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
|
}
|
|
@@ -16,7 +16,8 @@ var _mark = require("@atlaskit/editor-common/mark");
|
|
|
16
16
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
17
17
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
18
18
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
19
|
-
var
|
|
19
|
+
var _textFormatting = _interopRequireWildcard(require("../commands/text-formatting"));
|
|
20
|
+
var commands = _textFormatting;
|
|
20
21
|
var _pluginKey = require("./plugin-key");
|
|
21
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
23
|
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; }
|
|
@@ -70,7 +71,7 @@ var getTextFormattingState = function getTextFormattingState(editorState, editor
|
|
|
70
71
|
}
|
|
71
72
|
return state;
|
|
72
73
|
};
|
|
73
|
-
var plugin = function plugin(dispatch, editorAnalyticsAPI) {
|
|
74
|
+
var plugin = exports.plugin = function plugin(dispatch, editorAnalyticsAPI) {
|
|
74
75
|
return new _safePlugin.SafePlugin({
|
|
75
76
|
state: {
|
|
76
77
|
init: function init(_config, state) {
|
|
@@ -103,11 +104,10 @@ var plugin = function plugin(dispatch, editorAnalyticsAPI) {
|
|
|
103
104
|
var schema = state.schema,
|
|
104
105
|
parentNodeType = state.selection.$from.parent.type;
|
|
105
106
|
if (parentNodeType.allowsMarkType(schema.marks.code)) {
|
|
106
|
-
return (0,
|
|
107
|
+
return (0, _textFormatting.createInlineCodeFromTextInputWithAnalytics)(editorAnalyticsAPI)(from, to, text)(state, dispatch);
|
|
107
108
|
}
|
|
108
109
|
return false;
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
});
|
|
112
|
-
};
|
|
113
|
-
exports.plugin = plugin;
|
|
113
|
+
};
|
|
@@ -5,5 +5,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.pluginKey = void 0;
|
|
7
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
|
-
var pluginKey = new _state.PluginKey('textFormatting');
|
|
9
|
-
exports.pluginKey = pluginKey;
|
|
8
|
+
var pluginKey = exports.pluginKey = new _state.PluginKey('textFormatting');
|
|
@@ -170,7 +170,6 @@ function getPunctuationRules(editorAnalyticsAPI) {
|
|
|
170
170
|
return punctuationRuleWithAnalytics(_analytics.PUNC.QUOTE_SINGLE)(rule);
|
|
171
171
|
})));
|
|
172
172
|
}
|
|
173
|
-
var _default = function _default(editorAnalyticsAPI) {
|
|
173
|
+
var _default = exports.default = function _default(editorAnalyticsAPI) {
|
|
174
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
|
-
};
|
|
176
|
-
exports.default = _default;
|
|
175
|
+
};
|
|
@@ -9,11 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _types = require("@atlaskit/editor-common/types");
|
|
10
10
|
var _types2 = require("./types");
|
|
11
11
|
var _ResponsiveCustomButt, _ResponsiveCustomMenu;
|
|
12
|
-
var DefaultButtonsToolbar = [_types2.IconTypes.strong, _types2.IconTypes.em];
|
|
13
|
-
exports.
|
|
14
|
-
var
|
|
15
|
-
exports.
|
|
16
|
-
var ResponsiveCustomButtonToolbar = (_ResponsiveCustomButt = {}, (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.XXL, DefaultButtonsToolbar), (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.XL, DefaultButtonsToolbar), (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.L, DefaultButtonsToolbar), (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.M, []), (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.S, []), (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.XXXS, []), _ResponsiveCustomButt);
|
|
17
|
-
exports.ResponsiveCustomButtonToolbar = ResponsiveCustomButtonToolbar;
|
|
18
|
-
var ResponsiveCustomMenu = (_ResponsiveCustomMenu = {}, (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.XXL, DefaultButtonsMenu), (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.XL, DefaultButtonsMenu), (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.L, DefaultButtonsMenu), (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.M, [_types2.IconTypes.strong, _types2.IconTypes.em].concat(DefaultButtonsMenu)), (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.S, [_types2.IconTypes.strong, _types2.IconTypes.em].concat(DefaultButtonsMenu)), (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.XXXS, [_types2.IconTypes.strong, _types2.IconTypes.em].concat(DefaultButtonsMenu)), _ResponsiveCustomMenu);
|
|
19
|
-
exports.ResponsiveCustomMenu = ResponsiveCustomMenu;
|
|
12
|
+
var DefaultButtonsToolbar = exports.DefaultButtonsToolbar = [_types2.IconTypes.strong, _types2.IconTypes.em];
|
|
13
|
+
var DefaultButtonsMenu = exports.DefaultButtonsMenu = [_types2.IconTypes.underline, _types2.IconTypes.strike, _types2.IconTypes.code, _types2.IconTypes.subscript, _types2.IconTypes.superscript];
|
|
14
|
+
var ResponsiveCustomButtonToolbar = exports.ResponsiveCustomButtonToolbar = (_ResponsiveCustomButt = {}, (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.XXL, DefaultButtonsToolbar), (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.XL, DefaultButtonsToolbar), (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.L, DefaultButtonsToolbar), (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.M, []), (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.S, []), (0, _defineProperty2.default)(_ResponsiveCustomButt, _types.ToolbarSize.XXXS, []), _ResponsiveCustomButt);
|
|
15
|
+
var ResponsiveCustomMenu = exports.ResponsiveCustomMenu = (_ResponsiveCustomMenu = {}, (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.XXL, DefaultButtonsMenu), (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.XL, DefaultButtonsMenu), (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.L, DefaultButtonsMenu), (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.M, [_types2.IconTypes.strong, _types2.IconTypes.em].concat(DefaultButtonsMenu)), (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.S, [_types2.IconTypes.strong, _types2.IconTypes.em].concat(DefaultButtonsMenu)), (0, _defineProperty2.default)(_ResponsiveCustomMenu, _types.ToolbarSize.XXXS, [_types2.IconTypes.strong, _types2.IconTypes.em].concat(DefaultButtonsMenu)), _ResponsiveCustomMenu);
|
|
@@ -14,7 +14,7 @@ var _menuState = require("./hooks/menu-state");
|
|
|
14
14
|
var _moreButton = require("./more-button");
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
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
|
-
var FormattingTextDropdownMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
17
|
+
var FormattingTextDropdownMenu = exports.FormattingTextDropdownMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
18
18
|
var editorView = _ref.editorView,
|
|
19
19
|
moreButtonLabel = _ref.moreButtonLabel,
|
|
20
20
|
isReducedSpacing = _ref.isReducedSpacing,
|
|
@@ -82,5 +82,4 @@ var FormattingTextDropdownMenu = /*#__PURE__*/_react.default.memo(function (_ref
|
|
|
82
82
|
},
|
|
83
83
|
"aria-expanded": isMenuOpen
|
|
84
84
|
}));
|
|
85
|
-
});
|
|
86
|
-
exports.FormattingTextDropdownMenu = FormattingTextDropdownMenu;
|
|
85
|
+
});
|
|
@@ -19,7 +19,7 @@ var useClearFormattingPluginState = function useClearFormattingPluginState(edito
|
|
|
19
19
|
return _clearFormatting2.pluginKey.getState(editorState);
|
|
20
20
|
}, [editorState]);
|
|
21
21
|
};
|
|
22
|
-
var useClearIcon = function useClearIcon(_ref) {
|
|
22
|
+
var useClearIcon = exports.useClearIcon = function useClearIcon(_ref) {
|
|
23
23
|
var intl = _ref.intl,
|
|
24
24
|
editorState = _ref.editorState,
|
|
25
25
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI;
|
|
@@ -51,5 +51,4 @@ var useClearIcon = function useClearIcon(_ref) {
|
|
|
51
51
|
'aria-label': _keymaps.clearFormatting ? (0, _keymaps.tooltip)(_keymaps.clearFormatting, String(clearFormattingLabel)) : String(clearFormattingLabel)
|
|
52
52
|
};
|
|
53
53
|
}, [isPluginAvailable, clearFormattingToolbar, clearFormattingLabel, formattingIsPresent]);
|
|
54
|
-
};
|
|
55
|
-
exports.useClearIcon = useClearIcon;
|
|
54
|
+
};
|
|
@@ -176,7 +176,7 @@ var useTextFormattingPluginState = function useTextFormattingPluginState(editorS
|
|
|
176
176
|
return pluginState;
|
|
177
177
|
}, [editorState]);
|
|
178
178
|
};
|
|
179
|
-
var useFormattingIcons = function useFormattingIcons(_ref4) {
|
|
179
|
+
var useFormattingIcons = exports.useFormattingIcons = function useFormattingIcons(_ref4) {
|
|
180
180
|
var isToolbarDisabled = _ref4.isToolbarDisabled,
|
|
181
181
|
editorState = _ref4.editorState,
|
|
182
182
|
intl = _ref4.intl,
|
|
@@ -208,8 +208,7 @@ var useFormattingIcons = function useFormattingIcons(_ref4) {
|
|
|
208
208
|
}, [strongIcon, emIcon, underlineIcon, strikeIcon, codeIcon, subscriptIcon, superscriptIcon]);
|
|
209
209
|
return result;
|
|
210
210
|
};
|
|
211
|
-
exports.
|
|
212
|
-
var useHasFormattingActived = function useHasFormattingActived(_ref5) {
|
|
211
|
+
var useHasFormattingActived = exports.useHasFormattingActived = function useHasFormattingActived(_ref5) {
|
|
213
212
|
var editorState = _ref5.editorState,
|
|
214
213
|
iconTypeList = _ref5.iconTypeList;
|
|
215
214
|
var textFormattingPluginState = useTextFormattingPluginState(editorState);
|
|
@@ -222,5 +221,4 @@ var useHasFormattingActived = function useHasFormattingActived(_ref5) {
|
|
|
222
221
|
});
|
|
223
222
|
}, [textFormattingPluginState, iconTypeList]);
|
|
224
223
|
return hasActiveFormatting;
|
|
225
|
-
};
|
|
226
|
-
exports.useHasFormattingActived = useHasFormattingActived;
|
|
224
|
+
};
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useMenuState = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var useMenuState = function useMenuState() {
|
|
10
|
+
var useMenuState = exports.useMenuState = function useMenuState() {
|
|
11
11
|
var _useState = (0, _react.useState)(false),
|
|
12
12
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
13
13
|
isMenuOpen = _useState2[0],
|
|
@@ -19,5 +19,4 @@ var useMenuState = function useMenuState() {
|
|
|
19
19
|
setIsMenuOpened(false);
|
|
20
20
|
}, []);
|
|
21
21
|
return [isMenuOpen, toggleMenu, closeMenu];
|
|
22
|
-
};
|
|
23
|
-
exports.useMenuState = useMenuState;
|
|
22
|
+
};
|
|
@@ -8,7 +8,7 @@ exports.useResponsiveToolbarButtons = exports.useResponsiveIconTypeMenu = export
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _constants = require("../constants");
|
|
11
|
-
var useResponsiveIconTypeButtons = function useResponsiveIconTypeButtons(_ref) {
|
|
11
|
+
var useResponsiveIconTypeButtons = exports.useResponsiveIconTypeButtons = function useResponsiveIconTypeButtons(_ref) {
|
|
12
12
|
var toolbarSize = _ref.toolbarSize,
|
|
13
13
|
responsivenessEnabled = _ref.responsivenessEnabled;
|
|
14
14
|
var iconTypeList = (0, _react.useMemo)(function () {
|
|
@@ -16,8 +16,7 @@ var useResponsiveIconTypeButtons = function useResponsiveIconTypeButtons(_ref) {
|
|
|
16
16
|
}, [toolbarSize]);
|
|
17
17
|
return responsivenessEnabled ? iconTypeList : _constants.DefaultButtonsToolbar;
|
|
18
18
|
};
|
|
19
|
-
exports.
|
|
20
|
-
var useResponsiveIconTypeMenu = function useResponsiveIconTypeMenu(_ref2) {
|
|
19
|
+
var useResponsiveIconTypeMenu = exports.useResponsiveIconTypeMenu = function useResponsiveIconTypeMenu(_ref2) {
|
|
21
20
|
var toolbarSize = _ref2.toolbarSize,
|
|
22
21
|
responsivenessEnabled = _ref2.responsivenessEnabled;
|
|
23
22
|
var iconTypeList = (0, _react.useMemo)(function () {
|
|
@@ -25,8 +24,7 @@ var useResponsiveIconTypeMenu = function useResponsiveIconTypeMenu(_ref2) {
|
|
|
25
24
|
}, [toolbarSize]);
|
|
26
25
|
return responsivenessEnabled ? iconTypeList : _constants.DefaultButtonsMenu;
|
|
27
26
|
};
|
|
28
|
-
exports.
|
|
29
|
-
var useResponsiveToolbarButtons = function useResponsiveToolbarButtons(_ref3) {
|
|
27
|
+
var useResponsiveToolbarButtons = exports.useResponsiveToolbarButtons = function useResponsiveToolbarButtons(_ref3) {
|
|
30
28
|
var icons = _ref3.icons,
|
|
31
29
|
toolbarSize = _ref3.toolbarSize,
|
|
32
30
|
responsivenessEnabled = _ref3.responsivenessEnabled;
|
|
@@ -56,5 +54,4 @@ var useResponsiveToolbarButtons = function useResponsiveToolbarButtons(_ref3) {
|
|
|
56
54
|
});
|
|
57
55
|
}, [icons, iconTypeList]);
|
|
58
56
|
return iconsPosition;
|
|
59
|
-
};
|
|
60
|
-
exports.useResponsiveToolbarButtons = useResponsiveToolbarButtons;
|
|
57
|
+
};
|
|
@@ -179,5 +179,4 @@ var Toolbar = function Toolbar(_ref2) {
|
|
|
179
179
|
editorAnalyticsAPI: editorAnalyticsAPI
|
|
180
180
|
});
|
|
181
181
|
};
|
|
182
|
-
var _default = (0, _reactIntlNext.injectIntl)(Toolbar);
|
|
183
|
-
exports.default = _default;
|
|
182
|
+
var _default = exports.default = (0, _reactIntlNext.injectIntl)(Toolbar);
|
|
@@ -12,7 +12,7 @@ var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
|
12
12
|
var _more = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/more"));
|
|
13
13
|
/** @jsx jsx */
|
|
14
14
|
|
|
15
|
-
var MoreButton = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
15
|
+
var MoreButton = exports.MoreButton = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
16
16
|
var label = _ref.label,
|
|
17
17
|
ariaExpanded = _ref['aria-expanded'],
|
|
18
18
|
isReducedSpacing = _ref.isReducedSpacing,
|
|
@@ -38,5 +38,4 @@ var MoreButton = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
38
38
|
"aria-label": label,
|
|
39
39
|
"aria-haspopup": true
|
|
40
40
|
});
|
|
41
|
-
});
|
|
42
|
-
exports.MoreButton = MoreButton;
|
|
41
|
+
});
|
|
@@ -13,7 +13,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
13
13
|
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; }
|
|
14
14
|
/** @jsx jsx */
|
|
15
15
|
|
|
16
|
-
var SingleToolbarButtons = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
16
|
+
var SingleToolbarButtons = exports.SingleToolbarButtons = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
17
17
|
var items = _ref.items,
|
|
18
18
|
isReducedSpacing = _ref.isReducedSpacing,
|
|
19
19
|
editorView = _ref.editorView;
|
|
@@ -45,5 +45,4 @@ var SingleToolbarButtons = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
45
45
|
});
|
|
46
46
|
}))
|
|
47
47
|
);
|
|
48
|
-
});
|
|
49
|
-
exports.SingleToolbarButtons = SingleToolbarButtons;
|
|
48
|
+
});
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.IconTypes = void 0;
|
|
7
|
-
var IconTypes = /*#__PURE__*/function (IconTypes) {
|
|
7
|
+
var IconTypes = exports.IconTypes = /*#__PURE__*/function (IconTypes) {
|
|
8
8
|
IconTypes["strong"] = "strong";
|
|
9
9
|
IconTypes["em"] = "em";
|
|
10
10
|
IconTypes["underline"] = "underline";
|
|
@@ -13,5 +13,4 @@ var IconTypes = /*#__PURE__*/function (IconTypes) {
|
|
|
13
13
|
IconTypes["subscript"] = "subscript";
|
|
14
14
|
IconTypes["superscript"] = "superscript";
|
|
15
15
|
return IconTypes;
|
|
16
|
-
}({});
|
|
17
|
-
exports.IconTypes = IconTypes;
|
|
16
|
+
}({});
|
|
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.cellSelectionNodesBetween = void 0;
|
|
7
|
-
var cellSelectionNodesBetween = function cellSelectionNodesBetween(selection, doc, f, startPos) {
|
|
7
|
+
var cellSelectionNodesBetween = exports.cellSelectionNodesBetween = function cellSelectionNodesBetween(selection, doc, f, startPos) {
|
|
8
8
|
selection.forEachCell(function (cell, cellPos) {
|
|
9
9
|
doc.nodesBetween(cellPos, cellPos + cell.nodeSize, f, startPos);
|
|
10
10
|
});
|
|
11
|
-
};
|
|
12
|
-
exports.cellSelectionNodesBetween = cellSelectionNodesBetween;
|
|
11
|
+
};
|
package/dist/cjs/utils.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.markActive = exports.isArrayContainsContent = exports.hasCode = exports.compareItemsArrays = exports.checkFormattingIsPresent = void 0;
|
|
7
7
|
var _mark = require("@atlaskit/editor-common/mark");
|
|
8
8
|
var _clearFormatting = require("./commands/clear-formatting");
|
|
9
|
-
var hasCode = function hasCode(state, pos) {
|
|
9
|
+
var hasCode = exports.hasCode = function hasCode(state, pos) {
|
|
10
10
|
var code = state.schema.marks.code;
|
|
11
11
|
var node = pos >= 0 && state.doc.nodeAt(pos);
|
|
12
12
|
if (node) {
|
|
@@ -20,8 +20,7 @@ var hasCode = function hasCode(state, pos) {
|
|
|
20
20
|
/**
|
|
21
21
|
* Determine if a mark (with specific attribute values) exists anywhere in the selection.
|
|
22
22
|
*/
|
|
23
|
-
exports.
|
|
24
|
-
var markActive = function markActive(state, mark) {
|
|
23
|
+
var markActive = exports.markActive = function markActive(state, mark) {
|
|
25
24
|
var _state$selection = state.selection,
|
|
26
25
|
from = _state$selection.from,
|
|
27
26
|
to = _state$selection.to,
|
|
@@ -37,7 +36,6 @@ var markActive = function markActive(state, mark) {
|
|
|
37
36
|
});
|
|
38
37
|
return found;
|
|
39
38
|
};
|
|
40
|
-
exports.markActive = markActive;
|
|
41
39
|
var blockStylingIsPresent = function blockStylingIsPresent(state) {
|
|
42
40
|
var _state$selection2 = state.selection,
|
|
43
41
|
from = _state$selection2.from,
|
|
@@ -68,19 +66,16 @@ var marksArePresent = function marksArePresent(state) {
|
|
|
68
66
|
});
|
|
69
67
|
return activeMarkTypes.length > 0;
|
|
70
68
|
};
|
|
71
|
-
var checkFormattingIsPresent = function checkFormattingIsPresent(state) {
|
|
69
|
+
var checkFormattingIsPresent = exports.checkFormattingIsPresent = function checkFormattingIsPresent(state) {
|
|
72
70
|
return marksArePresent(state) || blockStylingIsPresent(state);
|
|
73
71
|
};
|
|
74
|
-
exports.
|
|
75
|
-
var compareItemsArrays = function compareItemsArrays(items, prevItems) {
|
|
72
|
+
var compareItemsArrays = exports.compareItemsArrays = function compareItemsArrays(items, prevItems) {
|
|
76
73
|
return items && items.filter(function (item) {
|
|
77
74
|
return !prevItems.includes(item);
|
|
78
75
|
});
|
|
79
76
|
};
|
|
80
|
-
exports.
|
|
81
|
-
var isArrayContainsContent = function isArrayContainsContent(items, content) {
|
|
77
|
+
var isArrayContainsContent = exports.isArrayContainsContent = function isArrayContainsContent(items, content) {
|
|
82
78
|
return items.filter(function (item) {
|
|
83
79
|
return item.content === content;
|
|
84
80
|
}).length > 0;
|
|
85
|
-
};
|
|
86
|
-
exports.isArrayContainsContent = isArrayContainsContent;
|
|
81
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { bindKeymapWithEditorCommand, toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline } from '@atlaskit/editor-common/keymaps';
|
|
3
|
-
import {
|
|
2
|
+
import { bindKeymapWithEditorCommand, isCapsLockOnAndModifyKeyboardEvent, toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline } from '@atlaskit/editor-common/keymaps';
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
5
|
import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalytics, toggleStrongWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../commands';
|
|
5
6
|
export default function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
6
7
|
const list = {};
|
|
@@ -25,5 +26,12 @@ export default function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
|
25
26
|
if (schema.marks.underline) {
|
|
26
27
|
bindKeymapWithEditorCommand(toggleUnderline.common, toggleUnderlineWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
27
28
|
}
|
|
28
|
-
return
|
|
29
|
+
return new SafePlugin({
|
|
30
|
+
props: {
|
|
31
|
+
handleKeyDown(view, event) {
|
|
32
|
+
let keyboardEvent = isCapsLockOnAndModifyKeyboardEvent(event);
|
|
33
|
+
return keydownHandler(list)(view, keyboardEvent);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
29
37
|
}
|
|
@@ -82,7 +82,7 @@ export function clearFormatting(inputMethod, editorAnalyticsAPI) {
|
|
|
82
82
|
});
|
|
83
83
|
tr.setStoredMarks([]);
|
|
84
84
|
if (formattingCleared.length && inputMethod) {
|
|
85
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0
|
|
85
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
86
86
|
action: ACTION.FORMATTED,
|
|
87
87
|
eventType: EVENT_TYPE.TRACK,
|
|
88
88
|
actionSubject: ACTION_SUBJECT.TEXT,
|
package/dist/esm/commands.js
CHANGED
|
@@ -22,7 +22,7 @@ export var toggleEmWithAnalytics = function toggleEmWithAnalytics(editorAnalytic
|
|
|
22
22
|
// No transaction to apply
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
25
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
26
26
|
action: ACTION.FORMATTED,
|
|
27
27
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
28
28
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -57,7 +57,7 @@ export var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(editor
|
|
|
57
57
|
// No transaction to apply
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
60
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
61
61
|
action: ACTION.FORMATTED,
|
|
62
62
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
63
63
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -92,7 +92,7 @@ export var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(editor
|
|
|
92
92
|
// No transaction to apply
|
|
93
93
|
return null;
|
|
94
94
|
}
|
|
95
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
95
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
96
96
|
action: ACTION.FORMATTED,
|
|
97
97
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
98
98
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -127,7 +127,7 @@ export var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(
|
|
|
127
127
|
// No transaction to apply
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
130
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
131
131
|
action: ACTION.FORMATTED,
|
|
132
132
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
133
133
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -164,7 +164,7 @@ export var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalyt
|
|
|
164
164
|
// No transaction to apply
|
|
165
165
|
return null;
|
|
166
166
|
}
|
|
167
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
167
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
168
168
|
action: ACTION.FORMATTED,
|
|
169
169
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
170
170
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -201,7 +201,7 @@ export var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(
|
|
|
201
201
|
// No transaction to apply
|
|
202
202
|
return null;
|
|
203
203
|
}
|
|
204
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
204
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
205
205
|
action: ACTION.FORMATTED,
|
|
206
206
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
207
207
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -236,7 +236,7 @@ export var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(editorAnal
|
|
|
236
236
|
// No transaction to apply
|
|
237
237
|
return null;
|
|
238
238
|
}
|
|
239
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
239
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
240
240
|
action: ACTION.FORMATTED,
|
|
241
241
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
242
242
|
eventType: EVENT_TYPE.TRACK,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -47,7 +47,7 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
47
47
|
plugin: function plugin(_ref2) {
|
|
48
48
|
var _api$analytics;
|
|
49
49
|
var dispatch = _ref2.dispatch;
|
|
50
|
-
return pmPlugin(dispatch, api === null || api === void 0
|
|
50
|
+
return pmPlugin(dispatch, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
51
51
|
}
|
|
52
52
|
}, {
|
|
53
53
|
name: 'textFormattingCursor',
|
|
@@ -59,13 +59,13 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
59
59
|
plugin: function plugin(_ref3) {
|
|
60
60
|
var _api$analytics2;
|
|
61
61
|
var schema = _ref3.schema;
|
|
62
|
-
return textFormattingInputRulePlugin(schema, api === null || api === void 0
|
|
62
|
+
return textFormattingInputRulePlugin(schema, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
63
63
|
}
|
|
64
64
|
}, {
|
|
65
65
|
name: 'textFormattingSmartRule',
|
|
66
66
|
plugin: function plugin() {
|
|
67
67
|
var _api$analytics3;
|
|
68
|
-
return !(options !== null && options !== void 0 && options.disableSmartTextCompletion) ? textFormattingSmartInputRulePlugin(api === null || api === void 0
|
|
68
|
+
return !(options !== null && options !== void 0 && options.disableSmartTextCompletion) ? textFormattingSmartInputRulePlugin(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions) : undefined;
|
|
69
69
|
}
|
|
70
70
|
}, {
|
|
71
71
|
name: 'textFormattingClear',
|
|
@@ -77,14 +77,14 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
77
77
|
name: 'textFormattingClearKeymap',
|
|
78
78
|
plugin: function plugin() {
|
|
79
79
|
var _api$analytics4;
|
|
80
|
-
return clearFormattingKeymapPlugin(api === null || api === void 0
|
|
80
|
+
return clearFormattingKeymapPlugin(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
81
81
|
}
|
|
82
82
|
}, {
|
|
83
83
|
name: 'textFormattingKeymap',
|
|
84
84
|
plugin: function plugin(_ref5) {
|
|
85
85
|
var _api$analytics5;
|
|
86
86
|
var schema = _ref5.schema;
|
|
87
|
-
return keymapPlugin(schema, api === null || api === void 0
|
|
87
|
+
return keymapPlugin(schema, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
88
88
|
}
|
|
89
89
|
}];
|
|
90
90
|
},
|
|
@@ -117,19 +117,19 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
117
117
|
editorView: editorView,
|
|
118
118
|
isToolbarDisabled: disabled,
|
|
119
119
|
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu),
|
|
120
|
-
editorAnalyticsAPI: api === null || api === void 0
|
|
120
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
},
|
|
125
125
|
commands: {
|
|
126
|
-
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0
|
|
127
|
-
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0
|
|
128
|
-
toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0
|
|
129
|
-
toggleCode: toggleCodeWithAnalytics(api === null || api === void 0
|
|
130
|
-
toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0
|
|
131
|
-
toggleEm: toggleEmWithAnalytics(api === null || api === void 0
|
|
132
|
-
toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0
|
|
126
|
+
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions),
|
|
127
|
+
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions),
|
|
128
|
+
toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 || (_api$analytics9 = api.analytics) === null || _api$analytics9 === void 0 ? void 0 : _api$analytics9.actions),
|
|
129
|
+
toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 || (_api$analytics10 = api.analytics) === null || _api$analytics10 === void 0 ? void 0 : _api$analytics10.actions),
|
|
130
|
+
toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 || (_api$analytics11 = api.analytics) === null || _api$analytics11 === void 0 ? void 0 : _api$analytics11.actions),
|
|
131
|
+
toggleEm: toggleEmWithAnalytics(api === null || api === void 0 || (_api$analytics12 = api.analytics) === null || _api$analytics12 === void 0 ? void 0 : _api$analytics12.actions),
|
|
132
|
+
toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 || (_api$analytics13 = api.analytics) === null || _api$analytics13 === void 0 ? void 0 : _api$analytics13.actions)
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
};
|
|
@@ -52,7 +52,7 @@ ValidAutoformatChars.STRONG_MARKDOWN]), _defineProperty(_ValidCombinations, Vali
|
|
|
52
52
|
'( ']), _ValidCombinations);
|
|
53
53
|
function addMark(markType, schema, char) {
|
|
54
54
|
return function (state, match, start, end) {
|
|
55
|
-
var _schema$marks
|
|
55
|
+
var _schema$marks;
|
|
56
56
|
var doc = state.doc,
|
|
57
57
|
schema = state.schema,
|
|
58
58
|
tr = state.tr;
|
|
@@ -60,7 +60,7 @@ function addMark(markType, schema, char) {
|
|
|
60
60
|
|
|
61
61
|
// fixes the following case: my `*name` is *
|
|
62
62
|
// expected result: should ignore special characters inside "code"
|
|
63
|
-
if (textPrefix !== char || schema !== null && schema !== void 0 && (_schema$marks = schema.marks) !== null && _schema$marks !== void 0 && (_schema$marks
|
|
63
|
+
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())) {
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { bindKeymapWithEditorCommand, toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline } from '@atlaskit/editor-common/keymaps';
|
|
3
|
-
import {
|
|
2
|
+
import { bindKeymapWithEditorCommand, isCapsLockOnAndModifyKeyboardEvent, toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline } from '@atlaskit/editor-common/keymaps';
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
5
|
import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalytics, toggleStrongWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../commands';
|
|
5
6
|
export default function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
6
7
|
var list = {};
|
|
@@ -25,5 +26,12 @@ export default function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
|
25
26
|
if (schema.marks.underline) {
|
|
26
27
|
bindKeymapWithEditorCommand(toggleUnderline.common, toggleUnderlineWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
27
28
|
}
|
|
28
|
-
return
|
|
29
|
+
return new SafePlugin({
|
|
30
|
+
props: {
|
|
31
|
+
handleKeyDown: function handleKeyDown(view, event) {
|
|
32
|
+
var keyboardEvent = isCapsLockOnAndModifyKeyboardEvent(event);
|
|
33
|
+
return keydownHandler(list)(view, keyboardEvent);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
29
37
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
export default function keymapPlugin(schema: Schema, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
export default function keymapPlugin(schema: Schema, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-formatting",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "Text-formatting plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^32.0.0",
|
|
35
|
-
"@atlaskit/editor-common": "^76.
|
|
35
|
+
"@atlaskit/editor-common": "^76.13.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^2.8.0",
|