refactor: auto formatting and reorder

This commit is contained in:
newtextdoc1111
2025-05-08 17:14:06 +09:00
parent 05cb745abd
commit 6536ccaef1
+12 -11
View File
@@ -77,8 +77,8 @@ class RelatedTagsUI {
// Make visible
this.root.style.display = 'block';
if(!autoCompleteData.cooccurrenceLoaded) {
if(this.autoRefreshTimerId){
if (!autoCompleteData.cooccurrenceLoaded) {
if (this.autoRefreshTimerId) {
clearTimeout(this.autoRefreshTimerId);
}
this.autoRefreshTimerId = setTimeout(() => {
@@ -91,7 +91,7 @@ class RelatedTagsUI {
* Hides the related tags UI.
*/
hide() {
if(this.autoRefreshTimerId){
if (this.autoRefreshTimerId) {
clearTimeout(this.autoRefreshTimerId);
}
this.root.style.display = 'none';
@@ -552,11 +552,6 @@ function findAllTagPositions(text) {
return positions;
}
// --- Main Exports ---
// Create a singleton instance
const relatedTagsUI = new RelatedTagsUI();
// Helper function to show related tags based on cursor position
function showRelatedTagsForCurrentPosition(textareaElement) {
// Get the tag at current cursor position
@@ -575,6 +570,12 @@ function showRelatedTagsForCurrentPosition(textareaElement) {
relatedTagsUI.show(textareaElement, currentTag, relatedTagsResults);
}
// --- Main Exports ---
// Create a singleton instance
const relatedTagsUI = new RelatedTagsUI();
export class RelatedTagsEventHandler {
constructor() {
@@ -641,7 +642,7 @@ export class RelatedTagsEventHandler {
// Show related tags on Ctrl+Space
if (settingValues.enableRelatedTags) {
if (event.key === ' ' && event.ctrlKey && event.shiftKey ) {
if (event.key === ' ' && event.ctrlKey && event.shiftKey) {
event.preventDefault();
showRelatedTagsForCurrentPosition(textareaElement);
}
@@ -652,10 +653,10 @@ export class RelatedTagsEventHandler {
*
* @param {KeyboardEvent} event
*/
handleKeyUp(event){
handleKeyUp(event) {
}
/**
*
* @param {MouseEvent} event