@contentful/field-editor-rich-text 2.0.0-next.32 → 2.0.0-next.33
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/dist/field-editor-rich-text.cjs.development.js +224 -231
- package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
- package/dist/field-editor-rich-text.esm.js +224 -231
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/plugins/Tracking/createTrackingPlugin.d.ts +1 -0
- package/package.json +1 -1
|
@@ -6127,6 +6127,229 @@ var onKeyDownTable = function onKeyDownTable(editor, plugin) {
|
|
|
6127
6127
|
};
|
|
6128
6128
|
};
|
|
6129
6129
|
|
|
6130
|
+
var _extends2, _extends4, _inlines;
|
|
6131
|
+
var inlines = /*#__PURE__*/Object.values(Contentful.INLINES).map(function (type) {
|
|
6132
|
+
return {
|
|
6133
|
+
type: type
|
|
6134
|
+
};
|
|
6135
|
+
});
|
|
6136
|
+
var schema = {
|
|
6137
|
+
document: {
|
|
6138
|
+
nodes: [{
|
|
6139
|
+
types: /*#__PURE__*/Contentful.TOP_LEVEL_BLOCKS.map(function (type) {
|
|
6140
|
+
return {
|
|
6141
|
+
type: type
|
|
6142
|
+
};
|
|
6143
|
+
})
|
|
6144
|
+
}]
|
|
6145
|
+
},
|
|
6146
|
+
blocks: /*#__PURE__*/_extends((_extends2 = {}, _extends2[Contentful.BLOCKS.PARAGRAPH] = {
|
|
6147
|
+
nodes: [{
|
|
6148
|
+
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6149
|
+
object: 'text'
|
|
6150
|
+
}])
|
|
6151
|
+
}]
|
|
6152
|
+
}, _extends2[Contentful.BLOCKS.HEADING_1] = {
|
|
6153
|
+
nodes: [{
|
|
6154
|
+
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6155
|
+
object: 'text'
|
|
6156
|
+
}])
|
|
6157
|
+
}]
|
|
6158
|
+
}, _extends2[Contentful.BLOCKS.HEADING_2] = {
|
|
6159
|
+
nodes: [{
|
|
6160
|
+
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6161
|
+
object: 'text'
|
|
6162
|
+
}])
|
|
6163
|
+
}]
|
|
6164
|
+
}, _extends2[Contentful.BLOCKS.HEADING_3] = {
|
|
6165
|
+
nodes: [{
|
|
6166
|
+
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6167
|
+
object: 'text'
|
|
6168
|
+
}])
|
|
6169
|
+
}]
|
|
6170
|
+
}, _extends2[Contentful.BLOCKS.HEADING_4] = {
|
|
6171
|
+
nodes: [{
|
|
6172
|
+
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6173
|
+
object: 'text'
|
|
6174
|
+
}])
|
|
6175
|
+
}]
|
|
6176
|
+
}, _extends2[Contentful.BLOCKS.HEADING_5] = {
|
|
6177
|
+
nodes: [{
|
|
6178
|
+
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6179
|
+
object: 'text'
|
|
6180
|
+
}])
|
|
6181
|
+
}]
|
|
6182
|
+
}, _extends2[Contentful.BLOCKS.HEADING_6] = {
|
|
6183
|
+
nodes: [{
|
|
6184
|
+
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6185
|
+
object: 'text'
|
|
6186
|
+
}])
|
|
6187
|
+
}]
|
|
6188
|
+
}, _extends2), /*#__PURE__*/Contentful.VOID_BLOCKS.reduce(function (blocks, nodeType) {
|
|
6189
|
+
var _extends3;
|
|
6190
|
+
|
|
6191
|
+
return _extends({}, blocks, (_extends3 = {}, _extends3[nodeType] = {
|
|
6192
|
+
isVoid: true
|
|
6193
|
+
}, _extends3));
|
|
6194
|
+
}, {}), (_extends4 = {}, _extends4[Contentful.BLOCKS.QUOTE] = {
|
|
6195
|
+
nodes: [{
|
|
6196
|
+
match: [/*#__PURE__*/Contentful.CONTAINERS[Contentful.BLOCKS.QUOTE].map(function (type) {
|
|
6197
|
+
return {
|
|
6198
|
+
type: type
|
|
6199
|
+
};
|
|
6200
|
+
})],
|
|
6201
|
+
min: 1
|
|
6202
|
+
}],
|
|
6203
|
+
normalize: function normalize(editor, error) {
|
|
6204
|
+
if (error.code === 'child_type_invalid') {
|
|
6205
|
+
return editor.unwrapBlockByKey(error.node.key, Contentful.BLOCKS.QUOTE);
|
|
6206
|
+
}
|
|
6207
|
+
}
|
|
6208
|
+
}, _extends4)),
|
|
6209
|
+
inlines: (_inlines = {}, _inlines[Contentful.INLINES.HYPERLINK] = {
|
|
6210
|
+
nodes: [{
|
|
6211
|
+
match: [{
|
|
6212
|
+
object: 'text'
|
|
6213
|
+
}]
|
|
6214
|
+
}]
|
|
6215
|
+
}, _inlines[Contentful.INLINES.ENTRY_HYPERLINK] = {
|
|
6216
|
+
nodes: [{
|
|
6217
|
+
match: [{
|
|
6218
|
+
object: 'text'
|
|
6219
|
+
}]
|
|
6220
|
+
}]
|
|
6221
|
+
}, _inlines[Contentful.INLINES.ASSET_HYPERLINK] = {
|
|
6222
|
+
nodes: [{
|
|
6223
|
+
match: [{
|
|
6224
|
+
object: 'text'
|
|
6225
|
+
}]
|
|
6226
|
+
}]
|
|
6227
|
+
}, _inlines[Contentful.INLINES.EMBEDDED_ENTRY] = {
|
|
6228
|
+
isVoid: true
|
|
6229
|
+
}, _inlines)
|
|
6230
|
+
};
|
|
6231
|
+
|
|
6232
|
+
function getCharacterCount(editor) {
|
|
6233
|
+
var document = contentfulSlateJSAdapter.toContentfulDocument({
|
|
6234
|
+
document: editor.children,
|
|
6235
|
+
schema: schema
|
|
6236
|
+
});
|
|
6237
|
+
return richTextPlainTextRenderer.documentToPlainTextString(document).length;
|
|
6238
|
+
}
|
|
6239
|
+
|
|
6240
|
+
var actionOrigin = {
|
|
6241
|
+
TOOLBAR: 'toolbar-icon',
|
|
6242
|
+
SHORTCUT: 'shortcut',
|
|
6243
|
+
VIEWPORT: 'viewport-interaction',
|
|
6244
|
+
COMMAND_PALETTE: 'command-palette'
|
|
6245
|
+
};
|
|
6246
|
+
function getPastingSource(data) {
|
|
6247
|
+
var textHtml = data.getData('text/html');
|
|
6248
|
+
var doc = new DOMParser().parseFromString(textHtml, 'text/html');
|
|
6249
|
+
|
|
6250
|
+
if (doc.querySelector('[id*="docs-internal-guid"]')) {
|
|
6251
|
+
return 'Google Docs';
|
|
6252
|
+
}
|
|
6253
|
+
|
|
6254
|
+
if (doc.querySelector('google-sheets-html-origin') || doc.querySelector('[data-sheets-value]')) {
|
|
6255
|
+
return 'Google Spreadsheets';
|
|
6256
|
+
}
|
|
6257
|
+
|
|
6258
|
+
if (doc.querySelector('meta[content*="Microsoft Excel"]')) {
|
|
6259
|
+
return 'Microsoft Excel';
|
|
6260
|
+
}
|
|
6261
|
+
|
|
6262
|
+
if (doc.querySelector('meta[content*="Microsoft Word"]')) {
|
|
6263
|
+
return 'Microsoft Word';
|
|
6264
|
+
} // TODO: MS Word Online doesn't give us specific tags, we might need to have a closer look at its tracking result since we are using generic values to identify it
|
|
6265
|
+
|
|
6266
|
+
|
|
6267
|
+
if (doc.querySelector('[style*="Arial_MSFontService"]') && (doc.querySelector('.TextRun') || doc.querySelector('.OutlineElement'))) {
|
|
6268
|
+
return 'Microsoft Word Online';
|
|
6269
|
+
}
|
|
6270
|
+
|
|
6271
|
+
if (doc.querySelector('meta[content="Cocoa HTML Writer"]')) {
|
|
6272
|
+
return 'Apple Notes';
|
|
6273
|
+
}
|
|
6274
|
+
|
|
6275
|
+
if (doc.querySelector('[style*="Slack-Lato, Slack-Fractions"]')) {
|
|
6276
|
+
return 'Slack';
|
|
6277
|
+
}
|
|
6278
|
+
|
|
6279
|
+
return 'Unknown';
|
|
6280
|
+
}
|
|
6281
|
+
var createTrackingPlugin = function createTrackingPlugin(onAction) {
|
|
6282
|
+
var trackingActions = {
|
|
6283
|
+
onViewportAction: function onViewportAction(actionName, data) {
|
|
6284
|
+
if (data === void 0) {
|
|
6285
|
+
data = {};
|
|
6286
|
+
}
|
|
6287
|
+
|
|
6288
|
+
return onAction(actionName, _extends({
|
|
6289
|
+
origin: actionOrigin.VIEWPORT
|
|
6290
|
+
}, data));
|
|
6291
|
+
},
|
|
6292
|
+
onShortcutAction: function onShortcutAction(actionName, data) {
|
|
6293
|
+
if (data === void 0) {
|
|
6294
|
+
data = {};
|
|
6295
|
+
}
|
|
6296
|
+
|
|
6297
|
+
return onAction(actionName, _extends({
|
|
6298
|
+
origin: actionOrigin.SHORTCUT
|
|
6299
|
+
}, data));
|
|
6300
|
+
},
|
|
6301
|
+
onToolbarAction: function onToolbarAction(actionName, data) {
|
|
6302
|
+
if (data === void 0) {
|
|
6303
|
+
data = {};
|
|
6304
|
+
}
|
|
6305
|
+
|
|
6306
|
+
return onAction(actionName, _extends({
|
|
6307
|
+
origin: actionOrigin.TOOLBAR
|
|
6308
|
+
}, data));
|
|
6309
|
+
},
|
|
6310
|
+
onCommandPaletteAction: function onCommandPaletteAction(actionName, data) {
|
|
6311
|
+
if (data === void 0) {
|
|
6312
|
+
data = {};
|
|
6313
|
+
}
|
|
6314
|
+
|
|
6315
|
+
return onAction(actionName, _extends({
|
|
6316
|
+
origin: actionOrigin.COMMAND_PALETTE
|
|
6317
|
+
}, data));
|
|
6318
|
+
}
|
|
6319
|
+
};
|
|
6320
|
+
return {
|
|
6321
|
+
key: 'TrackingPlugin',
|
|
6322
|
+
withOverrides: function withOverrides(editor) {
|
|
6323
|
+
var insertData = editor.insertData;
|
|
6324
|
+
editor.tracking = trackingActions;
|
|
6325
|
+
|
|
6326
|
+
editor.insertData = function (data) {
|
|
6327
|
+
var isCopyAndPaste = data.types.length !== 0;
|
|
6328
|
+
|
|
6329
|
+
if (isCopyAndPaste) {
|
|
6330
|
+
var _window$getSelection;
|
|
6331
|
+
|
|
6332
|
+
var characterCountSelection = (_window$getSelection = window.getSelection()) == null ? void 0 : _window$getSelection.toString().length;
|
|
6333
|
+
var characterCountBefore = getCharacterCount(editor);
|
|
6334
|
+
setTimeout(function () {
|
|
6335
|
+
var characterCountAfter = getCharacterCount(editor);
|
|
6336
|
+
trackingActions.onShortcutAction('paste', {
|
|
6337
|
+
characterCountAfter: characterCountAfter,
|
|
6338
|
+
characterCountBefore: characterCountBefore,
|
|
6339
|
+
characterCountSelection: characterCountSelection,
|
|
6340
|
+
source: getPastingSource(data)
|
|
6341
|
+
});
|
|
6342
|
+
});
|
|
6343
|
+
}
|
|
6344
|
+
|
|
6345
|
+
insertData(data);
|
|
6346
|
+
};
|
|
6347
|
+
|
|
6348
|
+
return editor;
|
|
6349
|
+
}
|
|
6350
|
+
};
|
|
6351
|
+
};
|
|
6352
|
+
|
|
6130
6353
|
function hasTables(nodes) {
|
|
6131
6354
|
return nodes.some(function (_ref) {
|
|
6132
6355
|
var type = _ref.type;
|
|
@@ -6168,6 +6391,7 @@ function addTableTrackingEvents(editor) {
|
|
|
6168
6391
|
if (hasTables(markupAfter)) {
|
|
6169
6392
|
editor.tracking.onViewportAction('paste', {
|
|
6170
6393
|
tablePasted: true,
|
|
6394
|
+
source: getPastingSource(data),
|
|
6171
6395
|
hasHeadersOutsideFirstRow: hasHeadersOutsideFirstRow(markupAfter)
|
|
6172
6396
|
});
|
|
6173
6397
|
}
|
|
@@ -6421,237 +6645,6 @@ function deleteFirstEmptyParagraph(unit, editor, deleteFunction) {
|
|
|
6421
6645
|
}
|
|
6422
6646
|
}
|
|
6423
6647
|
|
|
6424
|
-
var _extends2, _extends4, _inlines;
|
|
6425
|
-
var inlines = /*#__PURE__*/Object.values(Contentful.INLINES).map(function (type) {
|
|
6426
|
-
return {
|
|
6427
|
-
type: type
|
|
6428
|
-
};
|
|
6429
|
-
});
|
|
6430
|
-
var schema = {
|
|
6431
|
-
document: {
|
|
6432
|
-
nodes: [{
|
|
6433
|
-
types: /*#__PURE__*/Contentful.TOP_LEVEL_BLOCKS.map(function (type) {
|
|
6434
|
-
return {
|
|
6435
|
-
type: type
|
|
6436
|
-
};
|
|
6437
|
-
})
|
|
6438
|
-
}]
|
|
6439
|
-
},
|
|
6440
|
-
blocks: /*#__PURE__*/_extends((_extends2 = {}, _extends2[Contentful.BLOCKS.PARAGRAPH] = {
|
|
6441
|
-
nodes: [{
|
|
6442
|
-
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6443
|
-
object: 'text'
|
|
6444
|
-
}])
|
|
6445
|
-
}]
|
|
6446
|
-
}, _extends2[Contentful.BLOCKS.HEADING_1] = {
|
|
6447
|
-
nodes: [{
|
|
6448
|
-
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6449
|
-
object: 'text'
|
|
6450
|
-
}])
|
|
6451
|
-
}]
|
|
6452
|
-
}, _extends2[Contentful.BLOCKS.HEADING_2] = {
|
|
6453
|
-
nodes: [{
|
|
6454
|
-
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6455
|
-
object: 'text'
|
|
6456
|
-
}])
|
|
6457
|
-
}]
|
|
6458
|
-
}, _extends2[Contentful.BLOCKS.HEADING_3] = {
|
|
6459
|
-
nodes: [{
|
|
6460
|
-
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6461
|
-
object: 'text'
|
|
6462
|
-
}])
|
|
6463
|
-
}]
|
|
6464
|
-
}, _extends2[Contentful.BLOCKS.HEADING_4] = {
|
|
6465
|
-
nodes: [{
|
|
6466
|
-
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6467
|
-
object: 'text'
|
|
6468
|
-
}])
|
|
6469
|
-
}]
|
|
6470
|
-
}, _extends2[Contentful.BLOCKS.HEADING_5] = {
|
|
6471
|
-
nodes: [{
|
|
6472
|
-
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6473
|
-
object: 'text'
|
|
6474
|
-
}])
|
|
6475
|
-
}]
|
|
6476
|
-
}, _extends2[Contentful.BLOCKS.HEADING_6] = {
|
|
6477
|
-
nodes: [{
|
|
6478
|
-
match: /*#__PURE__*/[].concat(inlines, [{
|
|
6479
|
-
object: 'text'
|
|
6480
|
-
}])
|
|
6481
|
-
}]
|
|
6482
|
-
}, _extends2), /*#__PURE__*/Contentful.VOID_BLOCKS.reduce(function (blocks, nodeType) {
|
|
6483
|
-
var _extends3;
|
|
6484
|
-
|
|
6485
|
-
return _extends({}, blocks, (_extends3 = {}, _extends3[nodeType] = {
|
|
6486
|
-
isVoid: true
|
|
6487
|
-
}, _extends3));
|
|
6488
|
-
}, {}), (_extends4 = {}, _extends4[Contentful.BLOCKS.QUOTE] = {
|
|
6489
|
-
nodes: [{
|
|
6490
|
-
match: [/*#__PURE__*/Contentful.CONTAINERS[Contentful.BLOCKS.QUOTE].map(function (type) {
|
|
6491
|
-
return {
|
|
6492
|
-
type: type
|
|
6493
|
-
};
|
|
6494
|
-
})],
|
|
6495
|
-
min: 1
|
|
6496
|
-
}],
|
|
6497
|
-
normalize: function normalize(editor, error) {
|
|
6498
|
-
if (error.code === 'child_type_invalid') {
|
|
6499
|
-
return editor.unwrapBlockByKey(error.node.key, Contentful.BLOCKS.QUOTE);
|
|
6500
|
-
}
|
|
6501
|
-
}
|
|
6502
|
-
}, _extends4)),
|
|
6503
|
-
inlines: (_inlines = {}, _inlines[Contentful.INLINES.HYPERLINK] = {
|
|
6504
|
-
nodes: [{
|
|
6505
|
-
match: [{
|
|
6506
|
-
object: 'text'
|
|
6507
|
-
}]
|
|
6508
|
-
}]
|
|
6509
|
-
}, _inlines[Contentful.INLINES.ENTRY_HYPERLINK] = {
|
|
6510
|
-
nodes: [{
|
|
6511
|
-
match: [{
|
|
6512
|
-
object: 'text'
|
|
6513
|
-
}]
|
|
6514
|
-
}]
|
|
6515
|
-
}, _inlines[Contentful.INLINES.ASSET_HYPERLINK] = {
|
|
6516
|
-
nodes: [{
|
|
6517
|
-
match: [{
|
|
6518
|
-
object: 'text'
|
|
6519
|
-
}]
|
|
6520
|
-
}]
|
|
6521
|
-
}, _inlines[Contentful.INLINES.EMBEDDED_ENTRY] = {
|
|
6522
|
-
isVoid: true
|
|
6523
|
-
}, _inlines)
|
|
6524
|
-
};
|
|
6525
|
-
|
|
6526
|
-
function getCharacterCount(editor) {
|
|
6527
|
-
var document = contentfulSlateJSAdapter.toContentfulDocument({
|
|
6528
|
-
document: editor.children,
|
|
6529
|
-
schema: schema
|
|
6530
|
-
});
|
|
6531
|
-
return richTextPlainTextRenderer.documentToPlainTextString(document).length;
|
|
6532
|
-
}
|
|
6533
|
-
|
|
6534
|
-
var actionOrigin = {
|
|
6535
|
-
TOOLBAR: 'toolbar-icon',
|
|
6536
|
-
SHORTCUT: 'shortcut',
|
|
6537
|
-
VIEWPORT: 'viewport-interaction',
|
|
6538
|
-
COMMAND_PALETTE: 'command-palette'
|
|
6539
|
-
};
|
|
6540
|
-
|
|
6541
|
-
function getPastingSource(data) {
|
|
6542
|
-
var textHtml = data.getData('text/html');
|
|
6543
|
-
var doc = new DOMParser().parseFromString(textHtml, 'text/html');
|
|
6544
|
-
|
|
6545
|
-
if (doc.querySelector('[id*="docs-internal-guid"]')) {
|
|
6546
|
-
return 'Google Docs';
|
|
6547
|
-
}
|
|
6548
|
-
|
|
6549
|
-
if (doc.querySelector('google-sheets-html-origin') || doc.querySelector('[data-sheets-value]')) {
|
|
6550
|
-
return 'Google Spreadsheets';
|
|
6551
|
-
}
|
|
6552
|
-
|
|
6553
|
-
if (doc.querySelector('meta[content*="Microsoft Excel"]')) {
|
|
6554
|
-
return 'Microsoft Excel';
|
|
6555
|
-
}
|
|
6556
|
-
|
|
6557
|
-
if (doc.querySelector('meta[content*="Microsoft Word"]')) {
|
|
6558
|
-
return 'Microsoft Word';
|
|
6559
|
-
} // TODO: MS Word Online doesn't give us specific tags, we might need to have a closer look at its tracking result since we are using generic values to identify it
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
if (doc.querySelector('[style*="Arial_MSFontService"]') && (doc.querySelector('.TextRun') || doc.querySelector('.OutlineElement'))) {
|
|
6563
|
-
return 'Microsoft Word Online';
|
|
6564
|
-
}
|
|
6565
|
-
|
|
6566
|
-
if (doc.querySelector('meta[content="Cocoa HTML Writer"]')) {
|
|
6567
|
-
return 'Apple Notes';
|
|
6568
|
-
}
|
|
6569
|
-
|
|
6570
|
-
if (doc.querySelector('[style*="Slack-Lato, Slack-Fractions"]')) {
|
|
6571
|
-
return 'Slack';
|
|
6572
|
-
}
|
|
6573
|
-
|
|
6574
|
-
return '';
|
|
6575
|
-
}
|
|
6576
|
-
|
|
6577
|
-
var createTrackingPlugin = function createTrackingPlugin(onAction) {
|
|
6578
|
-
var trackingActions = {
|
|
6579
|
-
onViewportAction: function onViewportAction(actionName, data) {
|
|
6580
|
-
if (data === void 0) {
|
|
6581
|
-
data = {};
|
|
6582
|
-
}
|
|
6583
|
-
|
|
6584
|
-
return onAction(actionName, _extends({
|
|
6585
|
-
origin: actionOrigin.VIEWPORT
|
|
6586
|
-
}, data));
|
|
6587
|
-
},
|
|
6588
|
-
onShortcutAction: function onShortcutAction(actionName, data) {
|
|
6589
|
-
if (data === void 0) {
|
|
6590
|
-
data = {};
|
|
6591
|
-
}
|
|
6592
|
-
|
|
6593
|
-
return onAction(actionName, _extends({
|
|
6594
|
-
origin: actionOrigin.SHORTCUT
|
|
6595
|
-
}, data));
|
|
6596
|
-
},
|
|
6597
|
-
onToolbarAction: function onToolbarAction(actionName, data) {
|
|
6598
|
-
if (data === void 0) {
|
|
6599
|
-
data = {};
|
|
6600
|
-
}
|
|
6601
|
-
|
|
6602
|
-
return onAction(actionName, _extends({
|
|
6603
|
-
origin: actionOrigin.TOOLBAR
|
|
6604
|
-
}, data));
|
|
6605
|
-
},
|
|
6606
|
-
onCommandPaletteAction: function onCommandPaletteAction(actionName, data) {
|
|
6607
|
-
if (data === void 0) {
|
|
6608
|
-
data = {};
|
|
6609
|
-
}
|
|
6610
|
-
|
|
6611
|
-
return onAction(actionName, _extends({
|
|
6612
|
-
origin: actionOrigin.COMMAND_PALETTE
|
|
6613
|
-
}, data));
|
|
6614
|
-
}
|
|
6615
|
-
};
|
|
6616
|
-
return {
|
|
6617
|
-
key: 'TrackingPlugin',
|
|
6618
|
-
withOverrides: function withOverrides(editor) {
|
|
6619
|
-
var insertData = editor.insertData;
|
|
6620
|
-
editor.tracking = trackingActions;
|
|
6621
|
-
|
|
6622
|
-
editor.insertData = function (data) {
|
|
6623
|
-
var isCopyAndPaste = data.types.length !== 0;
|
|
6624
|
-
|
|
6625
|
-
if (isCopyAndPaste) {
|
|
6626
|
-
var _window$getSelection;
|
|
6627
|
-
|
|
6628
|
-
var characterCountSelection = (_window$getSelection = window.getSelection()) == null ? void 0 : _window$getSelection.toString().length;
|
|
6629
|
-
var characterCountBefore = getCharacterCount(editor);
|
|
6630
|
-
setTimeout(function () {
|
|
6631
|
-
var characterCountAfter = getCharacterCount(editor);
|
|
6632
|
-
var payload = {
|
|
6633
|
-
characterCountAfter: characterCountAfter,
|
|
6634
|
-
characterCountBefore: characterCountBefore,
|
|
6635
|
-
characterCountSelection: characterCountSelection
|
|
6636
|
-
};
|
|
6637
|
-
var source = getPastingSource(data);
|
|
6638
|
-
|
|
6639
|
-
if (source) {
|
|
6640
|
-
payload.source = source;
|
|
6641
|
-
}
|
|
6642
|
-
|
|
6643
|
-
trackingActions.onShortcutAction('paste', payload);
|
|
6644
|
-
});
|
|
6645
|
-
}
|
|
6646
|
-
|
|
6647
|
-
insertData(data);
|
|
6648
|
-
};
|
|
6649
|
-
|
|
6650
|
-
return editor;
|
|
6651
|
-
}
|
|
6652
|
-
};
|
|
6653
|
-
};
|
|
6654
|
-
|
|
6655
6648
|
var createTrailingParagraphPlugin = function createTrailingParagraphPlugin() {
|
|
6656
6649
|
return plateTrailingBlock.createTrailingBlockPlugin({
|
|
6657
6650
|
options: {
|