Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
style(ckeditor): add word wrap to message preview
Elian Doran89526914d035
diff --git a/packages/ckeditor5/src/plugins/ai_assistant/ai_assistant_form.spec.ts b/packages/ckeditor5/src/plugins/ai_assistant/ai_assistant_form.spec.tsindex d17b077fed..3f49981550 100644--- a/packages/ckeditor5/src/plugins/ai_assistant/ai_assistant_form.spec.ts+++ b/packages/ckeditor5/src/plugins/ai_assistant/ai_assistant_form.spec.ts@@ -25,6 +25,8 @@ describe("AiAssistantFormView", () => {expect(form.phase).toBe("prompt");expect(form.resultToggleView.isVisible).toBe(false);expect(form.changesToggleView.isVisible).toBe(false);+ // Without the reset exemption, the balloon's `.ck-reset_all` nowraps every paragraph.+ expect(form.previewView.element?.classList.contains("ck-reset_all-excluded")).toBe(true);});it("streams into the preview and always shows the raw result while streaming", () => {diff --git a/packages/ckeditor5/src/plugins/ai_assistant/ai_assistant_form.ts b/packages/ckeditor5/src/plugins/ai_assistant/ai_assistant_form.tsindex 137827d23b..4fdcd8a542 100644--- a/packages/ckeditor5/src/plugins/ai_assistant/ai_assistant_form.ts+++ b/packages/ckeditor5/src/plugins/ai_assistant/ai_assistant_form.ts@@ -323,6 +323,11 @@ class AiPreviewView extends View {"ck","ck-ai-assistant-form__preview","ck-content",+ // Exempt the preview subtree from CKEditor's UI reset — inside the balloon,+ // `.ck-reset_all` otherwise forces `white-space: nowrap` (plus zeroed margins+ // and the UI font) onto the content, making every paragraph one long+ // unwrappable line.+ "ck-reset_all-excluded",bind.if("isVisible", "ck-hidden", (isVisible) => !isVisible)]}diff --git a/packages/ckeditor5/src/plugins/ai_assistant/theme/ai_assistant.css b/packages/ckeditor5/src/plugins/ai_assistant/theme/ai_assistant.cssindex e938047a63..167d212825 100644--- a/packages/ckeditor5/src/plugins/ai_assistant/theme/ai_assistant.css+++ b/packages/ckeditor5/src/plugins/ai_assistant/theme/ai_assistant.css@@ -38,6 +38,11 @@border-radius: var(--ck-border-radius);padding: var(--ck-spacing-medium);background: var(--ck-color-base-background);+ white-space: pre-wrap;++ p:last-child {+ margin-bottom: 0;+ }}/* An empty preview is just a hollow frame — collapse it until the first chunk arrives. */