@worktile/theia 19.5.0-next.1 → 19.5.0-next.2
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.
|
@@ -10972,7 +10972,7 @@ const withDeserializeHTML = (editor) => {
|
|
|
10972
10972
|
if (fragmentFromHTML.length === 1 && fragmentFromHTML[0].type === ElementKinds.image && data.files.length > 0) {
|
|
10973
10973
|
return customInsertFragmentData(data);
|
|
10974
10974
|
}
|
|
10975
|
-
if (
|
|
10975
|
+
if (isLogicTableElement(editor, fragmentFromHTML)) {
|
|
10976
10976
|
return customInsertFragmentData(data);
|
|
10977
10977
|
}
|
|
10978
10978
|
// 过滤 text 节点的 color/background-color 属性
|
|
@@ -11005,6 +11005,10 @@ const createDeserializeHTMLPlugin = createPluginFactory({
|
|
|
11005
11005
|
key: PluginKeys.deserializeHtml,
|
|
11006
11006
|
withOverrides: withDeserializeHTML
|
|
11007
11007
|
});
|
|
11008
|
+
const isLogicTableElement = (editor, elements) => {
|
|
11009
|
+
const elementsFiltered = elements.filter(element => element.type !== ElementKinds.paragraph || !isLogicEmptyParagraphElement(editor, element));
|
|
11010
|
+
return elementsFiltered.length === 1 && elementsFiltered[0].type === ElementKinds.table;
|
|
11011
|
+
};
|
|
11008
11012
|
|
|
11009
11013
|
const FontSizeEditor = {
|
|
11010
11014
|
setFontSize(editor, size) {
|
|
@@ -11890,7 +11894,8 @@ const withImage = (editor) => {
|
|
|
11890
11894
|
};
|
|
11891
11895
|
editor.customInsertFragmentData = async (data) => {
|
|
11892
11896
|
const clipboardData = await getClipboardData(data);
|
|
11893
|
-
|
|
11897
|
+
const res = await customInsertFragmentData(data);
|
|
11898
|
+
if (!res && clipboardData?.files?.length) {
|
|
11894
11899
|
const imageFiles = [];
|
|
11895
11900
|
const imageTypes = getPluginOptions(editor, PluginKeys.image)?.imageTypes;
|
|
11896
11901
|
for (const file of data.files) {
|
|
@@ -11903,7 +11908,6 @@ const withImage = (editor) => {
|
|
|
11903
11908
|
return true;
|
|
11904
11909
|
}
|
|
11905
11910
|
}
|
|
11906
|
-
return customInsertFragmentData(data);
|
|
11907
11911
|
};
|
|
11908
11912
|
editor.renderElement = (element) => {
|
|
11909
11913
|
if (element.type === ElementKinds.image) {
|
|
@@ -17609,10 +17613,9 @@ const withTable = (editor) => {
|
|
|
17609
17613
|
}
|
|
17610
17614
|
if (fragment) {
|
|
17611
17615
|
const opts = new TableOptions();
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
fragment[0].type === ElementKinds.table) {
|
|
17616
|
+
const isTableFragment = fragment.length === 1 && Element.isElement(fragment[0]) && fragment[0].type === ElementKinds.table;
|
|
17617
|
+
if (isSelectionInTable(opts, editor) && (isTableFragment || isLogicTableElement(editor, fragment))) {
|
|
17618
|
+
fragment = fragment.filter(node => node.type === ElementKinds.table);
|
|
17616
17619
|
const tablePosition = createTablePosition(editor);
|
|
17617
17620
|
const clipboardTable = fragment[0].children;
|
|
17618
17621
|
const clipboardRow = clipboardTable[0].children;
|