fix(canvas): edit nested text on drill double-click
This commit is contained in:
parent
5d71e810b6
commit
a535c6be8a
|
|
@ -94,12 +94,11 @@ export function createTextEditInput(options: TextEditInputOptions) {
|
|||
selectedNode && selectedId && editor.graph.isContainer(selectedId) && !selectedNode.locked
|
||||
|
||||
if (canEnter) {
|
||||
const useDeep = selectedNode.type === 'COMPONENT' || selectedNode.type === 'INSTANCE'
|
||||
const hit = useDeep
|
||||
? getContainerDescendantHit(selectedId, cx, cy)
|
||||
: hitTestInScope(cx, cy, false)
|
||||
const hit = getContainerDescendantHit(selectedId, cx, cy)
|
||||
editor.enterContainer(selectedId)
|
||||
if (hit) {
|
||||
if (hit?.type === 'TEXT') {
|
||||
startTextEditingAt(hit, cx, cy)
|
||||
} else if (hit) {
|
||||
editor.select([hit.id])
|
||||
} else {
|
||||
editor.clearSelection()
|
||||
|
|
@ -113,7 +112,7 @@ export function createTextEditInput(options: TextEditInputOptions) {
|
|||
|
||||
if (hit.type === 'TEXT') {
|
||||
const isTopLevelText = hit.parentId === editor.state.currentPageId
|
||||
if (!isTopLevelText && !wasSelectedBeforeClickSequence(hit.id)) {
|
||||
if (!isTopLevelText && selectedId !== hit.id && !wasSelectedBeforeClickSequence(hit.id)) {
|
||||
editor.select([hit.id])
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ test('double-clicking top-level text enters text edit mode', async ({ page }) =>
|
|||
await expect.poll(() => getEditingTextId(page), { timeout: 3000 }).toBe(textId)
|
||||
})
|
||||
|
||||
test('double-click drill selects nested text before editing it', async ({ page }) => {
|
||||
test('double-click drill enters nested text edit mode', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
const canvas = new CanvasHelper(page)
|
||||
await canvas.waitForInit()
|
||||
|
|
@ -77,7 +77,7 @@ test('double-click drill selects nested text before editing it', async ({ page }
|
|||
|
||||
await canvas.dblclick(125, 125)
|
||||
|
||||
await expect.poll(() => getEditingTextId(page), { timeout: 1000 }).toBeNull()
|
||||
await expect.poll(() => getEditingTextId(page), { timeout: 3000 }).toBe(ids.textId)
|
||||
await expect
|
||||
.poll(() =>
|
||||
page.evaluate(() => {
|
||||
|
|
@ -87,8 +87,4 @@ test('double-click drill selects nested text before editing it', async ({ page }
|
|||
})
|
||||
)
|
||||
.toEqual([ids.textId])
|
||||
|
||||
await page.waitForTimeout(600)
|
||||
await canvas.dblclick(125, 125)
|
||||
await expect.poll(() => getEditingTextId(page), { timeout: 3000 }).toBe(ids.textId)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue