From f4a4b7e4151da9f39e59ac0ebf4b1381349813bb Mon Sep 17 00:00:00 2001 From: Jonas Date: Fri, 13 Sep 2024 13:55:42 +0200 Subject: [PATCH] feat(menu): Put list items in submenu, add indention options Fixes: #2438 Contributes to: #2836 Signed-off-by: Jonas --- cypress/e2e/workspace.spec.js | 16 +++- src/components/Menu/ActionListItem.vue | 3 +- src/components/Menu/ActionSingle.vue | 2 +- src/components/Menu/BaseActionEntry.js | 5 ++ src/components/Menu/entries.js | 107 ++++++++++++++++++------- src/components/Menu/utils.js | 2 +- src/components/icons.js | 4 + src/extensions/RichText.js | 2 +- src/nodes/BulletList.js | 3 + src/nodes/OrderedList.js | 19 +++++ src/nodes/TaskList.js | 3 + 11 files changed, 130 insertions(+), 36 deletions(-) create mode 100644 src/nodes/OrderedList.js diff --git a/cypress/e2e/workspace.spec.js b/cypress/e2e/workspace.spec.js index ca57890d033..f60d94c21f8 100644 --- a/cypress/e2e/workspace.spec.js +++ b/cypress/e2e/workspace.spec.js @@ -104,7 +104,7 @@ describe('Workspace', function() { }) }) - it('creates lists', function() { + it.only('creates lists', function() { cy.visitTestFolder() cy.openWorkspace().type('List me') cy.getContent().type('{selectall}') @@ -112,7 +112,7 @@ describe('Workspace', function() { ['unordered-list', 'ul'], ['ordered-list', 'ol'], ['task-list', 'ul.contains-task-list'], - ].forEach(([button, tag]) => testButton(button, tag, 'List me')) + ].forEach(([button, tag]) => testListButton(button, tag, 'List me')) }) it('takes README.md into account', function() { @@ -301,6 +301,18 @@ const openSidebar = filename => { cy.get('.app-sidebar-header').should('contain', filename) } +function testListButton(button, tag, content) { + cy.getSubmenuEntry('lists', button) + .should('not.have.class', 'is-active') + .click() + cy.getContent() + .find(`${tag}`) + .should('contain', content) + cy.getSubmenuEntry('lists', button) + .should('have.class', 'is-active') + .click() +} + /** * * @param {string} button Name of the button to click. diff --git a/src/components/Menu/ActionListItem.vue b/src/components/Menu/ActionListItem.vue index 9f994f0da04..97fc38c079f 100644 --- a/src/components/Menu/ActionListItem.vue +++ b/src/components/Menu/ActionListItem.vue @@ -5,6 +5,7 @@