mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-07 08:30:06 +00:00
[backport core/1.34] add warning when using legacy mask editor (indicating it will be removed in next version) (#7513)
Backport of #7332 to `core/1.34` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7513-backport-core-1-34-add-warning-when-using-legacy-mask-editor-indicating-it-will-be-rem-2ca6d73d36508154937dd5b12e39ea47) by [Unito](https://www.unito.io) Co-authored-by: Christian Byrne <cbyrne@comfy.org>
This commit is contained in:
@@ -1,13 +1,26 @@
|
||||
import _ from 'es-toolkit/compat'
|
||||
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
||||
|
||||
import { t } from '@/i18n'
|
||||
import { useMaskEditor } from '@/composables/maskeditor/useMaskEditor'
|
||||
import { useToastStore } from '@/platform/updates/common/toastStore'
|
||||
import { app } from '@/scripts/app'
|
||||
import { ComfyApp } from '@/scripts/app'
|
||||
import { useMaskEditorStore } from '@/stores/maskEditorStore'
|
||||
import { useDialogStore } from '@/stores/dialogStore'
|
||||
import { MaskEditorDialogOld } from './maskEditorOld'
|
||||
import { useMaskEditorStore } from '@/stores/maskEditorStore'
|
||||
import { ClipspaceDialog } from './clipspace'
|
||||
import { useMaskEditor } from '@/composables/maskeditor/useMaskEditor'
|
||||
import { MaskEditorDialogOld } from './maskEditorOld'
|
||||
|
||||
const warnLegacyMaskEditorDeprecation = () => {
|
||||
const warningMessage = t('toastMessages.legacyMaskEditorDeprecated')
|
||||
console.warn(`[Comfy.MaskEditor] ${warningMessage}`)
|
||||
useToastStore().add({
|
||||
severity: 'warn',
|
||||
summary: 'Alert',
|
||||
detail: warningMessage,
|
||||
life: 4096
|
||||
})
|
||||
}
|
||||
|
||||
function openMaskEditor(node: LGraphNode): void {
|
||||
if (!node) {
|
||||
@@ -27,6 +40,7 @@ function openMaskEditor(node: LGraphNode): void {
|
||||
if (useNewEditor) {
|
||||
useMaskEditor().openMaskEditor(node)
|
||||
} else {
|
||||
warnLegacyMaskEditorDeprecation()
|
||||
// Use old editor
|
||||
ComfyApp.copyToClipspace(node)
|
||||
// @ts-expect-error clipspace_return_node is an extension property added at runtime
|
||||
@@ -122,6 +136,7 @@ app.registerExtension({
|
||||
'Comfy.MaskEditor.UseNewEditor'
|
||||
)
|
||||
if (!useNewEditor) {
|
||||
warnLegacyMaskEditorDeprecation()
|
||||
const dlg = MaskEditorDialogOld.getInstance() as any
|
||||
if (dlg?.isOpened && !dlg.isOpened()) {
|
||||
dlg.show()
|
||||
|
||||
@@ -1654,6 +1654,7 @@
|
||||
"noTemplatesToExport": "No templates to export",
|
||||
"failedToFetchLogs": "Failed to fetch server logs",
|
||||
"migrateToLitegraphReroute": "Reroute nodes will be removed in future versions. Click to migrate to litegraph-native reroute.",
|
||||
"legacyMaskEditorDeprecated": "The legacy mask editor is deprecated and will be removed soon.",
|
||||
"userNotAuthenticated": "User not authenticated",
|
||||
"failedToFetchBalance": "Failed to fetch balance: {error}",
|
||||
"failedToCreateCustomer": "Failed to create customer: {error}",
|
||||
|
||||
Reference in New Issue
Block a user