From 0576d4562873d7aaa6ab768c7c9dae524a7a9b00 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 | 20 ++++- 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, 134 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..bfb4c793c5d 100644 --- a/cypress/e2e/workspace.spec.js +++ b/cypress/e2e/workspace.spec.js @@ -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() { @@ -302,7 +302,23 @@ const openSidebar = filename => { } /** - * + * @param {string} button Name of the button to click. + * @param {string} tag Html tag expected to be toggled. + * @param {string} content Content expected in the element. + */ +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. * @param {string} tag Html tag expected to be toggled. * @param {string} content Content expected in the element. 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 @@