fix(editor): polish project picker and scene description UX

Validate unique campaign names, add search, flip menus at scroll end, drop TipTap links, and scroll long description previews.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-07-15 19:04:02 +08:00
parent 8d73f7744e
commit 195d4be086
4 changed files with 56 additions and 37 deletions
+1 -28
View File
@@ -61,14 +61,7 @@ export function SceneDescriptionModal({ initialHtml, onClose, onSave }: SceneDes
StarterKit.configure({
heading: { levels: [2, 3] },
codeBlock: false,
link: {
openOnClick: false,
autolink: true,
HTMLAttributes: {
rel: 'noopener noreferrer',
target: '_blank',
},
},
link: false,
}),
Placeholder.configure({
placeholder: t('scene.descriptionPlaceholder'),
@@ -109,7 +102,6 @@ export function SceneDescriptionModal({ initialHtml, onClose, onSave }: SceneDes
h2: ed.isActive('heading', { level: 2 }),
h3: ed.isActive('heading', { level: 3 }),
blockquote: ed.isActive('blockquote'),
canLink: ed.isEditable,
}),
});
@@ -117,18 +109,6 @@ export function SceneDescriptionModal({ initialHtml, onClose, onSave }: SceneDes
onSave(normalizeSceneDescriptionHtml(editor.getHTML()));
};
const setLink = () => {
const prev = editor.getAttributes('link').href as string | undefined;
const next = window.prompt(t('scene.descriptionLinkPrompt'), prev ?? 'https://');
if (next === null) return;
const trimmed = next.trim();
if (trimmed === '') {
editor.chain().focus().extendMarkRange('link').unsetLink().run();
return;
}
editor.chain().focus().extendMarkRange('link').setLink({ href: trimmed }).run();
};
return createPortal(
<>
<button
@@ -215,13 +195,6 @@ export function SceneDescriptionModal({ initialHtml, onClose, onSave }: SceneDes
>
<ToolbarIcon path="M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1V14h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z" />
</ToolButton>
<ToolButton
title={t('scene.descriptionLink')}
disabled={!toolbarState.canLink}
onClick={setLink}
>
<ToolbarIcon path="M3.9 12a5 5 0 0 1 5-5h4v2h-4a3 3 0 1 0 0 6h4v2h-4a5 5 0 0 1-5-5zm7-1h6v2h-6v-2zm5-4h-4v2h4a3 3 0 1 1 0 6h-4v2h4a5 5 0 0 0 0-10z" />
</ToolButton>
</div>
</div>
<div className={modalStyles.editorContent}>