refactor(creator-studio): move taxonomy to the settings card, slim the drawer to pay

Classification belongs next to everything else the author decides before
publishing, and the drawer should only configure paid resources.

- PublishSettings now renders categories, tags and custom taxonomy
  dimensions first, then cover, paid content and scheduling. Chips use a
  stacked row layout so long category lists wrap naturally.
- PublishDrawer keeps only PayPanel: taxonomy, save/publish buttons and the
  now-unused props are gone, leaving a single 完成 button.
- New PublishDialog takes over the publish action from the bottom bar, and
  with it the captcha mount point, so the gate still renders somewhere the
  author can see it.
- Promotes .jio-creator-primary / .jio-creator-ghost out of the dialog-only
  rules (drawer and pay panel buttons had no styling), and drops the dead
  .jio-creator-field / .jio-creator-cover blocks.

Contracts updated; 886 widget-system tests pass.
This commit is contained in:
kate522 committed 2026-11-09 15:47:02 +08:00
1 parent ac84e991d1
commit f97fd72bd0
11 files changed
+448 -322

No files matched your search

+28 -22
View File
@@ -12,6 +12,7 @@ import { __, sprintf } from '@wordpress/i18n';
import { apiPost } from './services/api';
import { PublishDrawer } from './panels/publish-drawer';
import { PublishDialog } from './components/publish-dialog';
import { EditorToolbar } from './components/editor-toolbar';
import { PublishSettings } from './components/publish-settings';
import { StudioMasthead } from './components/studio-masthead';
@@ -90,7 +91,7 @@ function Studio(): JSX.Element {
at: '',
}));
const [drawerOpen, setDrawerOpen] = useState(false);
const [drawerFocusPay, setDrawerFocusPay] = useState(false);
const [publishOpen, setPublishOpen] = useState(false);
const [blockDialog, setBlockDialog] = useState<BlockDialogKind | null>(null);
const [notice, setNotice] = useState<{ tone: 'ok' | 'error'; text: string } | null>(null);
const [recovery, setRecovery] = useState<null | { savedAt: string }>(null);
@@ -274,6 +275,7 @@ function Studio(): JSX.Element {
dirtyRef.current = false;
setSaveState({ state: 'submitted', at: '' });
setNotice({ tone: 'ok', text: String(response.message || __('已提交', 'jio')) });
setPublishOpen(false);
setDrawerOpen(false);
const target = response.url || response.goto || bootstrap.urls?.center;
if (target) {
@@ -768,13 +770,21 @@ function Studio(): JSX.Element {
scheduleAt={draft.schedule.at}
pay={draft.pay}
canPay={!!capabilities.canPay}
taxonomy={{
categories: (bootstrap.categories && bootstrap.categories.items) || [],
tags: !!bootstrap.tags?.enabled,
customDefs: bootstrap.customDefs || [],
}}
categories={draft.categories}
tags={draft.tags}
custom={draft.custom}
onFeaturedChange={(featured) => patchDraft({ featured })}
onScheduleChange={(enabled, at) => patchDraft({ schedule: { enabled, at } })}
onPayEnabledChange={(enabled) => patchDraft({ pay: { ...draftRef.current.pay, enabled } })}
onOpenPaySettings={() => {
setDrawerFocusPay(true);
setDrawerOpen(true);
}}
onCategoriesChange={(categories) => patchDraft({ categories })}
onTagsChange={(tags) => patchDraft({ tags })}
onCustomChange={(custom) => patchDraft({ custom })}
onOpenPaySettings={() => setDrawerOpen(true)}
/>
{blockDialog && (
@@ -792,10 +802,7 @@ function Studio(): JSX.Element {
saving={!editorReady || saveState.state === 'saving' || saveState.state === 'submitting'}
onSaveDraft={() => void save(false)}
onPreview={() => void preview()}
onPublish={() => {
setDrawerFocusPay(false);
setDrawerOpen(true);
}}
onPublish={() => setPublishOpen(true)}
/>
{drawerOpen && (
@@ -803,24 +810,23 @@ function Studio(): JSX.Element {
draft={draft}
setDraft={patchDraft}
capabilities={capabilities}
limits={limits}
taxonomy={{
categories: (bootstrap.categories && bootstrap.categories.items) || [],
tags: !!bootstrap.tags?.enabled,
customDefs: bootstrap.customDefs || [],
}}
isPublishedEdit={isPublishedEdit}
focusPay={drawerFocusPay}
onClose={() => {
setDrawerOpen(false);
setDrawerFocusPay(false);
}}
onSaveDraft={() => void save(false)}
onSubmit={(publishNow: boolean) => void submit(publishNow)}
onClose={() => setDrawerOpen(false)}
privateStorage={!!bootstrap.privateStorage}
privateUploads={bootstrap.privateUploads || []}
/>
)}
{publishOpen && (
<PublishDialog
canPublishNow={!!capabilities.canPublishNow}
isPublishedEdit={isPublishedEdit}
captcha={!!bootstrap.captcha?.enabled}
saving={saveState.state === 'saving' || saveState.state === 'submitting'}
canSubmit={(draft.title || '').trim().length >= Number(limits.titleMin || 1)}
onClose={() => setPublishOpen(false)}
onSaveDraft={() => void save(false)}
onSubmit={(publishNow: boolean) => void submit(publishNow)}
/>
)}
</div>