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