@atlaskit/editor-core 187.34.1 → 187.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/index.js +10 -42
- package/dist/cjs/plugins/block-type/commands/block-type.js +19 -211
- package/dist/cjs/plugins/block-type/commands/index.js +2 -28
- package/dist/cjs/plugins/block-type/index.js +21 -4
- package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +9 -64
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/cjs/plugins/code-block/actions.js +83 -6
- package/dist/cjs/plugins/code-block/index.js +27 -12
- package/dist/cjs/plugins/code-block/pm-plugins/input-rule.js +68 -0
- package/dist/cjs/plugins/copy-button/commands.js +2 -1
- package/dist/cjs/plugins/date/ui/DatePicker/index.js +3 -2
- package/dist/cjs/plugins/expand/commands.js +3 -3
- package/dist/cjs/plugins/expand/index.js +2 -2
- package/dist/cjs/plugins/index.js +1 -7
- package/dist/cjs/plugins/insert-block/index.js +34 -29
- package/dist/cjs/plugins/panel/actions.js +26 -2
- package/dist/cjs/plugins/panel/index.js +9 -5
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/index.js +16 -2
- package/dist/es2019/plugins/block-type/commands/block-type.js +15 -217
- package/dist/es2019/plugins/block-type/commands/index.js +1 -3
- package/dist/es2019/plugins/block-type/index.js +21 -4
- package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +3 -56
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/code-block/actions.js +84 -3
- package/dist/es2019/plugins/code-block/index.js +22 -7
- package/dist/es2019/plugins/code-block/pm-plugins/input-rule.js +60 -0
- package/dist/es2019/plugins/copy-button/commands.js +2 -1
- package/dist/es2019/plugins/date/ui/DatePicker/index.js +3 -2
- package/dist/es2019/plugins/expand/commands.js +1 -1
- package/dist/es2019/plugins/expand/index.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/insert-block/index.js +47 -42
- package/dist/es2019/plugins/panel/actions.js +26 -2
- package/dist/es2019/plugins/panel/index.js +8 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/index.js +16 -2
- package/dist/esm/plugins/block-type/commands/block-type.js +17 -205
- package/dist/esm/plugins/block-type/commands/index.js +1 -3
- package/dist/esm/plugins/block-type/index.js +21 -4
- package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +3 -58
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/code-block/actions.js +76 -3
- package/dist/esm/plugins/code-block/index.js +25 -11
- package/dist/esm/plugins/code-block/pm-plugins/input-rule.js +62 -0
- package/dist/esm/plugins/copy-button/commands.js +2 -1
- package/dist/esm/plugins/date/ui/DatePicker/index.js +3 -2
- package/dist/esm/plugins/expand/commands.js +1 -1
- package/dist/esm/plugins/expand/index.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/insert-block/index.js +27 -22
- package/dist/esm/plugins/panel/actions.js +24 -2
- package/dist/esm/plugins/panel/index.js +8 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/index.d.ts +16 -3
- package/dist/types/labs/next/presets/default.d.ts +6 -0
- package/dist/types/plugins/block-type/commands/block-type.d.ts +1 -25
- package/dist/types/plugins/block-type/commands/index.d.ts +1 -3
- package/dist/types/plugins/block-type/index.d.ts +10 -2
- package/dist/types/plugins/code-block/actions.d.ts +11 -0
- package/dist/types/plugins/code-block/index.d.ts +6 -1
- package/dist/types/plugins/code-block/pm-plugins/input-rule.d.ts +3 -0
- package/dist/types/plugins/date/ui/DatePicker/index.d.ts +2 -2
- package/dist/types/plugins/index.d.ts +0 -2
- package/dist/types/plugins/insert-block/types.d.ts +7 -1
- package/dist/types/plugins/panel/actions.d.ts +4 -1
- package/dist/types/plugins/panel/index.d.ts +11 -2
- package/dist/types-ts4.5/index.d.ts +16 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +6 -0
- package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +1 -25
- package/dist/types-ts4.5/plugins/block-type/commands/index.d.ts +1 -3
- package/dist/types-ts4.5/plugins/block-type/index.d.ts +10 -2
- package/dist/types-ts4.5/plugins/code-block/actions.d.ts +11 -0
- package/dist/types-ts4.5/plugins/code-block/index.d.ts +6 -1
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/input-rule.d.ts +3 -0
- package/dist/types-ts4.5/plugins/date/ui/DatePicker/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +7 -1
- package/dist/types-ts4.5/plugins/panel/actions.d.ts +4 -1
- package/dist/types-ts4.5/plugins/panel/index.d.ts +9 -2
- package/package.json +5 -5
- package/report.api.md +62 -23
- package/tmp/api-report-tmp.d.ts +49 -15
- package/dist/cjs/plugins/block-type/commands/insert-block.js +0 -60
- package/dist/es2019/plugins/block-type/commands/insert-block.js +0 -55
- package/dist/esm/plugins/block-type/commands/insert-block.js +0 -53
- package/dist/types/plugins/block-type/commands/insert-block.d.ts +0 -5
- package/dist/types-ts4.5/plugins/block-type/commands/insert-block.d.ts +0 -5
- /package/dist/cjs/plugins/{block-type/commands → code-block}/transform-to-code-block.js +0 -0
- /package/dist/es2019/plugins/{block-type/commands → code-block}/transform-to-code-block.js +0 -0
- /package/dist/esm/plugins/{block-type/commands → code-block}/transform-to-code-block.js +0 -0
- /package/dist/types/plugins/{block-type/commands → code-block}/transform-to-code-block.d.ts +0 -0
- /package/dist/types-ts4.5/plugins/{block-type/commands → code-block}/transform-to-code-block.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.35.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`3542bead318`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3542bead318) - Move block type commands to next editor plugin actions
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`02e113fb1e4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/02e113fb1e4) - Update test fixtures for calendar update.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 187.34.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`5e0bef65120`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5e0bef65120) - [ux] Fix copy button for mediaSingle with link or border
|
|
19
|
+
|
|
3
20
|
## 187.34.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -185,12 +185,6 @@ Object.defineProperty(exports, "WithPluginState", {
|
|
|
185
185
|
return _WithPluginState.default;
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
|
-
Object.defineProperty(exports, "blockPluginStateKey", {
|
|
189
|
-
enumerable: true,
|
|
190
|
-
get: function get() {
|
|
191
|
-
return _plugins.blockPluginStateKey;
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
188
|
Object.defineProperty(exports, "changeColor", {
|
|
195
189
|
enumerable: true,
|
|
196
190
|
get: function get() {
|
|
@@ -212,7 +206,7 @@ Object.defineProperty(exports, "commitStatusPicker", {
|
|
|
212
206
|
Object.defineProperty(exports, "createTable", {
|
|
213
207
|
enumerable: true,
|
|
214
208
|
get: function get() {
|
|
215
|
-
return
|
|
209
|
+
return _commands3.createTable;
|
|
216
210
|
}
|
|
217
211
|
});
|
|
218
212
|
Object.defineProperty(exports, "createTypeAheadTools", {
|
|
@@ -275,18 +269,6 @@ Object.defineProperty(exports, "historyPluginKey", {
|
|
|
275
269
|
return _history.historyPluginKey;
|
|
276
270
|
}
|
|
277
271
|
});
|
|
278
|
-
Object.defineProperty(exports, "insertBlockType", {
|
|
279
|
-
enumerable: true,
|
|
280
|
-
get: function get() {
|
|
281
|
-
return _commands3.insertBlockType;
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
Object.defineProperty(exports, "insertBlockTypesWithAnalytics", {
|
|
285
|
-
enumerable: true,
|
|
286
|
-
get: function get() {
|
|
287
|
-
return _commands3.insertBlockTypesWithAnalytics;
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
272
|
Object.defineProperty(exports, "insertDate", {
|
|
291
273
|
enumerable: true,
|
|
292
274
|
get: function get() {
|
|
@@ -296,7 +278,7 @@ Object.defineProperty(exports, "insertDate", {
|
|
|
296
278
|
Object.defineProperty(exports, "insertExpand", {
|
|
297
279
|
enumerable: true,
|
|
298
280
|
get: function get() {
|
|
299
|
-
return
|
|
281
|
+
return _commands6.insertExpand;
|
|
300
282
|
}
|
|
301
283
|
});
|
|
302
284
|
Object.defineProperty(exports, "insertHorizontalRule", {
|
|
@@ -314,7 +296,7 @@ Object.defineProperty(exports, "insertMediaSingleNode", {
|
|
|
314
296
|
Object.defineProperty(exports, "insertTaskDecisionCommand", {
|
|
315
297
|
enumerable: true,
|
|
316
298
|
get: function get() {
|
|
317
|
-
return
|
|
299
|
+
return _commands4.insertTaskDecisionCommand;
|
|
318
300
|
}
|
|
319
301
|
});
|
|
320
302
|
Object.defineProperty(exports, "lightModeStatusColorPalette", {
|
|
@@ -377,34 +359,22 @@ Object.defineProperty(exports, "selectionPluginKey", {
|
|
|
377
359
|
return _mobileSelection.selectionPluginKey;
|
|
378
360
|
}
|
|
379
361
|
});
|
|
380
|
-
Object.defineProperty(exports, "setBlockType", {
|
|
381
|
-
enumerable: true,
|
|
382
|
-
get: function get() {
|
|
383
|
-
return _commands3.setBlockType;
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
Object.defineProperty(exports, "setBlockTypeWithAnalytics", {
|
|
387
|
-
enumerable: true,
|
|
388
|
-
get: function get() {
|
|
389
|
-
return _commands3.setBlockTypeWithAnalytics;
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
362
|
Object.defineProperty(exports, "setIsExpanded", {
|
|
393
363
|
enumerable: true,
|
|
394
364
|
get: function get() {
|
|
395
|
-
return
|
|
365
|
+
return _commands5.setIsExpanded;
|
|
396
366
|
}
|
|
397
367
|
});
|
|
398
368
|
Object.defineProperty(exports, "setKeyboardHeight", {
|
|
399
369
|
enumerable: true,
|
|
400
370
|
get: function get() {
|
|
401
|
-
return
|
|
371
|
+
return _commands5.setKeyboardHeight;
|
|
402
372
|
}
|
|
403
373
|
});
|
|
404
374
|
Object.defineProperty(exports, "setMobilePaddingTop", {
|
|
405
375
|
enumerable: true,
|
|
406
376
|
get: function get() {
|
|
407
|
-
return
|
|
377
|
+
return _commands5.setMobilePaddingTop;
|
|
408
378
|
}
|
|
409
379
|
});
|
|
410
380
|
Object.defineProperty(exports, "setStatusPickerAt", {
|
|
@@ -493,12 +463,10 @@ var _mentions = require("./plugins/mentions");
|
|
|
493
463
|
var _textColor = require("./plugins/text-color");
|
|
494
464
|
var _changeColor = require("./plugins/text-color/commands/change-color");
|
|
495
465
|
var _commands2 = require("./plugins/rule/commands");
|
|
496
|
-
var _plugins = require("./plugins");
|
|
497
466
|
var _toolbarAndPickerUpdates = require("./plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates");
|
|
498
467
|
var _typeAheadUpdates = require("./plugins/view-update-subscription/subscribe/type-ahead-updates");
|
|
499
|
-
var _commands3 = require("
|
|
500
|
-
var _commands4 = require("
|
|
501
|
-
var _commands5 = require("./plugins/tasks-and-decisions/commands");
|
|
468
|
+
var _commands3 = require("@atlaskit/editor-plugin-table/commands");
|
|
469
|
+
var _commands4 = require("./plugins/tasks-and-decisions/commands");
|
|
502
470
|
var _eventDispatcher = require("./event-dispatcher");
|
|
503
471
|
var _plugin = require("./plugins/status/plugin");
|
|
504
472
|
var _actions = require("./plugins/date/actions");
|
|
@@ -508,7 +476,7 @@ var _actions2 = require("./plugins/status/actions");
|
|
|
508
476
|
var _typeAhead = require("./plugins/type-ahead");
|
|
509
477
|
var _history = require("./plugins/history");
|
|
510
478
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
511
|
-
var
|
|
479
|
+
var _commands5 = require("./plugins/mobile-dimensions/commands");
|
|
512
480
|
var _utils = require("./utils");
|
|
513
481
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
514
482
|
var _createEditor = require("./create-editor");
|
|
@@ -516,7 +484,7 @@ var _actions3 = _interopRequireDefault(require("./actions"));
|
|
|
516
484
|
var _portalProvider = require("@atlaskit/editor-common/portal-provider");
|
|
517
485
|
var _gapCursorSelection = require("./plugins/selection/gap-cursor-selection");
|
|
518
486
|
var _mobileSelection = require("./plugins/mobile-selection");
|
|
519
|
-
var
|
|
487
|
+
var _commands6 = require("./plugins/expand/commands");
|
|
520
488
|
var _WithPluginState = _interopRequireDefault(require("./ui/WithPluginState"));
|
|
521
489
|
var _statusColorPalette = require("./ui/ColorPalette/Palettes/statusColorPalette");
|
|
522
490
|
var _common = require("./ui/ColorPalette/Palettes/common");
|
|
@@ -3,27 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.cleanUpAtTheStartOfDocument = void 0;
|
|
7
|
-
exports.createInsertCodeBlockTransaction = createInsertCodeBlockTransaction;
|
|
8
|
-
exports.createWrapSelectionTransaction = createWrapSelectionTransaction;
|
|
9
|
-
exports.insertBlockType = insertBlockType;
|
|
10
|
-
exports.insertBlockTypesWithAnalytics = void 0;
|
|
6
|
+
exports.insertBlockQuoteWithAnalytics = exports.cleanUpAtTheStartOfDocument = void 0;
|
|
11
7
|
exports.setBlockType = setBlockType;
|
|
12
8
|
exports.setBlockTypeWithAnalytics = setBlockTypeWithAnalytics;
|
|
13
9
|
exports.setHeading = setHeading;
|
|
14
10
|
exports.setHeadingWithAnalytics = void 0;
|
|
15
11
|
exports.setNormalText = setNormalText;
|
|
16
12
|
exports.setNormalTextWithAnalytics = setNormalTextWithAnalytics;
|
|
17
|
-
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
18
|
-
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
19
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
20
13
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
21
|
-
var _insert = require("@atlaskit/editor-common/insert");
|
|
22
14
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
23
15
|
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
24
|
-
var
|
|
16
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
25
17
|
var _types = require("../types");
|
|
26
|
-
var _transformToCodeBlock = require("./transform-to-code-block");
|
|
27
18
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
28
19
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
29
20
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -76,7 +67,7 @@ function withCurrentHeadingLevel(fn) {
|
|
|
76
67
|
var _state$schema$nodes = state.schema.nodes,
|
|
77
68
|
heading = _state$schema$nodes.heading,
|
|
78
69
|
paragraph = _state$schema$nodes.paragraph;
|
|
79
|
-
var nodes = (0,
|
|
70
|
+
var nodes = (0, _utils.filterChildrenBetween)(state.doc, state.selection.from, state.selection.to, function (node) {
|
|
80
71
|
return node.type === heading || node.type === paragraph;
|
|
81
72
|
});
|
|
82
73
|
|
|
@@ -154,25 +145,11 @@ var setHeadingWithAnalytics = function setHeadingWithAnalytics(newHeadingLevel,
|
|
|
154
145
|
});
|
|
155
146
|
};
|
|
156
147
|
exports.setHeadingWithAnalytics = setHeadingWithAnalytics;
|
|
157
|
-
function
|
|
148
|
+
function insertBlockQuote() {
|
|
158
149
|
return function (state, dispatch) {
|
|
159
150
|
var nodes = state.schema.nodes;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (nodes.paragraph && nodes.blockquote) {
|
|
163
|
-
return wrapSelectionIn(nodes.blockquote)(state, dispatch);
|
|
164
|
-
}
|
|
165
|
-
break;
|
|
166
|
-
case _types.CODE_BLOCK.name:
|
|
167
|
-
if (nodes.codeBlock) {
|
|
168
|
-
return insertCodeBlock()(state, dispatch);
|
|
169
|
-
}
|
|
170
|
-
break;
|
|
171
|
-
case _types.PANEL.name:
|
|
172
|
-
if (nodes.panel && nodes.paragraph) {
|
|
173
|
-
return wrapSelectionIn(nodes.panel)(state, dispatch);
|
|
174
|
-
}
|
|
175
|
-
break;
|
|
151
|
+
if (nodes.paragraph && nodes.blockquote) {
|
|
152
|
+
return (0, _utils.wrapSelectionIn)(nodes.blockquote)(state, dispatch);
|
|
176
153
|
}
|
|
177
154
|
return false;
|
|
178
155
|
};
|
|
@@ -186,190 +163,21 @@ function insertBlockType(name) {
|
|
|
186
163
|
* otherwise Editor becomes very sad and crashes
|
|
187
164
|
* @returns - command that inserts block type
|
|
188
165
|
*/
|
|
189
|
-
var
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
attributes: {
|
|
198
|
-
inputMethod: inputMethod
|
|
199
|
-
}
|
|
200
|
-
})(insertBlockType(name));
|
|
201
|
-
case _types.CODE_BLOCK.name:
|
|
202
|
-
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsApi, {
|
|
203
|
-
action: _analytics.ACTION.INSERTED,
|
|
204
|
-
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
205
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.CODE_BLOCK,
|
|
206
|
-
attributes: {
|
|
207
|
-
inputMethod: inputMethod
|
|
208
|
-
},
|
|
209
|
-
eventType: _analytics.EVENT_TYPE.TRACK
|
|
210
|
-
})(insertBlockType(name));
|
|
211
|
-
case _types.PANEL.name:
|
|
212
|
-
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsApi, {
|
|
213
|
-
action: _analytics.ACTION.INSERTED,
|
|
214
|
-
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
215
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PANEL,
|
|
216
|
-
attributes: {
|
|
217
|
-
inputMethod: inputMethod,
|
|
218
|
-
panelType: _adfSchema.PanelType.INFO // only info panels can be inserted from toolbar
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
eventType: _analytics.EVENT_TYPE.TRACK
|
|
222
|
-
})(insertBlockType(name));
|
|
223
|
-
default:
|
|
224
|
-
return insertBlockType(name);
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* This function creates a new transaction that wraps the current selection
|
|
230
|
-
* in the specified node type if it results in a valid transaction.
|
|
231
|
-
* If not valid, it performs a safe insert operation.
|
|
232
|
-
*
|
|
233
|
-
* Example of when wrapping might not be valid is when attempting to wrap
|
|
234
|
-
* content that is already inside a panel with another panel
|
|
235
|
-
*/
|
|
236
|
-
exports.insertBlockTypesWithAnalytics = insertBlockTypesWithAnalytics;
|
|
237
|
-
function createWrapSelectionTransaction(_ref3) {
|
|
238
|
-
var state = _ref3.state,
|
|
239
|
-
type = _ref3.type,
|
|
240
|
-
nodeAttributes = _ref3.nodeAttributes;
|
|
241
|
-
var tr = state.tr;
|
|
242
|
-
var _state$schema$marks = state.schema.marks,
|
|
243
|
-
alignment = _state$schema$marks.alignment,
|
|
244
|
-
indentation = _state$schema$marks.indentation;
|
|
245
|
-
|
|
246
|
-
/** Alignment or Indentation is not valid inside block types */
|
|
247
|
-
var removeAlignTr = (0, _utils2.removeBlockMarks)(state, [alignment, indentation]);
|
|
248
|
-
tr = removeAlignTr || tr;
|
|
249
|
-
|
|
250
|
-
/**Get range and wrapping needed for the selection*/
|
|
251
|
-
var _getWrappingOptions = getWrappingOptions(state, type, nodeAttributes),
|
|
252
|
-
range = _getWrappingOptions.range,
|
|
253
|
-
wrapping = _getWrappingOptions.wrapping;
|
|
254
|
-
if (wrapping) {
|
|
255
|
-
tr.wrap(range, wrapping).scrollIntoView();
|
|
256
|
-
} else {
|
|
257
|
-
/** We always want to append a block type */
|
|
258
|
-
(0, _utils.safeInsert)(type.createAndFill(nodeAttributes))(tr).scrollIntoView();
|
|
259
|
-
}
|
|
260
|
-
return tr;
|
|
261
|
-
}
|
|
262
|
-
function getWrappingOptions(state, type, nodeAttributes) {
|
|
263
|
-
var _state$selection = state.selection,
|
|
264
|
-
$from = _state$selection.$from,
|
|
265
|
-
$to = _state$selection.$to;
|
|
266
|
-
var range = $from.blockRange($to);
|
|
267
|
-
var isAllowedChild = true;
|
|
268
|
-
/**
|
|
269
|
-
* Added a check to avoid wrapping codeblock
|
|
270
|
-
*/
|
|
271
|
-
if (state.selection.empty) {
|
|
272
|
-
state.doc.nodesBetween($from.pos, $to.pos, function (node) {
|
|
273
|
-
if (!isAllowedChild) {
|
|
274
|
-
return false;
|
|
275
|
-
}
|
|
276
|
-
return isAllowedChild = node.type !== state.schema.nodes.codeBlock;
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
var wrapping = isAllowedChild && range && (0, _transform.findWrapping)(range, type, nodeAttributes);
|
|
280
|
-
return {
|
|
281
|
-
range: range,
|
|
282
|
-
wrapping: wrapping
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Function will add wrapping node.
|
|
288
|
-
* 1. If currently selected blocks can be wrapped in the wrapper type it will wrap them.
|
|
289
|
-
* 2. If current block can not be wrapped inside wrapping block it will create a new block below selection,
|
|
290
|
-
* and set selection on it.
|
|
291
|
-
*/
|
|
292
|
-
function wrapSelectionIn(type) {
|
|
293
|
-
return function (state, dispatch) {
|
|
294
|
-
var tr = createWrapSelectionTransaction({
|
|
295
|
-
state: state,
|
|
296
|
-
type: type
|
|
297
|
-
});
|
|
298
|
-
if (dispatch) {
|
|
299
|
-
dispatch(tr);
|
|
300
|
-
}
|
|
301
|
-
return true;
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* This function creates a new transaction that inserts a code block,
|
|
307
|
-
* if there is text selected it will wrap the current selection if not it will
|
|
308
|
-
* append the codeblock to the end of the document.
|
|
309
|
-
*/
|
|
310
|
-
function createInsertCodeBlockTransaction(_ref4) {
|
|
311
|
-
var _state$selection$$fro;
|
|
312
|
-
var state = _ref4.state;
|
|
313
|
-
var tr = state.tr;
|
|
314
|
-
var from = state.selection.from;
|
|
315
|
-
var codeBlock = state.schema.nodes.codeBlock;
|
|
316
|
-
var grandParentNodeType = (_state$selection$$fro = state.selection.$from.node(-1)) === null || _state$selection$$fro === void 0 ? void 0 : _state$selection$$fro.type;
|
|
317
|
-
var parentNodeType = state.selection.$from.parent.type;
|
|
318
|
-
|
|
319
|
-
/** We always want to append a codeBlock unless we're inserting into a paragraph
|
|
320
|
-
* AND it's a valid child of the grandparent node.
|
|
321
|
-
* Insert the current selection as codeBlock content unless it contains nodes other
|
|
322
|
-
* than paragraphs and inline.
|
|
323
|
-
*/
|
|
324
|
-
var canInsertCodeBlock = (0, _insert.shouldSplitSelectedNodeOnNodeInsertion)({
|
|
325
|
-
parentNodeType: parentNodeType,
|
|
326
|
-
grandParentNodeType: grandParentNodeType,
|
|
327
|
-
content: codeBlock.createAndFill()
|
|
328
|
-
}) && contentAllowedInCodeBlock(state);
|
|
329
|
-
if (canInsertCodeBlock) {
|
|
330
|
-
tr = (0, _transformToCodeBlock.transformToCodeBlockAction)(state, from);
|
|
331
|
-
} else {
|
|
332
|
-
(0, _utils.safeInsert)(codeBlock.createAndFill())(tr).scrollIntoView();
|
|
333
|
-
}
|
|
334
|
-
return tr;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Function will insert code block at current selection if block is empty or below current selection and set focus on it.
|
|
339
|
-
*/
|
|
340
|
-
function insertCodeBlock() {
|
|
341
|
-
return function (state, dispatch) {
|
|
342
|
-
var tr = createInsertCodeBlockTransaction({
|
|
343
|
-
state: state
|
|
344
|
-
});
|
|
345
|
-
if (dispatch) {
|
|
346
|
-
dispatch(tr);
|
|
166
|
+
var insertBlockQuoteWithAnalytics = function insertBlockQuoteWithAnalytics(inputMethod, editorAnalyticsApi) {
|
|
167
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsApi, {
|
|
168
|
+
action: _analytics.ACTION.FORMATTED,
|
|
169
|
+
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
170
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
171
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_BLOCK_QUOTE,
|
|
172
|
+
attributes: {
|
|
173
|
+
inputMethod: inputMethod
|
|
347
174
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Check if the current selection contains any nodes that are not permitted
|
|
354
|
-
* as codeBlock child nodes. Note that this allows paragraphs and inline nodes
|
|
355
|
-
* as we extract their text content.
|
|
356
|
-
*/
|
|
357
|
-
function contentAllowedInCodeBlock(state) {
|
|
358
|
-
var _state$selection2 = state.selection,
|
|
359
|
-
$from = _state$selection2.$from,
|
|
360
|
-
$to = _state$selection2.$to;
|
|
361
|
-
var isAllowedChild = true;
|
|
362
|
-
state.doc.nodesBetween($from.pos, $to.pos, function (node) {
|
|
363
|
-
if (!isAllowedChild) {
|
|
364
|
-
return false;
|
|
365
|
-
}
|
|
366
|
-
return isAllowedChild = node.type === state.schema.nodes.listItem || node.type === state.schema.nodes.bulletList || node.type === state.schema.nodes.orderedList || node.type === state.schema.nodes.paragraph || node.isInline || node.isText;
|
|
367
|
-
});
|
|
368
|
-
return isAllowedChild;
|
|
369
|
-
}
|
|
175
|
+
})(insertBlockQuote());
|
|
176
|
+
};
|
|
177
|
+
exports.insertBlockQuoteWithAnalytics = insertBlockQuoteWithAnalytics;
|
|
370
178
|
var cleanUpAtTheStartOfDocument = function cleanUpAtTheStartOfDocument(state, dispatch) {
|
|
371
|
-
var
|
|
372
|
-
$cursor =
|
|
179
|
+
var _ref3 = state.selection,
|
|
180
|
+
$cursor = _ref3.$cursor;
|
|
373
181
|
if ($cursor && !$cursor.nodeBefore && !$cursor.nodeAfter && $cursor.pos === 1) {
|
|
374
182
|
var tr = state.tr,
|
|
375
183
|
schema = state.schema;
|
|
@@ -21,28 +21,10 @@ Object.defineProperty(exports, "deleteBlockContent", {
|
|
|
21
21
|
return _deleteBlockContent.deleteBlockContent;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "insertBlockQuoteWithAnalytics", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function get() {
|
|
27
|
-
return
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "insertBlockType", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _blockType.insertBlockType;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "insertBlockTypesWithAnalytics", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function get() {
|
|
39
|
-
return _blockType.insertBlockTypesWithAnalytics;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "isConvertableToCodeBlock", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _transformToCodeBlock.isConvertableToCodeBlock;
|
|
27
|
+
return _blockType.insertBlockQuoteWithAnalytics;
|
|
46
28
|
}
|
|
47
29
|
});
|
|
48
30
|
Object.defineProperty(exports, "setBlockType", {
|
|
@@ -81,14 +63,6 @@ Object.defineProperty(exports, "setNormalTextWithAnalytics", {
|
|
|
81
63
|
return _blockType.setNormalTextWithAnalytics;
|
|
82
64
|
}
|
|
83
65
|
});
|
|
84
|
-
Object.defineProperty(exports, "transformToCodeBlockAction", {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: function get() {
|
|
87
|
-
return _transformToCodeBlock.transformToCodeBlockAction;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
66
|
var _blockType = require("./block-type");
|
|
91
|
-
var _insertBlock = require("./insert-block");
|
|
92
|
-
var _transformToCodeBlock = require("./transform-to-code-block");
|
|
93
67
|
var _deleteAndMoveCursor = require("./delete-and-move-cursor");
|
|
94
68
|
var _deleteBlockContent = require("./delete-block-content");
|
|
@@ -25,6 +25,7 @@ var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
|
|
|
25
25
|
var _ToolbarBlockType = _interopRequireDefault(require("./ui/ToolbarBlockType"));
|
|
26
26
|
var _commands = require("./commands");
|
|
27
27
|
var _messages = require("./messages");
|
|
28
|
+
var _blockType = require("./commands/block-type");
|
|
28
29
|
var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editorAnalyticsApi) {
|
|
29
30
|
var formatMessage = _ref.formatMessage;
|
|
30
31
|
if (!isAllowed) {
|
|
@@ -150,6 +151,22 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
|
150
151
|
}
|
|
151
152
|
}];
|
|
152
153
|
},
|
|
154
|
+
actions: {
|
|
155
|
+
insertBlockQuote: function insertBlockQuote(inputMethod) {
|
|
156
|
+
var _api$analytics4;
|
|
157
|
+
return (0, _blockType.insertBlockQuoteWithAnalytics)(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
158
|
+
},
|
|
159
|
+
setBlockType: function setBlockType(name, inputMethod) {
|
|
160
|
+
var _api$analytics5;
|
|
161
|
+
return (0, _commands.setBlockTypeWithAnalytics)(name, inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
getSharedState: function getSharedState(editorState) {
|
|
165
|
+
if (!editorState) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
return _main.pluginKey.getState(editorState);
|
|
169
|
+
},
|
|
153
170
|
primaryToolbarComponent: function primaryToolbarComponent(_ref7) {
|
|
154
171
|
var editorView = _ref7.editorView,
|
|
155
172
|
popupsMountPoint = _ref7.popupsMountPoint,
|
|
@@ -161,8 +178,8 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
|
161
178
|
eventDispatcher = _ref7.eventDispatcher;
|
|
162
179
|
var isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < _types.ToolbarSize.XXL : toolbarSize < _types.ToolbarSize.XL;
|
|
163
180
|
var boundSetBlockType = function boundSetBlockType(name) {
|
|
164
|
-
var _api$
|
|
165
|
-
return (0, _commands.setBlockTypeWithAnalytics)(name, _analytics.INPUT_METHOD.TOOLBAR, api === null || api === void 0 ? void 0 : (_api$
|
|
181
|
+
var _api$analytics6;
|
|
182
|
+
return (0, _commands.setBlockTypeWithAnalytics)(name, _analytics.INPUT_METHOD.TOOLBAR, api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)(editorView.state, editorView.dispatch);
|
|
166
183
|
};
|
|
167
184
|
return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
|
|
168
185
|
editorView: editorView,
|
|
@@ -187,9 +204,9 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
|
187
204
|
},
|
|
188
205
|
pluginsOptions: {
|
|
189
206
|
quickInsert: function quickInsert(intl) {
|
|
190
|
-
var _api$
|
|
207
|
+
var _api$analytics7, _api$analytics8;
|
|
191
208
|
var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
|
|
192
|
-
return [].concat((0, _toConsumableArray2.default)(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$
|
|
209
|
+
return [].concat((0, _toConsumableArray2.default)(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)), (0, _toConsumableArray2.default)(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)));
|
|
193
210
|
}
|
|
194
211
|
}
|
|
195
212
|
};
|
|
@@ -6,13 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
9
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
11
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _utils3 = require("../utils");
|
|
11
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
|
+
var _commands = require("@atlaskit/editor-common/commands");
|
|
13
|
+
var _utils2 = require("../utils");
|
|
16
14
|
var MAX_HEADING_LEVEL = 6;
|
|
17
15
|
function getHeadingLevel(match) {
|
|
18
16
|
return {
|
|
@@ -20,14 +18,14 @@ function getHeadingLevel(match) {
|
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
20
|
function headingRule(nodeType, maxLevel) {
|
|
23
|
-
return (0,
|
|
21
|
+
return (0, _utils2.createWrappingTextBlockRule)({
|
|
24
22
|
match: new RegExp('^(#{1,' + maxLevel + '})\\s$'),
|
|
25
23
|
nodeType: nodeType,
|
|
26
24
|
getAttrs: getHeadingLevel
|
|
27
25
|
});
|
|
28
26
|
}
|
|
29
27
|
function blockQuoteRule(nodeType) {
|
|
30
|
-
return (0,
|
|
28
|
+
return (0, _utils2.createJoinNodesRule)(/^\s*>\s$/, nodeType);
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
/**
|
|
@@ -41,13 +39,13 @@ function getHeadingRules(editorAnalyticsAPI, schema) {
|
|
|
41
39
|
var hashRule = headingRule(schema.nodes.heading, MAX_HEADING_LEVEL);
|
|
42
40
|
var leftNodeReplacementHashRule = (0, _prosemirrorInputRules.createRule)(new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "(#{1,6})\\s$")), function (state, match, start, end) {
|
|
43
41
|
var level = match[1].length;
|
|
44
|
-
return (0,
|
|
42
|
+
return (0, _commands.insertBlock)(state, schema.nodes.heading, start, end, {
|
|
45
43
|
level: level
|
|
46
44
|
});
|
|
47
45
|
});
|
|
48
46
|
|
|
49
47
|
// New analytics handler
|
|
50
|
-
var ruleWithHeadingAnalytics = (0,
|
|
48
|
+
var ruleWithHeadingAnalytics = (0, _utils.inputRuleWithAnalytics)(function (_state, matchResult) {
|
|
51
49
|
return {
|
|
52
50
|
action: _analytics.ACTION.FORMATTED,
|
|
53
51
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
@@ -72,11 +70,11 @@ function getBlockQuoteRules(editorAnalyticsAPI, schema) {
|
|
|
72
70
|
// '> ' for blockquote
|
|
73
71
|
var greatherThanRule = blockQuoteRule(schema.nodes.blockquote);
|
|
74
72
|
var leftNodeReplacementGreatherRule = (0, _prosemirrorInputRules.createRule)(new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "\\s*>\\s$")), function (state, _match, start, end) {
|
|
75
|
-
return (0,
|
|
73
|
+
return (0, _commands.insertBlock)(state, schema.nodes.blockquote, start, end);
|
|
76
74
|
});
|
|
77
75
|
|
|
78
76
|
// Analytics V3 handler
|
|
79
|
-
var ruleWithBlockQuoteAnalytics = (0,
|
|
77
|
+
var ruleWithBlockQuoteAnalytics = (0, _utils.inputRuleWithAnalytics)({
|
|
80
78
|
action: _analytics.ACTION.FORMATTED,
|
|
81
79
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
82
80
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
@@ -87,56 +85,6 @@ function getBlockQuoteRules(editorAnalyticsAPI, schema) {
|
|
|
87
85
|
}, editorAnalyticsAPI);
|
|
88
86
|
return [ruleWithBlockQuoteAnalytics(greatherThanRule), ruleWithBlockQuoteAnalytics(leftNodeReplacementGreatherRule)];
|
|
89
87
|
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Get all code block input rules
|
|
93
|
-
*
|
|
94
|
-
* @param {Schema} schema
|
|
95
|
-
* @returns {InputRuleWithHandler[]}
|
|
96
|
-
*/
|
|
97
|
-
function getCodeBlockRules(editorAnalyticsAPI, schema) {
|
|
98
|
-
var ruleAnalytics = (0, _utils2.inputRuleWithAnalytics)({
|
|
99
|
-
action: _analytics.ACTION.INSERTED,
|
|
100
|
-
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
101
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.CODE_BLOCK,
|
|
102
|
-
attributes: {
|
|
103
|
-
inputMethod: _analytics.INPUT_METHOD.FORMATTING
|
|
104
|
-
},
|
|
105
|
-
eventType: _analytics.EVENT_TYPE.TRACK
|
|
106
|
-
}, editorAnalyticsAPI);
|
|
107
|
-
var validMatchLength = function validMatchLength(match) {
|
|
108
|
-
return match.length > 0 && match[0].length === 3;
|
|
109
|
-
};
|
|
110
|
-
var threeTildeRule = (0, _prosemirrorInputRules.createRule)(/(?!\s)(`{3,})$/, function (state, match, start, end) {
|
|
111
|
-
if (!validMatchLength(match)) {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
var attributes = {};
|
|
115
|
-
if (match[4]) {
|
|
116
|
-
attributes.language = match[4];
|
|
117
|
-
}
|
|
118
|
-
if ((0, _transformToCodeBlock.isConvertableToCodeBlock)(state)) {
|
|
119
|
-
return (0, _transformToCodeBlock.transformToCodeBlockAction)(state, start, attributes);
|
|
120
|
-
}
|
|
121
|
-
var tr = state.tr;
|
|
122
|
-
tr.delete(start, end);
|
|
123
|
-
var codeBlock = tr.doc.type.schema.nodes.codeBlock.createChecked();
|
|
124
|
-
(0, _utils.safeInsert)(codeBlock)(tr);
|
|
125
|
-
return tr;
|
|
126
|
-
});
|
|
127
|
-
var leftNodeReplacementThreeTildeRule = (0, _prosemirrorInputRules.createRule)(new RegExp("((".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "`{3,})|^\\s(`{3,}))(\\S*)$")), function (state, match, start, end) {
|
|
128
|
-
if (!validMatchLength(match)) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
var attributes = {};
|
|
132
|
-
if (match[4]) {
|
|
133
|
-
attributes.language = match[4];
|
|
134
|
-
}
|
|
135
|
-
var inlineStart = Math.max(match.index + state.selection.$from.start(), 1);
|
|
136
|
-
return (0, _insertBlock.insertBlock)(state, schema.nodes.codeBlock, 'codeblock', inlineStart, end, attributes);
|
|
137
|
-
});
|
|
138
|
-
return [ruleAnalytics(threeTildeRule), ruleAnalytics(leftNodeReplacementThreeTildeRule)];
|
|
139
|
-
}
|
|
140
88
|
function inputRulePlugin(editorAnalyticsAPI, schema, featureFlags) {
|
|
141
89
|
var rules = [];
|
|
142
90
|
if (schema.nodes.heading) {
|
|
@@ -145,9 +93,6 @@ function inputRulePlugin(editorAnalyticsAPI, schema, featureFlags) {
|
|
|
145
93
|
if (schema.nodes.blockquote) {
|
|
146
94
|
rules.push.apply(rules, (0, _toConsumableArray2.default)(getBlockQuoteRules(editorAnalyticsAPI, schema)));
|
|
147
95
|
}
|
|
148
|
-
if (schema.nodes.codeBlock) {
|
|
149
|
-
rules.push.apply(rules, (0, _toConsumableArray2.default)(getCodeBlockRules(editorAnalyticsAPI, schema)));
|
|
150
|
-
}
|
|
151
96
|
if (rules.length !== 0) {
|
|
152
97
|
return (0, _prosemirrorInputRules.createPlugin)('block-type', rules, {
|
|
153
98
|
isBlockNodeRule: true
|
|
@@ -28,7 +28,7 @@ function keymapPlugin(editorAnalyticsApi, schema, _featureFlags) {
|
|
|
28
28
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteKey.common, del, list);
|
|
29
29
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.forwardDelete.mac, del, list);
|
|
30
30
|
if (schema.nodes[blockTypes.BLOCK_QUOTE.nodeName]) {
|
|
31
|
-
(0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findShortcutByKeymap)(_keymaps.toggleBlockQuote), (0, _commands2.
|
|
31
|
+
(0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findShortcutByKeymap)(_keymaps.toggleBlockQuote), (0, _commands2.insertBlockQuoteWithAnalytics)(_analytics.INPUT_METHOD.KEYBOARD, editorAnalyticsApi), list);
|
|
32
32
|
}
|
|
33
33
|
return (0, _keymaps.keymap)(list);
|
|
34
34
|
}
|