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(test): removal of select-all shortcut #8165

Merged
merged 3 commits into from Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions e2e-tests/page-rename.spec.ts
Expand Up @@ -7,15 +7,9 @@ import { IsMac, createPage, randomLowerString, newBlock, newInnerBlock, randomSt
***/

async function rename_page(page: Page, new_name: string) {
let selectAll = 'Control+a'
if (IsMac) {
selectAll = 'Meta+a'
}

await page.click('.ls-page-title .page-title')
await page.waitForSelector('input[type="text"]')
await page.keyboard.press(selectAll)
await page.keyboard.press('Backspace')
await page.fill('input[type="text"]', '')
await page.type('.title input', new_name)
await page.keyboard.press('Enter')
await page.click('.ui__confirm-modal button')
Expand Down
7 changes: 6 additions & 1 deletion src/main/frontend/handler/editor.cljs
Expand Up @@ -3426,7 +3426,8 @@

(defn select-parent [e]
(let [edit-input (some-> (state/get-edit-input-id) gdom/getElement)
edit-block (state/get-edit-block)]
edit-block (state/get-edit-block)
target-element (.-nodeName (.-target e))]
(cond
;; editing block fully selected
(and edit-block edit-input
Expand All @@ -3439,6 +3440,10 @@
edit-block
nil

;; Focusing other input element, e.g. when editing page title.
(contains? #{"INPUT" "TEXTAREA"} target-element)
nil

:else
(do
(util/stop e)
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/state.cljs
Expand Up @@ -953,7 +953,7 @@ Similar to re-frame subscriptions"
(set-selection-blocks! blocks :down))
([blocks direction]
(when (seq blocks)
(let [blocks (util/sort-by-height blocks)]
(let [blocks (util/sort-by-height (remove nil? blocks))]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoids:

Uncaught TypeError: Cannot read properties of null (reading 'getBoundingClientRect')
    at Object.frontend$util$get_dom_top [as get_dom_top]

(swap! state assoc
:selection/mode true
:selection/blocks blocks
Expand Down