feat: add button to create Markdown table (#5589)
This adds a new button to the Markdown toolbar, which allows creating the structure of a Markdown table. This makes it easier to wok with tables, as creating the structure by hand is annoying. Screenshots: https://codeberg.org/attachments/8bb00059-caa7-4453-b26c-15e4b7b93c83 https://codeberg.org/attachments/581e695c-33eb-4b81-9c63-a944aab443d9 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5589 Reviewed-by: Otto <otto@codeberg.org> Co-authored-by: JakobDev <jakobdev@gmx.de> Co-committed-by: JakobDev <jakobdev@gmx.de>
This commit is contained in:
parent
e5e2860221
commit
4615891b9d
4 changed files with 107 additions and 3 deletions
|
@ -3,6 +3,7 @@
|
|||
// @watch start
|
||||
// web_src/js/features/comp/ComboMarkdownEditor.js
|
||||
// web_src/css/editor/combomarkdowneditor.css
|
||||
// templates/shared/combomarkdowneditor.tmpl
|
||||
// @watch end
|
||||
|
||||
import {expect} from '@playwright/test';
|
||||
|
@ -181,3 +182,27 @@ test('markdown list continuation', async ({browser}, workerInfo) => {
|
|||
await expect(textarea).toHaveValue(`${prefix}one\n${prefix}two`);
|
||||
}
|
||||
});
|
||||
|
||||
test('markdown insert table', async ({browser}, workerInfo) => {
|
||||
const context = await load_logged_in_context(browser, workerInfo, 'user2');
|
||||
|
||||
const page = await context.newPage();
|
||||
const response = await page.goto('/user2/repo1/issues/new');
|
||||
expect(response?.status()).toBe(200);
|
||||
|
||||
const newTableButton = page.locator('button[data-md-action="new-table"]');
|
||||
await newTableButton.click();
|
||||
|
||||
const newTableModal = page.locator('div[data-markdown-table-modal-id="0"]');
|
||||
await expect(newTableModal).toBeVisible();
|
||||
|
||||
await newTableModal.locator('input[name="table-rows"]').fill('3');
|
||||
await newTableModal.locator('input[name="table-columns"]').fill('2');
|
||||
|
||||
await newTableModal.locator('button[data-selector-name="ok-button"]').click();
|
||||
|
||||
await expect(newTableModal).toBeHidden();
|
||||
|
||||
const textarea = page.locator('textarea[name=content]');
|
||||
await expect(textarea).toHaveValue('| Header | Header |\n|---------|---------|\n| Content | Content |\n| Content | Content |\n| Content | Content |\n');
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue