diff --git a/locales/en/main.json b/locales/en/main.json index be1d093..a6a5bec 100644 --- a/locales/en/main.json +++ b/locales/en/main.json @@ -4,6 +4,7 @@ "Tag Source": "Tag Source", "Autocompletion": "Autocompletion", "Related Tags": "Related Tags", - "Display": "Display" + "Display": "Display", + "AutoFormatter": "AutoFormatter" } } \ No newline at end of file diff --git a/locales/en/settings.json b/locales/en/settings.json index 49597ba..f7ea594 100644 --- a/locales/en/settings.json +++ b/locales/en/settings.json @@ -79,6 +79,10 @@ "manual": "Manual" } }, + "AutocompletePlus_AutoFormatter_UseTrailingComma": { + "name": "Use Trailing Comma", + "tooltip": "When enabled, ensures all lines end with a trailing comma.\nWhen disabled, removes trailing commas." + }, "AutocompletePlus_AutoFormatter_EnableAutoFormat": { "name": "Enable Auto Format" } diff --git a/locales/ja/main.json b/locales/ja/main.json index f81e15d..71210ea 100644 --- a/locales/ja/main.json +++ b/locales/ja/main.json @@ -4,6 +4,7 @@ "Tag Source": "タグソース", "Autocompletion": "オートコンプリート", "Related Tags": "関連タグ", - "Display": "表示" + "Display": "表示", + "AutoFormatter": "自動フォーマット" } } \ No newline at end of file diff --git a/locales/zh-TW/main.json b/locales/zh-TW/main.json index 10d1af3..6e64796 100644 --- a/locales/zh-TW/main.json +++ b/locales/zh-TW/main.json @@ -4,6 +4,7 @@ "Tag Source": "標籤來源", "Autocompletion": "自動完成", "Related Tags": "相關標籤", - "Display": "顯示" + "Display": "顯示", + "AutoFormatter": "自動格式化" } } \ No newline at end of file diff --git a/locales/zh-TW/settings.json b/locales/zh-TW/settings.json index 5f18774..b0d930c 100644 --- a/locales/zh-TW/settings.json +++ b/locales/zh-TW/settings.json @@ -79,6 +79,10 @@ "manual": "手動" } }, + "AutocompletePlus_AutoFormatter_UseTrailingComma": { + "name": "在行末添加逗號", + "tooltip": "啟用時,確保所有行都以逗號結尾。\n停用時,移除結尾逗號。" + }, "AutocompletePlus_AutoFormatter_EnableAutoFormat": { "name": "啟用自動格式化" } diff --git a/locales/zh/main.json b/locales/zh/main.json index 03a1abc..b77a390 100644 --- a/locales/zh/main.json +++ b/locales/zh/main.json @@ -4,6 +4,7 @@ "Tag Source": "标签来源", "Autocompletion": "自动完成", "Related Tags": "相关标签", - "Display": "显示" + "Display": "显示", + "AutoFormatter": "自动格式化" } } \ No newline at end of file diff --git a/locales/zh/settings.json b/locales/zh/settings.json index e9b9b58..7cb56b7 100644 --- a/locales/zh/settings.json +++ b/locales/zh/settings.json @@ -79,6 +79,10 @@ "manual": "手动" } }, + "AutocompletePlus_AutoFormatter_UseTrailingComma": { + "name": "在行末添加逗号", + "tooltip": "启用时,确保所有行都以逗号结尾。\n禁用时,移除结尾逗号。" + }, "AutocompletePlus_AutoFormatter_EnableAutoFormat": { "name": "启用自动格式化" } diff --git a/pyproject.toml b/pyproject.toml index b068ca9..fd49b04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-autocomplete-plus" description = "Autocomplete and Related Tag display for ComfyUI" -version = "1.7.2" +version = "1.8.0" license = {file = "LICENSE"} dependencies = ["",] diff --git a/web/js/auto-formatter.js b/web/js/auto-formatter.js index a47fc01..44dca74 100644 --- a/web/js/auto-formatter.js +++ b/web/js/auto-formatter.js @@ -100,8 +100,8 @@ export function formatPromptText(text) { // Rejoin cleaned tags with ", " let formattedLine = cleanedTags.join(', '); - // Add a trailing comma and space if the line contains valid tags - if (formattedLine.length > 0) { + // Add a trailing comma and space if the setting is enabled and line contains valid tags + if (formattedLine.length > 0 && settingValues.useTrailingComma) { formattedLine += ', '; } diff --git a/web/js/main.js b/web/js/main.js index ad444a6..3d49c86 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -490,6 +490,17 @@ app.registerExtension({ }, // --- Auto format settings --- + { + id: id + '.AutoFormatter.UseTrailingComma', + name: 'Use Trailing Comma', + tooltip: 'When enabled, ensures all lines end with a trailing comma.\nWhen disabled, removes trailing commas.', + type: 'boolean', + defaultValue: false, + category: [name, 'AutoFormatter', 'Use Trailing Comma'], + onChange: (newVal, oldVal) => { + settingValues.useTrailingComma = newVal; + }, + }, { id: id + '.AutoFormatter.Trigger', name: 'Auto Format Trigger', diff --git a/web/js/settings.js b/web/js/settings.js index 0cbc7b3..d02830f 100644 --- a/web/js/settings.js +++ b/web/js/settings.js @@ -24,6 +24,7 @@ export const settingValues = { // Auto format settings enableAutoFormat: true, autoFormatTrigger: 'auto', // Options: 'auto' (format on blur + shortcut), 'manual' (shortcut only) + useTrailingComma: false, // Whether to add comma at the end of each line // Internal logic settings