From ef29711243e367ba8802c5f2d1900a34160fc7b6 Mon Sep 17 00:00:00 2001 From: zombieyang Date: Mon, 12 May 2025 20:36:50 +0800 Subject: [PATCH] logs and new promote --- package.json | 2 + plugins/photoshop/css/styles.css | 47 ++-------- plugins/photoshop/index.html | 8 +- plugins/photoshop/promote.html | 94 +++++++++++++++++++ plugins/photoshop/run.js | 2 +- plugins/photoshop/sdppp.html | 6 -- plugins/photoshop/sdpppX.js | 1 + typescripts/modules/photoshop-internal | 2 +- typescripts/modules/photoshop/src/entry.tsx | 33 ------- typescripts/modules/photoshop/src/index.d.ts | 1 + .../modules/photoshop/src/tsx/Content.tsx | 5 +- 11 files changed, 116 insertions(+), 85 deletions(-) create mode 100644 plugins/photoshop/promote.html delete mode 100644 plugins/photoshop/sdppp.html diff --git a/package.json b/package.json index 11911e3..3d2d094 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,10 @@ "zustand": "^5.0.4" }, "dependencies": { + "@types/debug": "^4.1.12", "antd": "^5.24.7", "chai": "^5.1.2", + "debug": "^4.4.0", "fast-json-patch": "^3.1.1", "jimp": "^1.6.0", "mocha": "^11.0.1", diff --git a/plugins/photoshop/css/styles.css b/plugins/photoshop/css/styles.css index f9ae235..05a9ab3 100644 --- a/plugins/photoshop/css/styles.css +++ b/plugins/photoshop/css/styles.css @@ -153,50 +153,12 @@ sp-progressbar { margin-left: 5px; } -.cloud-promote-bar { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - margin-bottom: 5px; -} - -.cloud-promote-bar-left { - color: var(--uxp-host-text-color-secondary); -} - -.cloud-promote-bar-right { - display: flex; - flex-direction: row; - gap: 8px; -} - -.cloud-promote-bar-right span { - color: var(--uxp-host-text-color-secondary); - display: inline-flex; - align-items: center; - padding: 3px 8px; - border-style: solid; - border-width: 1px; - border-color: var(--uxp-host-border-color); - border-radius: 4px; - position: relative; - margin-right: 5px; - cursor: pointer; -} - -.cloud-promote-bar-right span img { - width: 16px; - height: 16px; - margin-right: 5px; -} - .container { flex-direction: column; display: flex; height: 100%; width: 100%; - padding: 8px; + padding: 0 8px; } .panel-body { @@ -742,4 +704,11 @@ sp-action-button.highlight:hover, .action-button.highlight:hover { justify-content: space-around; width: 100%; padding-bottom: 20px; +} + +.promote-webview { + width: 100%; + height: 30px; + background-color: var(--uxp-host-background-color); + margin-bottom: 4px; } \ No newline at end of file diff --git a/plugins/photoshop/index.html b/plugins/photoshop/index.html index 17e1332..4b8d520 100644 --- a/plugins/photoshop/index.html +++ b/plugins/photoshop/index.html @@ -14,9 +14,11 @@ - + diff --git a/plugins/photoshop/promote.html b/plugins/photoshop/promote.html new file mode 100644 index 0000000..585f4e9 --- /dev/null +++ b/plugins/photoshop/promote.html @@ -0,0 +1,94 @@ + + + + + + + + + +
+ 云端推荐 + + + +
+ + + + \ No newline at end of file diff --git a/plugins/photoshop/run.js b/plugins/photoshop/run.js index cc213d2..3660779 100644 --- a/plugins/photoshop/run.js +++ b/plugins/photoshop/run.js @@ -80,7 +80,7 @@ entrypoints.setup({ enabled: true, checked: false, oninvoke: () => { - const logs = globalThis.sdppp.getLogs(); + const logs = globalThis.sdpppX.getLogs(); alert(JSON.stringify(logs)); } } diff --git a/plugins/photoshop/sdppp.html b/plugins/photoshop/sdppp.html deleted file mode 100644 index e73f0ac..0000000 --- a/plugins/photoshop/sdppp.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - sdppp! - - \ No newline at end of file diff --git a/plugins/photoshop/sdpppX.js b/plugins/photoshop/sdpppX.js index eb7dcc6..e2c2c28 100644 --- a/plugins/photoshop/sdpppX.js +++ b/plugins/photoshop/sdpppX.js @@ -1,2 +1,3 @@ global.sdpppX = { + "MU": 1 } \ No newline at end of file diff --git a/typescripts/modules/photoshop-internal b/typescripts/modules/photoshop-internal index 42e68c0..469e7cd 160000 --- a/typescripts/modules/photoshop-internal +++ b/typescripts/modules/photoshop-internal @@ -1 +1 @@ -Subproject commit 42e68c0697d23ccd89db800eca2fedb702363408 +Subproject commit 469e7cd5e8f6179104a77c4eb550b467f4dde964 diff --git a/typescripts/modules/photoshop/src/entry.tsx b/typescripts/modules/photoshop/src/entry.tsx index 734f0d9..2129903 100644 --- a/typescripts/modules/photoshop/src/entry.tsx +++ b/typescripts/modules/photoshop/src/entry.tsx @@ -6,36 +6,3 @@ globalThis.sdppp = globalThis.sdppp || {}; globalThis.sdppp.renderPhotoshopPlugin = (rootElement: HTMLElement) => { createRoot(rootElement).render(
); } - -const logs: any[] = []; -const warningLogs: any[] = []; -const errorLogs: any[] = []; -globalThis.sdppp.getLogs = () => { - return { - logs, - warningLogs, - errorLogs - } -} -globalThis.sdppp.enableLogCapture = () => { - console.log = (function(log) { - return function(...args: any[]) { - log(...args); - logs.push(args); - } - })(console.log); - - console.warn = (function(log) { - return function(...args: any[]) { - log(...args); - warningLogs.push(args); - } - })(console.warn); - - console.error = (function(log) { - return function(...args: any[]) { - log(...args); - errorLogs.push(args); - } - })(console.error); -} \ No newline at end of file diff --git a/typescripts/modules/photoshop/src/index.d.ts b/typescripts/modules/photoshop/src/index.d.ts index bfa0a98..56f855f 100644 --- a/typescripts/modules/photoshop/src/index.d.ts +++ b/typescripts/modules/photoshop/src/index.d.ts @@ -96,6 +96,7 @@ declare module "SDPPPInternal" { ) => React.ReactNode }) export function Promote(): JSX.Element; + export function Auths(): JSX.Element; export type AddressBarType = () => JSX.Element; export type WorkflowEditPhotoshopType = () => JSX.Element; diff --git a/typescripts/modules/photoshop/src/tsx/Content.tsx b/typescripts/modules/photoshop/src/tsx/Content.tsx index 651290d..687ad9b 100644 --- a/typescripts/modules/photoshop/src/tsx/Content.tsx +++ b/typescripts/modules/photoshop/src/tsx/Content.tsx @@ -1,4 +1,4 @@ -import { useSDPPPContext, Promote } from "./SDPPPInternalBridge.js"; +import { useSDPPPContext, Promote, Auths } from "./SDPPPInternalBridge.js"; import i18n, { isValidI18nKey } from "../../../../src/common/i18n.mjs"; import WebPageList from "./WebPageList.js"; import WorkflowList from "./WorkflowList.js"; @@ -56,6 +56,7 @@ export function Content({ }, [connectState]); return ( <> +
{ !editorMode ? @@ -81,7 +82,7 @@ export function Content({ ) : '' } - +