@seafile/seafile-editor 0.3.84 → 0.3.85
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.
|
@@ -210,43 +210,39 @@ var Plugin = function Plugin(_editor) {
|
|
|
210
210
|
|
|
211
211
|
var table = _this.tableUtils.getSelectedTableCells();
|
|
212
212
|
|
|
213
|
-
if (
|
|
214
|
-
setEventTransfer(event, '
|
|
213
|
+
if (table) {
|
|
214
|
+
setEventTransfer(event, 'fragment', table);
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
|
-
|
|
218
|
-
setEventTransfer(event, 'fragment', table);
|
|
219
|
-
return;
|
|
220
217
|
}
|
|
221
218
|
|
|
222
|
-
if (
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
var
|
|
226
|
-
|
|
219
|
+
if (editor.selection && !Range.isCollapsed(editor.selection)) {
|
|
220
|
+
// get block deepest block node.
|
|
221
|
+
// for example: code line in a code block, paragraph in a list
|
|
222
|
+
var blockList = Editor.nodes(editor, {
|
|
223
|
+
at: editor.selection,
|
|
224
|
+
match: 'block'
|
|
227
225
|
});
|
|
228
|
-
var focusCodeBlock = Editor.match(_this.editor, focusPoint, {
|
|
229
|
-
type: 'code_block'
|
|
230
|
-
});
|
|
231
|
-
/*
|
|
232
|
-
If the selection is within the range of the selected code block
|
|
233
|
-
copy the selected code line as paragraph
|
|
234
|
-
*/
|
|
235
226
|
|
|
236
|
-
if (
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
227
|
+
if (blockList) {
|
|
228
|
+
var nodeList = Array.from(blockList);
|
|
229
|
+
/**
|
|
230
|
+
* if only one block element selected, write the selected content as paragraph or text to clipboard
|
|
231
|
+
* instead of use slate default behavior which write the outest element to clipboard
|
|
232
|
+
*/
|
|
233
|
+
|
|
234
|
+
if (nodeList.length === 1) {
|
|
235
|
+
event.preventDefault();
|
|
236
|
+
var node = nodeList[0][0];
|
|
237
|
+
|
|
238
|
+
if (node && node.type === 'paragraph') {
|
|
239
|
+
setEventTransfer(event, 'fragment', [node]);
|
|
240
|
+
} else {
|
|
241
|
+
setEventTransfer(event, 'text', SfEditor.text(editor, editor.selection));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
250
246
|
}
|
|
251
247
|
}
|
|
252
248
|
};
|