@ckeditor/ckeditor5-clipboard 43.0.0-alpha.6 → 43.1.0-alpha.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/index.js +3 -20
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/clipboardobserver.js +3 -22
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
import { Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
6
|
-
import { EventInfo, uid, toUnit, delay, DomEmitterMixin, global, Rect, ResizeObserver, env, createElement } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
6
|
+
import { EventInfo, getRangeFromMouseEvent, uid, toUnit, delay, DomEmitterMixin, global, Rect, ResizeObserver, env, createElement } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
7
7
|
import { DomEventObserver, DataTransfer, Range, MouseObserver, LiveRange } from '@ckeditor/ckeditor5-engine/dist/index.js';
|
|
8
8
|
import { mapValues, throttle } from 'lodash-es';
|
|
9
9
|
import { Widget, isWidget } from '@ckeditor/ckeditor5-widget/dist/index.js';
|
|
@@ -86,29 +86,12 @@ import { View } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
|
|
86
86
|
})
|
|
87
87
|
};
|
|
88
88
|
if (domEvent.type == 'drop' || domEvent.type == 'dragover') {
|
|
89
|
-
|
|
89
|
+
const domRange = getRangeFromMouseEvent(domEvent);
|
|
90
|
+
evtData.dropRange = domRange && this.view.domConverter.domRangeToView(domRange);
|
|
90
91
|
}
|
|
91
92
|
this.fire(domEvent.type, domEvent, evtData);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
|
-
function getDropViewRange(view, domEvent) {
|
|
95
|
-
const domDoc = domEvent.target.ownerDocument;
|
|
96
|
-
const x = domEvent.clientX;
|
|
97
|
-
const y = domEvent.clientY;
|
|
98
|
-
let domRange;
|
|
99
|
-
// Webkit & Blink.
|
|
100
|
-
if (domDoc.caretRangeFromPoint && domDoc.caretRangeFromPoint(x, y)) {
|
|
101
|
-
domRange = domDoc.caretRangeFromPoint(x, y);
|
|
102
|
-
} else if (domEvent.rangeParent) {
|
|
103
|
-
domRange = domDoc.createRange();
|
|
104
|
-
domRange.setStart(domEvent.rangeParent, domEvent.rangeOffset);
|
|
105
|
-
domRange.collapse(true);
|
|
106
|
-
}
|
|
107
|
-
if (domRange) {
|
|
108
|
-
return view.domConverter.domRangeToView(domRange);
|
|
109
|
-
}
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
95
|
|
|
113
96
|
/**
|
|
114
97
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|