Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (Whiteboard): Paste shape #8636

Merged
merged 18 commits into from
Mar 1, 2023
Merged
1 change: 1 addition & 0 deletions e2e-tests/headings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ test('set heading of nested block to auto', async ({ page }) => {

test('view nested block on a dedicated page', async ({ page }) => {
await page.locator('span.bullet-container >> nth=1').click()
await page.waitForTimeout(200)

expect(await page.locator('.ls-block .block-content >> nth=0').innerHTML()).toContain('<h1>bar</h1>')
})
1 change: 1 addition & 0 deletions e2e-tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const IsMac = process.platform === 'darwin'
export const IsLinux = process.platform === 'linux'
export const IsWindows = process.platform === 'win32'
export const IsCI = process.env.CI === 'true'
export const modKey = IsMac ? 'Meta' : 'Control'

export function randomString(length: number) {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
Expand Down
9 changes: 2 additions & 7 deletions e2e-tests/whiteboards.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from '@playwright/test'
import { test } from './fixtures'
import { IsMac } from './utils'
import { modKey } from './utils'

test('enable whiteboards', async ({ page }) => {
await expect(page.locator('.nav-header .whiteboard')).toBeHidden()
Expand Down Expand Up @@ -88,13 +88,8 @@ test('draw a rectangle', async ({ page }) => {
).not.toHaveCount(0)
})


test('cleanup the shapes', async ({ page }) => {
if (IsMac) {
await page.keyboard.press('Meta+a')
} else {
await page.keyboard.press('Control+a')
}
await page.keyboard.press(`${modKey}+a`)
await page.keyboard.press('Delete')
await expect(page.locator('[data-type=Shape]')).toHaveCount(0)
})
Expand Down
3 changes: 1 addition & 2 deletions tldraw/apps/tldraw-logseq/src/hooks/usePaste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ const handleCreatingShapes = async (
const text = rawText.trim()
return tryCreateShapeHelper(
tryCreateShapeFromURL,
tryCreateShapeFromIframeString,
tryCreateLogseqPortalShapesFromUUID
tryCreateShapeFromIframeString
)(text)
}

Expand Down