mirror of
https://github.com/suitenumerique/docs.git
synced 2026-08-31 04:09:43 +02:00
🔥(frontend) remove copy as markown from document options
We have removed the "Copy as Markdown" option from the document options menu. If user need to copy the document content as markdown, they can just copy the content from the document editor and paste it into a markdown editor.
This commit is contained in:
@@ -480,46 +480,6 @@ test.describe('Doc Header', () => {
|
||||
).toBeHidden();
|
||||
});
|
||||
|
||||
test('It checks the copy as Markdown button', async ({
|
||||
page,
|
||||
browserName,
|
||||
}) => {
|
||||
test.skip(
|
||||
browserName === 'webkit',
|
||||
'navigator.clipboard is not working with webkit and playwright',
|
||||
);
|
||||
|
||||
// create page and navigate to it
|
||||
await page
|
||||
.getByRole('link', {
|
||||
name: 'New',
|
||||
exact: true,
|
||||
})
|
||||
.click();
|
||||
|
||||
// Add dummy content to the doc
|
||||
const editor = page.locator('.ProseMirror');
|
||||
const docFirstBlock = editor.locator('.bn-block-content').first();
|
||||
await docFirstBlock.click();
|
||||
await page.keyboard.type('# Hello World', { delay: 100 });
|
||||
const docFirstBlockContent = docFirstBlock.locator('h1');
|
||||
await expect(docFirstBlockContent).toHaveText('Hello World');
|
||||
|
||||
// Copy content to clipboard
|
||||
await page.getByLabel('Open the document options').click();
|
||||
await page.getByRole('menuitem', { name: 'Copy as Markdown' }).click();
|
||||
await expect(
|
||||
page.getByText('Copied as Markdown to clipboard'),
|
||||
).toBeVisible();
|
||||
|
||||
// Test that clipboard is in Markdown format
|
||||
const handle = await page.evaluateHandle(() =>
|
||||
navigator.clipboard.readText(),
|
||||
);
|
||||
const clipboardContent = await handle.jsonValue();
|
||||
expect(clipboardContent.trim()).toBe('# Hello World');
|
||||
});
|
||||
|
||||
test('it checks the copy link button', async ({ page, browserName }) => {
|
||||
test.skip(
|
||||
browserName === 'webkit',
|
||||
|
||||
@@ -19,7 +19,6 @@ import HistorySVG from '@/assets/icons/ui-kit/history.svg';
|
||||
import KeepSVG from '@/assets/icons/ui-kit/keep.svg';
|
||||
import KeepOffSVG from '@/assets/icons/ui-kit/keep_off.svg';
|
||||
import LeaveSVG from '@/assets/icons/ui-kit/leave.svg';
|
||||
import MarkdownCopySVG from '@/assets/icons/ui-kit/markdown_copy.svg';
|
||||
import MoreSVG from '@/assets/icons/ui-kit/more_horiz.svg';
|
||||
import {
|
||||
Doc,
|
||||
@@ -36,8 +35,6 @@ import { usePresenterStore } from '@/docs/doc-presenter/stores';
|
||||
import { useAuth } from '@/features/auth';
|
||||
import { useFocusStore, useResponsiveStore } from '@/stores';
|
||||
|
||||
import { useCopyCurrentEditorToClipboard } from '../hooks/useCopyCurrentEditorToClipboard';
|
||||
|
||||
const ModalRemoveDoc = dynamic(
|
||||
() =>
|
||||
import('@/docs/doc-management/components/ModalRemoveDoc').then((mod) => ({
|
||||
@@ -94,7 +91,6 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
|
||||
const { isTopRoot } = useDocUtils(doc);
|
||||
const isTopParent = doc.id === treeContext?.root?.id; // it can be a child but not for the current user
|
||||
const { authenticated } = useAuth();
|
||||
const copyCurrentEditorToClipboard = useCopyCurrentEditorToClipboard();
|
||||
const [openDropdown, setOpenDropdown] = useState(false);
|
||||
const [isModalRemoveOpen, setIsModalRemoveOpen] = useState(false);
|
||||
const [isModalExportOpen, setIsModalExportOpen] = useState(false);
|
||||
@@ -169,14 +165,6 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
|
||||
},
|
||||
isHidden: !ModalExport,
|
||||
},
|
||||
{
|
||||
label: t('Copy as {{format}}', { format: 'Markdown' }),
|
||||
icon: <MarkdownCopySVG width={24} height={24} aria-hidden="true" />,
|
||||
callback: () => {
|
||||
void copyCurrentEditorToClipboard('markdown');
|
||||
},
|
||||
showSeparator: isMobile || !doc.abilities.versions_list,
|
||||
},
|
||||
{
|
||||
label: t('Version history'),
|
||||
icon: <HistorySVG width={24} height={24} aria-hidden="true" />,
|
||||
|
||||
Reference in New Issue
Block a user