@worktile/theia 19.5.0-next.2 → 19.5.0-next.3
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.
|
@@ -8774,7 +8774,7 @@ const withDeserializeMd = (editor) => {
|
|
|
8774
8774
|
closeConversionHint(editor);
|
|
8775
8775
|
onKeydown(event);
|
|
8776
8776
|
};
|
|
8777
|
-
editor.customInsertFragmentData = async (data) => {
|
|
8777
|
+
editor.customInsertFragmentData = async (data, contextClipboardData) => {
|
|
8778
8778
|
const popover = editor.injector.get(ThyPopover);
|
|
8779
8779
|
const viewContainerRef = editor.injector.get(ViewContainerRef);
|
|
8780
8780
|
const cdr = editor.injector.get(ChangeDetectorRef);
|
|
@@ -8845,7 +8845,7 @@ const withDeserializeMd = (editor) => {
|
|
|
8845
8845
|
cdr.markForCheck();
|
|
8846
8846
|
});
|
|
8847
8847
|
}
|
|
8848
|
-
return customInsertFragmentData(data);
|
|
8848
|
+
return customInsertFragmentData(data, contextClipboardData);
|
|
8849
8849
|
};
|
|
8850
8850
|
return editor;
|
|
8851
8851
|
};
|
|
@@ -10695,7 +10695,7 @@ const createTheHistoryPlugin = createPluginFactory({
|
|
|
10695
10695
|
|
|
10696
10696
|
const withInsertDataByInvalidType = (editor) => {
|
|
10697
10697
|
const { customInsertFragmentData } = editor;
|
|
10698
|
-
editor.customInsertFragmentData = async (data) => {
|
|
10698
|
+
editor.customInsertFragmentData = async (data, clipboardData) => {
|
|
10699
10699
|
const fragment = await extractFragment(data);
|
|
10700
10700
|
if (fragment) {
|
|
10701
10701
|
const isContinue = insertDataByInvalidType(editor, fragment);
|
|
@@ -10703,7 +10703,7 @@ const withInsertDataByInvalidType = (editor) => {
|
|
|
10703
10703
|
return true;
|
|
10704
10704
|
}
|
|
10705
10705
|
}
|
|
10706
|
-
return customInsertFragmentData(data);
|
|
10706
|
+
return customInsertFragmentData(data, clipboardData);
|
|
10707
10707
|
};
|
|
10708
10708
|
return editor;
|
|
10709
10709
|
};
|
|
@@ -10956,24 +10956,25 @@ const createResetTypePlugin = createPluginFactory({
|
|
|
10956
10956
|
|
|
10957
10957
|
const withDeserializeHTML = (editor) => {
|
|
10958
10958
|
const { customInsertFragmentData } = editor;
|
|
10959
|
-
editor.customInsertFragmentData = async (data) => {
|
|
10959
|
+
editor.customInsertFragmentData = async (data, contextClipboardData) => {
|
|
10960
10960
|
const fragmentFromHTML = await extractFragmentByHTML(data);
|
|
10961
10961
|
if (fragmentFromHTML) {
|
|
10962
|
+
const newContextClipboardData = { elements: fragmentFromHTML };
|
|
10962
10963
|
// 识别粘贴的 HTML 只有纯链接, 跳至 link
|
|
10963
10964
|
if (fragmentFromHTML.length === 1 && fragmentFromHTML.every(block => isUrl(block?.children?.[0]?.['text']))) {
|
|
10964
|
-
return customInsertFragmentData(data);
|
|
10965
|
+
return customInsertFragmentData(data, newContextClipboardData);
|
|
10965
10966
|
}
|
|
10966
10967
|
// 无法识别HTML内容时后退一下:识别纯文本
|
|
10967
10968
|
if (fragmentFromHTML.every(block => block.type === ElementKinds.paragraph && isLogicEmptyParagraphElement(editor, block))) {
|
|
10968
|
-
return customInsertFragmentData(data);
|
|
10969
|
+
return customInsertFragmentData(data, null);
|
|
10969
10970
|
}
|
|
10970
10971
|
// 识出纯图片并且粘贴板中存在文件则不进行处理, hook 直接右键复制图片的场景,流转到上传图片流程
|
|
10971
10972
|
// 后续需要做识别html图片后自动上传处理
|
|
10972
10973
|
if (fragmentFromHTML.length === 1 && fragmentFromHTML[0].type === ElementKinds.image && data.files.length > 0) {
|
|
10973
|
-
return customInsertFragmentData(data);
|
|
10974
|
+
return customInsertFragmentData(data, contextClipboardData || null);
|
|
10974
10975
|
}
|
|
10975
10976
|
if (isLogicTableElement(editor, fragmentFromHTML)) {
|
|
10976
|
-
return customInsertFragmentData(data);
|
|
10977
|
+
return customInsertFragmentData(data, newContextClipboardData);
|
|
10977
10978
|
}
|
|
10978
10979
|
// 过滤 text 节点的 color/background-color 属性
|
|
10979
10980
|
fragmentFromHTML.forEach(node => filterTextFormat(node));
|
|
@@ -10997,7 +10998,7 @@ const withDeserializeHTML = (editor) => {
|
|
|
10997
10998
|
Transforms.insertFragment(editor, fragmentFromHTML);
|
|
10998
10999
|
return true;
|
|
10999
11000
|
}
|
|
11000
|
-
return customInsertFragmentData(data);
|
|
11001
|
+
return customInsertFragmentData(data, contextClipboardData || null);
|
|
11001
11002
|
};
|
|
11002
11003
|
return editor;
|
|
11003
11004
|
};
|
|
@@ -11892,9 +11893,9 @@ const withImage = (editor) => {
|
|
|
11892
11893
|
editor.isVoid = (element) => {
|
|
11893
11894
|
return element.type === ElementKinds.image || isVoid(element);
|
|
11894
11895
|
};
|
|
11895
|
-
editor.customInsertFragmentData = async (data) => {
|
|
11896
|
+
editor.customInsertFragmentData = async (data, contextClipboardData) => {
|
|
11896
11897
|
const clipboardData = await getClipboardData(data);
|
|
11897
|
-
const res = await customInsertFragmentData(data);
|
|
11898
|
+
const res = await customInsertFragmentData(data, contextClipboardData);
|
|
11898
11899
|
if (!res && clipboardData?.files?.length) {
|
|
11899
11900
|
const imageFiles = [];
|
|
11900
11901
|
const imageTypes = getPluginOptions(editor, PluginKeys.image)?.imageTypes;
|
|
@@ -11908,6 +11909,7 @@ const withImage = (editor) => {
|
|
|
11908
11909
|
return true;
|
|
11909
11910
|
}
|
|
11910
11911
|
}
|
|
11912
|
+
return res;
|
|
11911
11913
|
};
|
|
11912
11914
|
editor.renderElement = (element) => {
|
|
11913
11915
|
if (element.type === ElementKinds.image) {
|
|
@@ -12468,7 +12470,7 @@ const withLink = (editor) => {
|
|
|
12468
12470
|
insertText(text);
|
|
12469
12471
|
}
|
|
12470
12472
|
};
|
|
12471
|
-
editor.customInsertFragmentData = async (data) => {
|
|
12473
|
+
editor.customInsertFragmentData = async (data, contextClipboardData) => {
|
|
12472
12474
|
const clipboardData = await getClipboardData(data);
|
|
12473
12475
|
const text = clipboardData?.text;
|
|
12474
12476
|
if (!clipboardData?.elements && text && isUrl(text)) {
|
|
@@ -12489,7 +12491,7 @@ const withLink = (editor) => {
|
|
|
12489
12491
|
return true;
|
|
12490
12492
|
}
|
|
12491
12493
|
}
|
|
12492
|
-
return customInsertFragmentData(data);
|
|
12494
|
+
return customInsertFragmentData(data, contextClipboardData);
|
|
12493
12495
|
};
|
|
12494
12496
|
editor.renderElement = (element) => {
|
|
12495
12497
|
if (element.type === ElementKinds.link) {
|
|
@@ -13413,7 +13415,7 @@ const withList = (editor) => {
|
|
|
13413
13415
|
}
|
|
13414
13416
|
deleteBackward(unit);
|
|
13415
13417
|
};
|
|
13416
|
-
editor.customInsertFragmentData = async (data) => {
|
|
13418
|
+
editor.customInsertFragmentData = async (data, clipboardData) => {
|
|
13417
13419
|
const fragment = await extractFragment(data);
|
|
13418
13420
|
if (fragment) {
|
|
13419
13421
|
const aboveEntry = Editor.above(editor, {
|
|
@@ -13429,7 +13431,7 @@ const withList = (editor) => {
|
|
|
13429
13431
|
return true;
|
|
13430
13432
|
}
|
|
13431
13433
|
}
|
|
13432
|
-
return customInsertFragmentData(data);
|
|
13434
|
+
return customInsertFragmentData(data, clipboardData);
|
|
13433
13435
|
};
|
|
13434
13436
|
editor.onKeydown = (event) => {
|
|
13435
13437
|
const isContinue = !onKeyDownList(event, editor);
|
|
@@ -17606,10 +17608,10 @@ const withTable = (editor) => {
|
|
|
17606
17608
|
}
|
|
17607
17609
|
setFragmentData(data, originEvent);
|
|
17608
17610
|
};
|
|
17609
|
-
editor.customInsertFragmentData = async (data) => {
|
|
17611
|
+
editor.customInsertFragmentData = async (data, contextClipboardData) => {
|
|
17610
17612
|
let fragment = await extractFragment(data);
|
|
17611
17613
|
if (!fragment) {
|
|
17612
|
-
fragment =
|
|
17614
|
+
fragment = contextClipboardData ? contextClipboardData.elements : null;
|
|
17613
17615
|
}
|
|
17614
17616
|
if (fragment) {
|
|
17615
17617
|
const opts = new TableOptions();
|
|
@@ -17681,9 +17683,9 @@ const withTable = (editor) => {
|
|
|
17681
17683
|
});
|
|
17682
17684
|
});
|
|
17683
17685
|
}
|
|
17684
|
-
return customInsertFragmentData(data);
|
|
17686
|
+
return customInsertFragmentData(data, contextClipboardData);
|
|
17685
17687
|
}
|
|
17686
|
-
return customInsertFragmentData(data);
|
|
17688
|
+
return customInsertFragmentData(data, null);
|
|
17687
17689
|
};
|
|
17688
17690
|
editor.normalizeNode = ([node, path]) => {
|
|
17689
17691
|
if (Element.isElement(node) && node.type === ElementKinds.table) {
|