roosterjs 9.49.0 → 9.50.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/dist/rooster-amd-min.js +1 -1
- package/dist/rooster-amd-min.js.map +1 -1
- package/dist/rooster-amd.d.ts +63 -3
- package/dist/rooster-amd.js +250 -22
- package/dist/rooster-amd.js.map +1 -1
- package/dist/rooster-min.js +1 -1
- package/dist/rooster-min.js.map +1 -1
- package/dist/rooster-react-amd.js +55 -55
- package/dist/rooster-react-amd.js.map +1 -1
- package/dist/rooster.d.ts +63 -3
- package/dist/rooster.js +250 -22
- package/dist/rooster.js.map +1 -1
- package/package.json +7 -7
package/dist/rooster-amd.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for roosterjs (Version 9.
|
|
1
|
+
// Type definitions for roosterjs (Version 9.50.0)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -6261,6 +6261,12 @@ export interface BeforeCutCopyEvent extends BasePluginDomEvent<'beforeCutCopy',
|
|
|
6261
6261
|
export interface BeforeDisposeEvent extends BasePluginEvent<'beforeDispose'> {
|
|
6262
6262
|
}
|
|
6263
6263
|
|
|
6264
|
+
/**
|
|
6265
|
+
* Data of BeforeDropEvent
|
|
6266
|
+
*/
|
|
6267
|
+
export interface BeforeDropEvent extends BasePluginDomEvent<'beforeDrop', DragEvent> {
|
|
6268
|
+
}
|
|
6269
|
+
|
|
6264
6270
|
/**
|
|
6265
6271
|
* Provides a chance for plugin to change the content before it is copied from editor.
|
|
6266
6272
|
*/
|
|
@@ -6615,7 +6621,7 @@ export interface DoubleClickEvent extends BasePluginDomEvent<'doubleClick', Mous
|
|
|
6615
6621
|
/**
|
|
6616
6622
|
* Editor plugin event interface
|
|
6617
6623
|
*/
|
|
6618
|
-
export type PluginEvent = BeforeAddUndoSnapshotEvent | BeforeCutCopyEvent | BeforeDisposeEvent | BeforeKeyboardEditingEvent | BeforeLogicalRootChangeEvent | BeforePasteEvent | BeforeSetContentEvent | CompositionEndEvent | ContentChangedEvent | ContextMenuEvent | RewriteFromModelEvent | EditImageEvent | EditorReadyEvent | EnterShadowEditEvent | EntityOperationEvent | ExtractContentWithDomEvent | EditorInputEvent | KeyDownEvent | KeyPressEvent | KeyUpEvent | LeaveShadowEditEvent | LogicalRootChangedEvent | MouseDownEvent | MouseUpEvent | ScrollEvent | SelectionChangedEvent | ZoomChangedEvent | PointerDownEvent | PointerUpEvent | DoubleClickEvent | FindResultChangedEvent;
|
|
6624
|
+
export type PluginEvent = BeforeAddUndoSnapshotEvent | BeforeCutCopyEvent | BeforeDisposeEvent | BeforeDropEvent | BeforeKeyboardEditingEvent | BeforeLogicalRootChangeEvent | BeforePasteEvent | BeforeSetContentEvent | CompositionEndEvent | ContentChangedEvent | ContextMenuEvent | RewriteFromModelEvent | EditImageEvent | EditorReadyEvent | EnterShadowEditEvent | EntityOperationEvent | ExtractContentWithDomEvent | EditorInputEvent | KeyDownEvent | KeyPressEvent | KeyUpEvent | LeaveShadowEditEvent | LogicalRootChangedEvent | MouseDownEvent | MouseUpEvent | ScrollEvent | SelectionChangedEvent | ZoomChangedEvent | PointerDownEvent | PointerUpEvent | DoubleClickEvent | FindResultChangedEvent;
|
|
6619
6625
|
|
|
6620
6626
|
/**
|
|
6621
6627
|
* A type to extract data part of a plugin event type. Data part is the plugin event without eventType field.
|
|
@@ -6776,7 +6782,11 @@ export type PluginEventType = /**
|
|
|
6776
6782
|
/**
|
|
6777
6783
|
* Find result changed event
|
|
6778
6784
|
*/
|
|
6779
|
-
| 'findResultChanged'
|
|
6785
|
+
| 'findResultChanged'
|
|
6786
|
+
/**
|
|
6787
|
+
* Let plugin know when a content will be dropped
|
|
6788
|
+
*/
|
|
6789
|
+
| 'beforeDrop';
|
|
6780
6790
|
|
|
6781
6791
|
/**
|
|
6782
6792
|
* This interface represents a PluginEvent wrapping native scroll event
|
|
@@ -10803,6 +10813,56 @@ export class AnnouncePlugin implements EditorPlugin {
|
|
|
10803
10813
|
onPluginEvent(event: PluginEvent): void;
|
|
10804
10814
|
}
|
|
10805
10815
|
|
|
10816
|
+
/**
|
|
10817
|
+
* DragAndDrop plugin, handles ContentChanged event when change source is "Drop"
|
|
10818
|
+
* to sanitize dropped content, similar to how PastePlugin sanitizes pasted content.
|
|
10819
|
+
*/
|
|
10820
|
+
export class DragAndDropPlugin implements EditorPlugin {
|
|
10821
|
+
private editor;
|
|
10822
|
+
private forbiddenElements;
|
|
10823
|
+
private isInternalDragging;
|
|
10824
|
+
private disposer;
|
|
10825
|
+
/**
|
|
10826
|
+
* Construct a new instance of DragAndDropPlugin
|
|
10827
|
+
*/
|
|
10828
|
+
constructor(options?: DragAndDropOptions);
|
|
10829
|
+
/**
|
|
10830
|
+
* Get name of this plugin
|
|
10831
|
+
*/
|
|
10832
|
+
getName(): string;
|
|
10833
|
+
/**
|
|
10834
|
+
* The first method that editor will call to a plugin when editor is initializing.
|
|
10835
|
+
* It will pass in the editor instance, plugin should take this chance to save the
|
|
10836
|
+
* editor reference so that it can call to any editor method or format API later.
|
|
10837
|
+
* @param editor The editor object
|
|
10838
|
+
*/
|
|
10839
|
+
initialize(editor: IEditor): void;
|
|
10840
|
+
/**
|
|
10841
|
+
* The last method that editor will call to a plugin before it is disposed.
|
|
10842
|
+
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
10843
|
+
* called, plugin should not call to any editor method since it will result in error.
|
|
10844
|
+
*/
|
|
10845
|
+
dispose(): void;
|
|
10846
|
+
/**
|
|
10847
|
+
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
10848
|
+
* method of each plugin to handle the event as long as the event is not handled
|
|
10849
|
+
* exclusively by another plugin.
|
|
10850
|
+
* @param event The event to handle:
|
|
10851
|
+
*/
|
|
10852
|
+
onPluginEvent(event: PluginEvent): void;
|
|
10853
|
+
}
|
|
10854
|
+
|
|
10855
|
+
/**
|
|
10856
|
+
* Options for DragAndDrop plugin
|
|
10857
|
+
*/
|
|
10858
|
+
export interface DragAndDropOptions {
|
|
10859
|
+
/**
|
|
10860
|
+
* Forbidden elements that cannot be dropped in the editor
|
|
10861
|
+
* @default ['iframe']
|
|
10862
|
+
*/
|
|
10863
|
+
forbiddenElements?: string[];
|
|
10864
|
+
}
|
|
10865
|
+
|
|
10806
10866
|
/**
|
|
10807
10867
|
* Get dark mode color for a given color
|
|
10808
10868
|
* @param color The color to calculate from
|
package/dist/rooster-amd.js
CHANGED
|
@@ -12997,17 +12997,24 @@ var DOMEventPlugin = /** @class */ (function () {
|
|
|
12997
12997
|
dragEvent.preventDefault();
|
|
12998
12998
|
}
|
|
12999
12999
|
};
|
|
13000
|
-
this.onDrop = function () {
|
|
13001
|
-
var _a
|
|
13002
|
-
|
|
13003
|
-
|
|
13004
|
-
|
|
13005
|
-
|
|
13006
|
-
|
|
13007
|
-
|
|
13000
|
+
this.onDrop = function (e) {
|
|
13001
|
+
var _a;
|
|
13002
|
+
if (_this.editor) {
|
|
13003
|
+
var beforeDropEvent = _this.editor.triggerEvent('beforeDrop', {
|
|
13004
|
+
rawEvent: e,
|
|
13005
|
+
});
|
|
13006
|
+
if (!(beforeDropEvent === null || beforeDropEvent === void 0 ? void 0 : beforeDropEvent.rawEvent.defaultPrevented)) {
|
|
13007
|
+
var doc = _this.editor.getDocument();
|
|
13008
|
+
(_a = doc === null || doc === void 0 ? void 0 : doc.defaultView) === null || _a === void 0 ? void 0 : _a.requestAnimationFrame(function () {
|
|
13009
|
+
if (_this.editor) {
|
|
13010
|
+
_this.editor.takeSnapshot();
|
|
13011
|
+
_this.editor.triggerEvent('contentChanged', {
|
|
13012
|
+
source: roosterjs_content_model_dom_1.ChangeSource.Drop,
|
|
13013
|
+
});
|
|
13014
|
+
}
|
|
13008
13015
|
});
|
|
13009
13016
|
}
|
|
13010
|
-
}
|
|
13017
|
+
}
|
|
13011
13018
|
};
|
|
13012
13019
|
this.onScroll = function (e) {
|
|
13013
13020
|
var _a;
|
|
@@ -13143,7 +13150,7 @@ var DOMEventPlugin = /** @class */ (function () {
|
|
|
13143
13150
|
compositionend: { beforeDispatch: this.onCompositionEnd },
|
|
13144
13151
|
// 4. Drag and Drop event
|
|
13145
13152
|
dragstart: { beforeDispatch: this.onDragStart },
|
|
13146
|
-
drop: { beforeDispatch:
|
|
13153
|
+
drop: { beforeDispatch: function (event) { return _this.onDrop(event); } },
|
|
13147
13154
|
// 5. Pointer event
|
|
13148
13155
|
pointerdown: { beforeDispatch: function (event) { return _this.onPointerDown(event); } },
|
|
13149
13156
|
};
|
|
@@ -31532,16 +31539,43 @@ exports.isMarkdownTable = isMarkdownTable;
|
|
|
31532
31539
|
|
|
31533
31540
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
31534
31541
|
exports.splitParagraphSegments = void 0;
|
|
31535
|
-
|
|
31542
|
+
// Matches markdown links and images in a string.
|
|
31543
|
+
// Group 1 (full link): [text](url) e.g. [Click here](https://example.com)
|
|
31544
|
+
// Group 2: link text e.g. "Click here"
|
|
31545
|
+
// Group 3: link url e.g. "https://example.com"
|
|
31546
|
+
// Group 4 (full image):  e.g. 
|
|
31547
|
+
// Group 5: alt text e.g. "Logo"
|
|
31548
|
+
// Group 6: image url e.g. "https://example.com/logo.png"
|
|
31549
|
+
var linkRegex = /(\[([^\[]+)\]\(([^\)]+)\))|(\!\[([^\[]+)\]\(([^\)]+)\))/g;
|
|
31536
31550
|
var isValidUrl = function (url) {
|
|
31537
|
-
|
|
31538
|
-
|
|
31551
|
+
if (!url) {
|
|
31552
|
+
return false;
|
|
31553
|
+
}
|
|
31554
|
+
// Accept common non-http schemes and relative paths
|
|
31555
|
+
if (url.startsWith('data:') ||
|
|
31556
|
+
url.startsWith('blob:') ||
|
|
31557
|
+
url.startsWith('/') ||
|
|
31558
|
+
url.startsWith('./') ||
|
|
31559
|
+
url.startsWith('../')) {
|
|
31539
31560
|
return true;
|
|
31540
31561
|
}
|
|
31562
|
+
try {
|
|
31563
|
+
var parsed = new URL(url);
|
|
31564
|
+
return parsed.protocol === 'http:' || parsed.protocol === 'https:';
|
|
31565
|
+
}
|
|
31541
31566
|
catch (_) {
|
|
31542
31567
|
return false;
|
|
31543
31568
|
}
|
|
31544
31569
|
};
|
|
31570
|
+
function pushText(result, text) {
|
|
31571
|
+
var last = result[result.length - 1];
|
|
31572
|
+
if (last && last.type === 'text') {
|
|
31573
|
+
last.text += text;
|
|
31574
|
+
}
|
|
31575
|
+
else {
|
|
31576
|
+
result.push({ type: 'text', text: text, url: '' });
|
|
31577
|
+
}
|
|
31578
|
+
}
|
|
31545
31579
|
/**
|
|
31546
31580
|
* @internal
|
|
31547
31581
|
*/
|
|
@@ -31551,22 +31585,28 @@ function splitParagraphSegments(text) {
|
|
|
31551
31585
|
var match = null;
|
|
31552
31586
|
while ((match = linkRegex.exec(text)) !== null) {
|
|
31553
31587
|
if (match.index > lastIndex) {
|
|
31554
|
-
result
|
|
31588
|
+
pushText(result, text.slice(lastIndex, match.index));
|
|
31555
31589
|
}
|
|
31556
31590
|
if (match[2] && match[3]) {
|
|
31557
|
-
|
|
31558
|
-
|
|
31559
|
-
|
|
31591
|
+
if (isValidUrl(match[3])) {
|
|
31592
|
+
result.push({ type: 'link', text: match[2], url: match[3] });
|
|
31593
|
+
}
|
|
31594
|
+
else {
|
|
31595
|
+
pushText(result, match[0]);
|
|
31596
|
+
}
|
|
31560
31597
|
}
|
|
31561
31598
|
else if (match[5] && match[6]) {
|
|
31562
|
-
|
|
31563
|
-
|
|
31564
|
-
|
|
31599
|
+
if (isValidUrl(match[6])) {
|
|
31600
|
+
result.push({ type: 'image', text: match[5], url: match[6] });
|
|
31601
|
+
}
|
|
31602
|
+
else {
|
|
31603
|
+
pushText(result, match[0]);
|
|
31604
|
+
}
|
|
31565
31605
|
}
|
|
31566
31606
|
lastIndex = linkRegex.lastIndex;
|
|
31567
31607
|
}
|
|
31568
31608
|
if (lastIndex < text.length) {
|
|
31569
|
-
result
|
|
31609
|
+
pushText(result, text.slice(lastIndex));
|
|
31570
31610
|
}
|
|
31571
31611
|
return result;
|
|
31572
31612
|
}
|
|
@@ -33391,6 +33431,192 @@ var CustomReplacePlugin = /** @class */ (function () {
|
|
|
33391
33431
|
exports.CustomReplacePlugin = CustomReplacePlugin;
|
|
33392
33432
|
|
|
33393
33433
|
|
|
33434
|
+
/***/ },
|
|
33435
|
+
|
|
33436
|
+
/***/ "./packages/roosterjs-content-model-plugins/lib/dragAndDrop/DragAndDropPlugin.ts"
|
|
33437
|
+
/*!***************************************************************************************!*\
|
|
33438
|
+
!*** ./packages/roosterjs-content-model-plugins/lib/dragAndDrop/DragAndDropPlugin.ts ***!
|
|
33439
|
+
\***************************************************************************************/
|
|
33440
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
33441
|
+
|
|
33442
|
+
"use strict";
|
|
33443
|
+
|
|
33444
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
33445
|
+
exports.DragAndDropPlugin = void 0;
|
|
33446
|
+
var handleDroppedContent_1 = __webpack_require__(/*! ./utils/handleDroppedContent */ "./packages/roosterjs-content-model-plugins/lib/dragAndDrop/utils/handleDroppedContent.ts");
|
|
33447
|
+
var DefaultOptions = {
|
|
33448
|
+
forbiddenElements: ['iframe'],
|
|
33449
|
+
};
|
|
33450
|
+
/**
|
|
33451
|
+
* DragAndDrop plugin, handles ContentChanged event when change source is "Drop"
|
|
33452
|
+
* to sanitize dropped content, similar to how PastePlugin sanitizes pasted content.
|
|
33453
|
+
*/
|
|
33454
|
+
var DragAndDropPlugin = /** @class */ (function () {
|
|
33455
|
+
/**
|
|
33456
|
+
* Construct a new instance of DragAndDropPlugin
|
|
33457
|
+
*/
|
|
33458
|
+
function DragAndDropPlugin(options) {
|
|
33459
|
+
if (options === void 0) { options = DefaultOptions; }
|
|
33460
|
+
var _a;
|
|
33461
|
+
this.editor = null;
|
|
33462
|
+
this.forbiddenElements = [];
|
|
33463
|
+
this.isInternalDragging = false;
|
|
33464
|
+
this.disposer = null;
|
|
33465
|
+
this.forbiddenElements = (_a = options.forbiddenElements) !== null && _a !== void 0 ? _a : [];
|
|
33466
|
+
}
|
|
33467
|
+
/**
|
|
33468
|
+
* Get name of this plugin
|
|
33469
|
+
*/
|
|
33470
|
+
DragAndDropPlugin.prototype.getName = function () {
|
|
33471
|
+
return 'DragAndDrop';
|
|
33472
|
+
};
|
|
33473
|
+
/**
|
|
33474
|
+
* The first method that editor will call to a plugin when editor is initializing.
|
|
33475
|
+
* It will pass in the editor instance, plugin should take this chance to save the
|
|
33476
|
+
* editor reference so that it can call to any editor method or format API later.
|
|
33477
|
+
* @param editor The editor object
|
|
33478
|
+
*/
|
|
33479
|
+
DragAndDropPlugin.prototype.initialize = function (editor) {
|
|
33480
|
+
var _this = this;
|
|
33481
|
+
this.editor = editor;
|
|
33482
|
+
this.disposer = editor.attachDomEvent({
|
|
33483
|
+
dragstart: {
|
|
33484
|
+
beforeDispatch: function (_ev) {
|
|
33485
|
+
_this.isInternalDragging = true;
|
|
33486
|
+
},
|
|
33487
|
+
},
|
|
33488
|
+
});
|
|
33489
|
+
};
|
|
33490
|
+
/**
|
|
33491
|
+
* The last method that editor will call to a plugin before it is disposed.
|
|
33492
|
+
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
33493
|
+
* called, plugin should not call to any editor method since it will result in error.
|
|
33494
|
+
*/
|
|
33495
|
+
DragAndDropPlugin.prototype.dispose = function () {
|
|
33496
|
+
this.editor = null;
|
|
33497
|
+
if (this.disposer) {
|
|
33498
|
+
this.disposer();
|
|
33499
|
+
this.disposer = null;
|
|
33500
|
+
}
|
|
33501
|
+
this.isInternalDragging = false;
|
|
33502
|
+
this.forbiddenElements = [];
|
|
33503
|
+
};
|
|
33504
|
+
/**
|
|
33505
|
+
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
33506
|
+
* method of each plugin to handle the event as long as the event is not handled
|
|
33507
|
+
* exclusively by another plugin.
|
|
33508
|
+
* @param event The event to handle:
|
|
33509
|
+
*/
|
|
33510
|
+
DragAndDropPlugin.prototype.onPluginEvent = function (event) {
|
|
33511
|
+
var _a;
|
|
33512
|
+
if (this.editor && event.eventType == 'beforeDrop') {
|
|
33513
|
+
if (this.isInternalDragging) {
|
|
33514
|
+
this.isInternalDragging = false;
|
|
33515
|
+
}
|
|
33516
|
+
else {
|
|
33517
|
+
var dropEvent = event.rawEvent;
|
|
33518
|
+
var html = (_a = dropEvent.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData('text/html');
|
|
33519
|
+
if (html) {
|
|
33520
|
+
(0, handleDroppedContent_1.handleDroppedContent)(this.editor, dropEvent, html, this.forbiddenElements);
|
|
33521
|
+
}
|
|
33522
|
+
}
|
|
33523
|
+
return;
|
|
33524
|
+
}
|
|
33525
|
+
};
|
|
33526
|
+
return DragAndDropPlugin;
|
|
33527
|
+
}());
|
|
33528
|
+
exports.DragAndDropPlugin = DragAndDropPlugin;
|
|
33529
|
+
|
|
33530
|
+
|
|
33531
|
+
/***/ },
|
|
33532
|
+
|
|
33533
|
+
/***/ "./packages/roosterjs-content-model-plugins/lib/dragAndDrop/utils/cleanForbiddenElements.ts"
|
|
33534
|
+
/*!**************************************************************************************************!*\
|
|
33535
|
+
!*** ./packages/roosterjs-content-model-plugins/lib/dragAndDrop/utils/cleanForbiddenElements.ts ***!
|
|
33536
|
+
\**************************************************************************************************/
|
|
33537
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
33538
|
+
|
|
33539
|
+
"use strict";
|
|
33540
|
+
|
|
33541
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
33542
|
+
exports.cleanForbiddenElements = void 0;
|
|
33543
|
+
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
|
|
33544
|
+
/**
|
|
33545
|
+
* @internal
|
|
33546
|
+
* Remove all forbidden elements from a parsed HTML document
|
|
33547
|
+
* @param doc The parsed HTML document to clean
|
|
33548
|
+
* @param forbiddenElements Array of tag names to remove (e.g., ['iframe', 'script'])
|
|
33549
|
+
*/
|
|
33550
|
+
function cleanForbiddenElements(doc, forbiddenElements) {
|
|
33551
|
+
var e_1, _a;
|
|
33552
|
+
var _b;
|
|
33553
|
+
if (forbiddenElements.length === 0) {
|
|
33554
|
+
return;
|
|
33555
|
+
}
|
|
33556
|
+
var selector = forbiddenElements.join(',');
|
|
33557
|
+
var elements = Array.from(doc.body.querySelectorAll(selector));
|
|
33558
|
+
try {
|
|
33559
|
+
for (var elements_1 = (0, tslib_1.__values)(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
|
|
33560
|
+
var element = elements_1_1.value;
|
|
33561
|
+
(_b = element.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(element);
|
|
33562
|
+
}
|
|
33563
|
+
}
|
|
33564
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
33565
|
+
finally {
|
|
33566
|
+
try {
|
|
33567
|
+
if (elements_1_1 && !elements_1_1.done && (_a = elements_1.return)) _a.call(elements_1);
|
|
33568
|
+
}
|
|
33569
|
+
finally { if (e_1) throw e_1.error; }
|
|
33570
|
+
}
|
|
33571
|
+
}
|
|
33572
|
+
exports.cleanForbiddenElements = cleanForbiddenElements;
|
|
33573
|
+
|
|
33574
|
+
|
|
33575
|
+
/***/ },
|
|
33576
|
+
|
|
33577
|
+
/***/ "./packages/roosterjs-content-model-plugins/lib/dragAndDrop/utils/handleDroppedContent.ts"
|
|
33578
|
+
/*!************************************************************************************************!*\
|
|
33579
|
+
!*** ./packages/roosterjs-content-model-plugins/lib/dragAndDrop/utils/handleDroppedContent.ts ***!
|
|
33580
|
+
\************************************************************************************************/
|
|
33581
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
33582
|
+
|
|
33583
|
+
"use strict";
|
|
33584
|
+
|
|
33585
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
33586
|
+
exports.handleDroppedContent = void 0;
|
|
33587
|
+
var cleanForbiddenElements_1 = __webpack_require__(/*! ./cleanForbiddenElements */ "./packages/roosterjs-content-model-plugins/lib/dragAndDrop/utils/cleanForbiddenElements.ts");
|
|
33588
|
+
var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-model-dom */ "./packages/roosterjs-content-model-dom/lib/index.ts");
|
|
33589
|
+
/**
|
|
33590
|
+
* @internal
|
|
33591
|
+
* Handle dropped HTML content by inserting it at the drop position
|
|
33592
|
+
*/
|
|
33593
|
+
function handleDroppedContent(editor, event, html, forbiddenElements) {
|
|
33594
|
+
var doc = editor.getDocument();
|
|
33595
|
+
var domPosition = (0, roosterjs_content_model_dom_1.getNodePositionFromEvent)(doc, editor.getDOMHelper(), event.x, event.y);
|
|
33596
|
+
if (domPosition) {
|
|
33597
|
+
event.preventDefault();
|
|
33598
|
+
event.stopPropagation();
|
|
33599
|
+
var range = doc.createRange();
|
|
33600
|
+
range.setStart(domPosition.node, domPosition.offset);
|
|
33601
|
+
range.collapse(true);
|
|
33602
|
+
var parsedHtml = editor.getDOMCreator().htmlToDOM(html);
|
|
33603
|
+
(0, cleanForbiddenElements_1.cleanForbiddenElements)(parsedHtml, forbiddenElements);
|
|
33604
|
+
var droppedModel_1 = (0, roosterjs_content_model_dom_1.domToContentModel)(parsedHtml.body, (0, roosterjs_content_model_dom_1.createDomToModelContext)());
|
|
33605
|
+
editor.formatContentModel(function (model, context) {
|
|
33606
|
+
(0, roosterjs_content_model_dom_1.mergeModel)(model, droppedModel_1, context);
|
|
33607
|
+
return true;
|
|
33608
|
+
}, {
|
|
33609
|
+
selectionOverride: {
|
|
33610
|
+
type: 'range',
|
|
33611
|
+
range: range,
|
|
33612
|
+
isReverted: false,
|
|
33613
|
+
},
|
|
33614
|
+
});
|
|
33615
|
+
}
|
|
33616
|
+
}
|
|
33617
|
+
exports.handleDroppedContent = handleDroppedContent;
|
|
33618
|
+
|
|
33619
|
+
|
|
33394
33620
|
/***/ },
|
|
33395
33621
|
|
|
33396
33622
|
/***/ "./packages/roosterjs-content-model-plugins/lib/edit/EditPlugin.ts"
|
|
@@ -38395,7 +38621,7 @@ exports.updateWrapper = updateWrapper;
|
|
|
38395
38621
|
"use strict";
|
|
38396
38622
|
|
|
38397
38623
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
38398
|
-
exports.AnnouncePlugin = exports.moveHighlight = exports.replace = exports.find = exports.createFindReplaceContext = exports.FindReplacePlugin = exports.TouchPlugin = exports.HiddenPropertyPlugin = exports.ImageEditPlugin = exports.CustomReplacePlugin = exports.PickerPlugin = exports.HyperlinkPlugin = exports.MarkdownPlugin = exports.isModelEmptyFast = exports.WatermarkPlugin = exports.ContextMenuPluginBase = exports.ShortcutPlugin = exports.ShortcutOutdentList = exports.ShortcutIndentList = exports.ShortcutDecreaseFont = exports.ShortcutIncreaseFont = exports.ShortcutNumbering = exports.ShortcutBullet = exports.ShortcutRedoMacOS = exports.ShortcutRedoAlt = exports.ShortcutRedo = exports.ShortcutUndo2 = exports.ShortcutUndo = exports.ShortcutClearFormat = exports.ShortcutUnderline = exports.ShortcutItalic = exports.ShortcutBold = exports.AutoFormatPlugin = exports.EditPlugin = exports.DefaultSanitizers = exports.PastePlugin = exports.TableEditPlugin = void 0;
|
|
38624
|
+
exports.DragAndDropPlugin = exports.AnnouncePlugin = exports.moveHighlight = exports.replace = exports.find = exports.createFindReplaceContext = exports.FindReplacePlugin = exports.TouchPlugin = exports.HiddenPropertyPlugin = exports.ImageEditPlugin = exports.CustomReplacePlugin = exports.PickerPlugin = exports.HyperlinkPlugin = exports.MarkdownPlugin = exports.isModelEmptyFast = exports.WatermarkPlugin = exports.ContextMenuPluginBase = exports.ShortcutPlugin = exports.ShortcutOutdentList = exports.ShortcutIndentList = exports.ShortcutDecreaseFont = exports.ShortcutIncreaseFont = exports.ShortcutNumbering = exports.ShortcutBullet = exports.ShortcutRedoMacOS = exports.ShortcutRedoAlt = exports.ShortcutRedo = exports.ShortcutUndo2 = exports.ShortcutUndo = exports.ShortcutClearFormat = exports.ShortcutUnderline = exports.ShortcutItalic = exports.ShortcutBold = exports.AutoFormatPlugin = exports.EditPlugin = exports.DefaultSanitizers = exports.PastePlugin = exports.TableEditPlugin = void 0;
|
|
38399
38625
|
var TableEditPlugin_1 = __webpack_require__(/*! ./tableEdit/TableEditPlugin */ "./packages/roosterjs-content-model-plugins/lib/tableEdit/TableEditPlugin.ts");
|
|
38400
38626
|
Object.defineProperty(exports, "TableEditPlugin", ({ enumerable: true, get: function () { return TableEditPlugin_1.TableEditPlugin; } }));
|
|
38401
38627
|
var PastePlugin_1 = __webpack_require__(/*! ./paste/PastePlugin */ "./packages/roosterjs-content-model-plugins/lib/paste/PastePlugin.ts");
|
|
@@ -38456,6 +38682,8 @@ var moveHighlight_1 = __webpack_require__(/*! ./findReplace/moveHighlight */ "./
|
|
|
38456
38682
|
Object.defineProperty(exports, "moveHighlight", ({ enumerable: true, get: function () { return moveHighlight_1.moveHighlight; } }));
|
|
38457
38683
|
var AnnouncePlugin_1 = __webpack_require__(/*! ./announce/AnnouncePlugin */ "./packages/roosterjs-content-model-plugins/lib/announce/AnnouncePlugin.ts");
|
|
38458
38684
|
Object.defineProperty(exports, "AnnouncePlugin", ({ enumerable: true, get: function () { return AnnouncePlugin_1.AnnouncePlugin; } }));
|
|
38685
|
+
var DragAndDropPlugin_1 = __webpack_require__(/*! ./dragAndDrop/DragAndDropPlugin */ "./packages/roosterjs-content-model-plugins/lib/dragAndDrop/DragAndDropPlugin.ts");
|
|
38686
|
+
Object.defineProperty(exports, "DragAndDropPlugin", ({ enumerable: true, get: function () { return DragAndDropPlugin_1.DragAndDropPlugin; } }));
|
|
38459
38687
|
|
|
38460
38688
|
|
|
38461
38689
|
/***/ },
|