From f09735895225333742195cae2efbfe6dde06c61f Mon Sep 17 00:00:00 2001 From: grnd-alt Date: Mon, 19 Oct 2026 12:21:45 +0200 Subject: [PATCH] fix(description): use non-collaborative Text editor for cards without an id Assisted-by: ClaudeCode:claude-sonnet-5-5 Signed-off-by: grnd-alt --- cypress/e2e/cardFeatures.js | 5 ++-- src/components/card/Description.vue | 37 ++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/cardFeatures.js b/cypress/e2e/cardFeatures.js index 94f59ecdb..1fa0209ad 100644 --- a/cypress/e2e/cardFeatures.js +++ b/cypress/e2e/cardFeatures.js @@ -276,6 +276,7 @@ describe('Card', function () { cy.get('.modal__card .ProseMirror h1').contains('Hello world').should('be.visible') cy.get('.modal__card .ProseMirror h1') .click() + .parent() .type(' writing more text{enter}- List item{enter}with entries{enter}{enter}Paragraph') cy.wait('@save', { timeout: 7000 }) @@ -284,7 +285,7 @@ describe('Card', function () { // Scroll to the bottom to ensure all content is loaded and visible cy.get('.modal__card .app-sidebar-tabs, .modal__card .app-sidebar__tab--active').first().scrollTo('bottom', { ensureScrollable: false }) - cy.contains('.modal__card .ProseMirror p', 'Paragraph').scrollIntoView().should('be.visible') + cy.contains('.modal__card .ProseMirror p', 'Paragraph').should('be.visible') cy.get('.modal__card .ProseMirror h1').contains('Hello world writing more text').should('be.visible') cy.get('.modal__card .ProseMirror li').eq(0).contains('List item').should('be.visible') @@ -298,7 +299,7 @@ describe('Card', function () { cy.get('.card:contains("Hello world")').should('be.visible').click() cy.get('.modal__card').should('be.visible') cy.get('.modal__card .ProseMirror h1') - .click() + .click().parent() .type('{enter}/create') cy.get('.suggestion-list__item.is-selected').should('be.visible').contains('Create a new deck card') cy.get('.suggestion-list__item.is-selected .link-picker__item').click() diff --git a/src/components/card/Description.vue b/src/components/card/Description.vue index 01f4c3f88..6ae925292 100644 --- a/src/components/card/Description.vue +++ b/src/components/card/Description.vue @@ -7,8 +7,8 @@
{{ t('deck', 'Description') }} - {{ t('deck', '(Unsaved)') }} - {{ t('deck', '(Saving…)') }} + {{ t('deck', '(Unsaved)') }} + {{ t('deck', '(Saving…)') }} { const url = OC.MimeType.getIconUrl(mimetype) @@ -177,7 +183,7 @@ export default { }, watch: { card(newCard) { - if (this.textAppAvailable) { + if (this.collaborative) { return } if (newCard.description !== this.descriptionOld) { @@ -191,6 +197,10 @@ export default { }, }, mounted() { + if (!this.collaborative) { + this.descriptionOld = this.card.description + this.description = this.card.description + } if (this.textAppAvailable) { this.setupEditor() } @@ -205,16 +215,31 @@ export default { ...mapActions(useSettingsStore, ['setHasCardSaveError']), async setupEditor() { await this.destroyEditor() - this.editor = await window.OCA.Text.createCollaborativeEditor({ - context: { type: 'deck_card', id: this.card.id }, + if (this.collaborative) { + this.editor = await window.OCA.Text.createCollaborativeEditor({ + context: { type: 'deck_card', id: this.card.id }, + el: this.$refs.editor, + readOnly: !this.canEdit, + }) + return + } + this.editor = await window.OCA.Text.createMarkdownContentEditor({ el: this.$refs.editor, + content: this.card.description, readOnly: !this.canEdit, + onUpdate: ({ markdown }) => { + if (this.description === markdown) { + return + } + this.description = markdown + this.updateDescription() + }, }) }, async destroyEditor() { clearTimeout(this.descriptionSaveTimeout) - if (!this.textAppAvailable) { + if (!this.collaborative) { await this.saveDescription() } try {