@worktile/theia 19.1.4 → 19.1.6
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.
|
@@ -10810,7 +10810,7 @@ const cleanHeadingEffect = (editor, path) => {
|
|
|
10810
10810
|
}
|
|
10811
10811
|
};
|
|
10812
10812
|
const withHeading = (editor) => {
|
|
10813
|
-
const { insertBreak, isVisible, apply, deleteBackward,
|
|
10813
|
+
const { insertBreak, isVisible, apply, deleteBackward, mousedown } = editor;
|
|
10814
10814
|
editor.apply = operation => {
|
|
10815
10815
|
try {
|
|
10816
10816
|
if (operation.type === 'merge_node' && operation.path.length === 1) {
|
|
@@ -10820,6 +10820,13 @@ const withHeading = (editor) => {
|
|
|
10820
10820
|
// 协同场景下,merge_node 会被转换为 remove_node 和 insert_node
|
|
10821
10821
|
cleanHeadingEffect(editor, operation.path);
|
|
10822
10822
|
}
|
|
10823
|
+
else if (operation.type === 'set_node' && operation.path.length === 1) {
|
|
10824
|
+
const properties = operation.properties;
|
|
10825
|
+
const newProperties = operation.newProperties;
|
|
10826
|
+
if (isStandardHeadingElementByType(properties.type) && newProperties.type === ElementKinds.paragraph) {
|
|
10827
|
+
cleanHeadingEffect(editor, operation.path);
|
|
10828
|
+
}
|
|
10829
|
+
}
|
|
10823
10830
|
}
|
|
10824
10831
|
catch (error) {
|
|
10825
10832
|
console.error('Error handing heading fold(hidden followed elements):', error);
|
|
@@ -10840,21 +10847,10 @@ const withHeading = (editor) => {
|
|
|
10840
10847
|
if (!prevIsVisible) {
|
|
10841
10848
|
const relatedHeadingPaths = getPreviousRelatedHeadingElements(editor, path);
|
|
10842
10849
|
relatedHeadingPaths.forEach(path => {
|
|
10843
|
-
cleanHeadingEffect(editor, path);
|
|
10844
10850
|
Transforms.setNodes(editor, { isCollapsed: false }, { at: path });
|
|
10845
10851
|
});
|
|
10846
10852
|
}
|
|
10847
10853
|
}
|
|
10848
|
-
else if (path.length === 1 &&
|
|
10849
|
-
path[0] === 0 &&
|
|
10850
|
-
isCollapsed &&
|
|
10851
|
-
isStart &&
|
|
10852
|
-
isStandardHeadingElement(anchorBlockElement) &&
|
|
10853
|
-
anchorBlockElement.isCollapsed) {
|
|
10854
|
-
cleanHeadingEffect(editor, path);
|
|
10855
|
-
Transforms.setNodes(editor, { isCollapsed: null, type: ElementKinds.paragraph }, { at: path });
|
|
10856
|
-
return;
|
|
10857
|
-
}
|
|
10858
10854
|
}
|
|
10859
10855
|
deleteBackward(unit);
|
|
10860
10856
|
};
|
|
@@ -10930,7 +10926,7 @@ const withHeading = (editor) => {
|
|
|
10930
10926
|
}
|
|
10931
10927
|
return isVisible(node);
|
|
10932
10928
|
};
|
|
10933
|
-
editor.
|
|
10929
|
+
editor.mousedown = (event) => {
|
|
10934
10930
|
const target = event.target;
|
|
10935
10931
|
if (target instanceof HTMLElement && target.classList.contains('slate-editable-container')) {
|
|
10936
10932
|
const index = editor.children.length - 1;
|
|
@@ -10939,13 +10935,13 @@ const withHeading = (editor) => {
|
|
|
10939
10935
|
const path = [index];
|
|
10940
10936
|
const collapsedStandardHeadings = getCollapsedStandardHeadingAbove(editor, path);
|
|
10941
10937
|
if (collapsedStandardHeadings.length > 0) {
|
|
10938
|
+
event.preventDefault();
|
|
10942
10939
|
const headingPath = collapsedStandardHeadings[collapsedStandardHeadings.length - 1];
|
|
10943
10940
|
const headingNode = editor.children[headingPath[0]];
|
|
10944
10941
|
const dom = AngularEditor.toDOMNode(editor, headingNode);
|
|
10945
10942
|
const rect = dom.getBoundingClientRect();
|
|
10946
10943
|
if (event.y > rect.bottom && event.x > rect.left && event.x < rect.right) {
|
|
10947
10944
|
collapsedStandardHeadings.forEach(path => {
|
|
10948
|
-
cleanHeadingEffect(editor, path);
|
|
10949
10945
|
Transforms.setNodes(editor, { isCollapsed: false }, { at: path });
|
|
10950
10946
|
});
|
|
10951
10947
|
const isEmptyParagraph = isEmptyParagraphElement(editor, editor.children[index]);
|
|
@@ -10956,10 +10952,13 @@ const withHeading = (editor) => {
|
|
|
10956
10952
|
Transforms.insertNodes(editor, createEmptyParagraph(), { at: [index + 1] });
|
|
10957
10953
|
Transforms.select(editor, [index + 1]);
|
|
10958
10954
|
}
|
|
10955
|
+
AngularEditor.focus(editor);
|
|
10959
10956
|
}
|
|
10960
10957
|
}
|
|
10958
|
+
return;
|
|
10961
10959
|
}
|
|
10962
10960
|
}
|
|
10961
|
+
mousedown(event);
|
|
10963
10962
|
};
|
|
10964
10963
|
return editor;
|
|
10965
10964
|
};
|