@lvce-editor/editor-worker 3.2.0 → 3.3.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/dist/editorWorkerMain.js +32 -22
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -6681,6 +6681,24 @@ const editorUnindent = editor => {
|
|
|
6681
6681
|
|
|
6682
6682
|
// editor.lines //?
|
|
6683
6683
|
|
|
6684
|
+
const isCompletionDetailWidget = widget => {
|
|
6685
|
+
return widget.id === CompletionDetail;
|
|
6686
|
+
};
|
|
6687
|
+
const closeDetails = editor => {
|
|
6688
|
+
const {
|
|
6689
|
+
widgets
|
|
6690
|
+
} = editor;
|
|
6691
|
+
const index = widgets.findIndex(isCompletionDetailWidget);
|
|
6692
|
+
if (index === -1) {
|
|
6693
|
+
return editor;
|
|
6694
|
+
}
|
|
6695
|
+
const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
|
|
6696
|
+
return {
|
|
6697
|
+
...editor,
|
|
6698
|
+
widgets: newWidgets
|
|
6699
|
+
};
|
|
6700
|
+
};
|
|
6701
|
+
|
|
6684
6702
|
const getWidgetState = (editor, id) => {
|
|
6685
6703
|
const {
|
|
6686
6704
|
widgets
|
|
@@ -6697,18 +6715,6 @@ const getCompletionState = editor => {
|
|
|
6697
6715
|
return getWidgetState(editor, Completion);
|
|
6698
6716
|
};
|
|
6699
6717
|
|
|
6700
|
-
const closeDetails = editor => {
|
|
6701
|
-
const child = getCompletionState(editor);
|
|
6702
|
-
if (!child) {
|
|
6703
|
-
return editor;
|
|
6704
|
-
}
|
|
6705
|
-
console.log('open details');
|
|
6706
|
-
// TODO when completion details are open, close them
|
|
6707
|
-
// TODO when completion details are opening, close them
|
|
6708
|
-
// TODO when completion details are closed, open them
|
|
6709
|
-
return editor;
|
|
6710
|
-
};
|
|
6711
|
-
|
|
6712
6718
|
const isCompletion$1 = widget => {
|
|
6713
6719
|
return widget.id === Completion;
|
|
6714
6720
|
};
|
|
@@ -6786,6 +6792,15 @@ const getCompletionDetailState = editor => {
|
|
|
6786
6792
|
return getWidgetState(editor, CompletionDetail);
|
|
6787
6793
|
};
|
|
6788
6794
|
|
|
6795
|
+
const getCompletionDetailBounds = (completionBounds, borderSize) => {
|
|
6796
|
+
return {
|
|
6797
|
+
x: completionBounds.x + completionBounds.width - borderSize,
|
|
6798
|
+
y: completionBounds.y,
|
|
6799
|
+
width: 100,
|
|
6800
|
+
height: 100
|
|
6801
|
+
};
|
|
6802
|
+
};
|
|
6803
|
+
|
|
6789
6804
|
const openDetails = editor => {
|
|
6790
6805
|
const child = getCompletionState(editor);
|
|
6791
6806
|
if (!child) {
|
|
@@ -6796,13 +6811,11 @@ const openDetails = editor => {
|
|
|
6796
6811
|
return editor;
|
|
6797
6812
|
}
|
|
6798
6813
|
const widget = create();
|
|
6814
|
+
const borderSize = 1;
|
|
6799
6815
|
const newestState = {
|
|
6800
6816
|
...widget.newState,
|
|
6801
6817
|
content: 'abc',
|
|
6802
|
-
|
|
6803
|
-
y: child.y,
|
|
6804
|
-
width: 100,
|
|
6805
|
-
height: 100
|
|
6818
|
+
...getCompletionDetailBounds(child, borderSize)
|
|
6806
6819
|
};
|
|
6807
6820
|
const latestWidgets = [...editor.widgets, {
|
|
6808
6821
|
...widget,
|
|
@@ -6892,14 +6905,11 @@ const selectCurrent = editor => {
|
|
|
6892
6905
|
};
|
|
6893
6906
|
|
|
6894
6907
|
const toggleDetails = editor => {
|
|
6895
|
-
const child =
|
|
6908
|
+
const child = getCompletionDetailState(editor);
|
|
6896
6909
|
if (!child) {
|
|
6897
|
-
return editor;
|
|
6910
|
+
return openDetails(editor);
|
|
6898
6911
|
}
|
|
6899
|
-
|
|
6900
|
-
// TODO when completion details are opening, close them
|
|
6901
|
-
// TODO when completion details are closed, open them
|
|
6902
|
-
return editor;
|
|
6912
|
+
return closeDetails(editor);
|
|
6903
6913
|
};
|
|
6904
6914
|
|
|
6905
6915
|
const executeHoverProvider = (editor, offset) => {
|