diff --git a/playwright/e2e/history.spec.ts b/playwright/e2e/history.spec.ts new file mode 100644 index 00000000000..64b9da7513d --- /dev/null +++ b/playwright/e2e/history.spec.ts @@ -0,0 +1,27 @@ +/** + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import { expect, mergeTests } from '@playwright/test' +import { test as editorTest } from '../support/fixtures/editor' +import { test as uploadFileTest } from '../support/fixtures/upload-file' + +const test = mergeTests(editorTest, uploadFileTest) + +test.beforeEach(async ({ open }) => { + await open() +}) + +test.describe('Undo manager', () => { + test('Can undo first action in empty document', async ({ editor }) => { + await editor.type('a') + await expect(editor.content).toContainText('a') + + const undoButton = editor.getMenu('Undo') + await expect(undoButton).not.toBeDisabled() + await undoButton.click() + + await expect(editor.content).not.toContainText('a') + }) +}) diff --git a/src/extensions/TextDirection.ts b/src/extensions/TextDirection.ts index 3d86d87da0a..8d16155df91 100644 --- a/src/extensions/TextDirection.ts +++ b/src/extensions/TextDirection.ts @@ -78,8 +78,6 @@ function TextDirectionPlugin({ types }: { types: string[] }) { ) const changes = getChangedRanges(transform) - tr.setMeta('addToHistory', false) - changes.forEach(({ newRange }) => { const nodes = findChildrenInRange(newState.doc, newRange, (node) => types.includes(node.type.name),