@ckeditor/ckeditor5-clipboard 41.1.0 → 41.2.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/lang/contexts.json +5 -0
- package/lang/translations/ar.po +30 -0
- package/lang/translations/bg.po +30 -0
- package/lang/translations/bn.po +30 -0
- package/lang/translations/ca.po +30 -0
- package/lang/translations/cs.po +30 -0
- package/lang/translations/da.po +30 -0
- package/lang/translations/de.po +30 -0
- package/lang/translations/el.po +30 -0
- package/lang/translations/en.po +30 -0
- package/lang/translations/es.po +30 -0
- package/lang/translations/et.po +30 -0
- package/lang/translations/fi.po +30 -0
- package/lang/translations/fr.po +30 -0
- package/lang/translations/he.po +30 -0
- package/lang/translations/hi.po +30 -0
- package/lang/translations/hr.po +30 -0
- package/lang/translations/hu.po +30 -0
- package/lang/translations/id.po +30 -0
- package/lang/translations/it.po +30 -0
- package/lang/translations/ja.po +30 -0
- package/lang/translations/ko.po +30 -0
- package/lang/translations/lt.po +30 -0
- package/lang/translations/lv.po +30 -0
- package/lang/translations/ms.po +30 -0
- package/lang/translations/nl.po +30 -0
- package/lang/translations/no.po +30 -0
- package/lang/translations/pl.po +30 -0
- package/lang/translations/pt-br.po +30 -0
- package/lang/translations/pt.po +30 -0
- package/lang/translations/ro.po +30 -0
- package/lang/translations/ru.po +30 -0
- package/lang/translations/sk.po +30 -0
- package/lang/translations/sr.po +30 -0
- package/lang/translations/sv.po +30 -0
- package/lang/translations/th.po +30 -0
- package/lang/translations/tr.po +30 -0
- package/lang/translations/uk.po +30 -0
- package/lang/translations/vi.po +30 -0
- package/lang/translations/zh-cn.po +30 -0
- package/lang/translations/zh.po +30 -0
- package/package.json +6 -6
- package/src/augmentation.d.ts +2 -1
- package/src/clipboard.d.ts +6 -1
- package/src/clipboard.js +26 -1
- package/src/clipboardmarkersutils.d.ts +186 -0
- package/src/clipboardmarkersutils.js +424 -0
- package/src/clipboardpipeline.d.ts +5 -0
- package/src/clipboardpipeline.js +14 -2
- package/src/index.d.ts +2 -1
- package/src/index.js +1 -0
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from '@ckeditor/ckeditor5-core';
|
|
9
9
|
import type { DataTransfer, DocumentFragment, Range, ViewDocumentFragment, ViewRange, Selection, DocumentSelection } from '@ckeditor/ckeditor5-engine';
|
|
10
|
+
import ClipboardMarkersUtils from './clipboardmarkersutils.js';
|
|
10
11
|
/**
|
|
11
12
|
* The clipboard pipeline feature. It is responsible for intercepting the `paste` and `drop` events and
|
|
12
13
|
* passing the pasted content through a series of events in order to insert it into the editor's content.
|
|
@@ -73,6 +74,10 @@ export default class ClipboardPipeline extends Plugin {
|
|
|
73
74
|
* @inheritDoc
|
|
74
75
|
*/
|
|
75
76
|
static get pluginName(): "ClipboardPipeline";
|
|
77
|
+
/**
|
|
78
|
+
* @inheritDoc
|
|
79
|
+
*/
|
|
80
|
+
static get requires(): readonly [typeof ClipboardMarkersUtils];
|
|
76
81
|
/**
|
|
77
82
|
* @inheritDoc
|
|
78
83
|
*/
|
package/src/clipboardpipeline.js
CHANGED
|
@@ -11,6 +11,7 @@ import ClipboardObserver from './clipboardobserver.js';
|
|
|
11
11
|
import plainTextToHtml from './utils/plaintexttohtml.js';
|
|
12
12
|
import normalizeClipboardHtml from './utils/normalizeclipboarddata.js';
|
|
13
13
|
import viewToPlainText from './utils/viewtoplaintext.js';
|
|
14
|
+
import ClipboardMarkersUtils from './clipboardmarkersutils.js';
|
|
14
15
|
// Input pipeline events overview:
|
|
15
16
|
//
|
|
16
17
|
// ┌──────────────────────┐ ┌──────────────────────┐
|
|
@@ -123,6 +124,12 @@ export default class ClipboardPipeline extends Plugin {
|
|
|
123
124
|
static get pluginName() {
|
|
124
125
|
return 'ClipboardPipeline';
|
|
125
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* @inheritDoc
|
|
129
|
+
*/
|
|
130
|
+
static get requires() {
|
|
131
|
+
return [ClipboardMarkersUtils];
|
|
132
|
+
}
|
|
126
133
|
/**
|
|
127
134
|
* @inheritDoc
|
|
128
135
|
*/
|
|
@@ -139,10 +146,11 @@ export default class ClipboardPipeline extends Plugin {
|
|
|
139
146
|
* @internal
|
|
140
147
|
*/
|
|
141
148
|
_fireOutputTransformationEvent(dataTransfer, selection, method) {
|
|
142
|
-
const
|
|
149
|
+
const clipboardMarkersUtils = this.editor.plugins.get('ClipboardMarkersUtils');
|
|
150
|
+
const documentFragment = clipboardMarkersUtils._copySelectedFragmentWithMarkers(method, selection);
|
|
143
151
|
this.fire('outputTransformation', {
|
|
144
152
|
dataTransfer,
|
|
145
|
-
content,
|
|
153
|
+
content: documentFragment,
|
|
146
154
|
method
|
|
147
155
|
});
|
|
148
156
|
}
|
|
@@ -154,6 +162,7 @@ export default class ClipboardPipeline extends Plugin {
|
|
|
154
162
|
const model = editor.model;
|
|
155
163
|
const view = editor.editing.view;
|
|
156
164
|
const viewDocument = view.document;
|
|
165
|
+
const clipboardMarkersUtils = this.editor.plugins.get('ClipboardMarkersUtils');
|
|
157
166
|
// Pasting is disabled when selection is in non-editable place.
|
|
158
167
|
// Dropping is disabled in drag and drop handler.
|
|
159
168
|
this.listenTo(viewDocument, 'clipboardInput', (evt, data) => {
|
|
@@ -217,6 +226,9 @@ export default class ClipboardPipeline extends Plugin {
|
|
|
217
226
|
});
|
|
218
227
|
});
|
|
219
228
|
}, { priority: 'low' });
|
|
229
|
+
this.listenTo(this, 'contentInsertion', (evt, data) => {
|
|
230
|
+
clipboardMarkersUtils._setUniqueMarkerNamesInFragment(data.content);
|
|
231
|
+
}, { priority: 'highest' });
|
|
220
232
|
this.listenTo(this, 'contentInsertion', (evt, data) => {
|
|
221
233
|
data.resultRange = model.insertContent(data.content);
|
|
222
234
|
}, { priority: 'low' });
|
package/src/index.d.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* @module clipboard
|
|
7
7
|
*/
|
|
8
8
|
export { default as Clipboard } from './clipboard.js';
|
|
9
|
-
export { default as ClipboardPipeline, type ClipboardContentInsertionEvent, type ClipboardInputTransformationEvent, type ClipboardInputTransformationData, type ClipboardOutputTransformationEvent, type ClipboardOutputTransformationData, type ViewDocumentClipboardOutputEvent } from './clipboardpipeline.js';
|
|
9
|
+
export { default as ClipboardPipeline, type ClipboardContentInsertionEvent, type ClipboardContentInsertionData, type ClipboardInputTransformationEvent, type ClipboardInputTransformationData, type ClipboardOutputTransformationEvent, type ClipboardOutputTransformationData, type ViewDocumentClipboardOutputEvent } from './clipboardpipeline.js';
|
|
10
|
+
export { default as ClipboardMarkersUtils, type ClipboardMarkerRestrictionsPreset, type ClipboardMarkerRestrictedAction } from './clipboardmarkersutils.js';
|
|
10
11
|
export type { ClipboardEventData } from './clipboardobserver.js';
|
|
11
12
|
export { default as DragDrop } from './dragdrop.js';
|
|
12
13
|
export { default as PastePlainText } from './pasteplaintext.js';
|
package/src/index.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { default as Clipboard } from './clipboard.js';
|
|
9
9
|
export { default as ClipboardPipeline } from './clipboardpipeline.js';
|
|
10
|
+
export { default as ClipboardMarkersUtils } from './clipboardmarkersutils.js';
|
|
10
11
|
export { default as DragDrop } from './dragdrop.js';
|
|
11
12
|
export { default as PastePlainText } from './pasteplaintext.js';
|
|
12
13
|
export { default as DragDropTarget } from './dragdroptarget.js';
|