Commit Graph

35 Commits

Author SHA1 Message Date
cf63ce920d Make sure editor element is visible at the start of tests 2025-04-19 13:37:23 +02:00
829806d265 Fix flaky tests 2025-04-19 13:37:23 +02:00
d7ceab52f9 Add wait time to make test less flaky 2025-04-19 13:37:23 +02:00
94f5534611 Revamp key bindings
This is a work in progress revamp of the key binding system. It implements a system, built on top of CodeMirror's key binding system, for defining key bindings. 

The system uses a dumb "KeyShortcut" -> "Command" mapping with a set of default keys (which will be different if Heynote's Emacs mode is used) that can be overridden by user key bindings.

The key bindings are *displayed* in the Settings, and it's possible to set user defined key bindings in Heynote's config file, but it's not yet possible to define custom key bindings in the UI.

Previously we Heynote on a bunch of default key bindings from CodeMirror (some of which was not "block aware"). This is no longer the case, and because of this, it's quite likely that there are key bindings that was previously working that is now missing (if so, these can easily be added later).
2025-04-19 13:37:23 +02:00
fa83c50f44 Add tests that checks positioning of todo checkboxes depending on font type 2025-04-07 11:50:41 +02:00
52a6c444eb Position the cursor at the beginning of the next block when a block is deleted
This also changes the behavior when blocks are moved.
Add tests for the deleteBlock command.
2025-01-09 14:16:20 +01:00
c9c092fc43 Add feature for moving the current block to another buffer
- The Ctrl/Cmd-S keyboard shortcut now pops up a buffer search dialog that can be used to select a buffer that the block should be moved to. 
- Update `BufferSelector` UI and logic to support moving blocks
2025-01-07 23:17:23 +01:00
158ac08418 Move block parsing functions into their own JS module so that they can be imported in node land when running Playwright tests 2025-01-07 19:09:16 +01:00
c87ea672b0 Make language selector also search through the languages' filename suffixes (using the guesslang attribute)
This makes the "cpp" string match C++, and "cs" match C#.
2025-01-03 15:59:44 +01:00
3a90d2d12f Increase wait time in test
Should hopefully make it work on Github actions
2024-12-09 13:38:14 +01:00
9c057b120a Add support for creating new empty note buffers 2024-12-09 12:37:05 +01:00
d54a3ba633 Add tests for creating new Note buffers 2024-12-09 12:37:05 +01:00
7be0a304d0 WIP: Multiple notes support
Add support for migrating old buffer file to new library.

Add support for changing location for the notes library.

Replace theme toggle in status bar with a dropdown in Appearance settings.

Improve New Note and Update Note dialogs.

Implement UI for confirming note delete (the actualal deltion is still to be implemented).
2024-12-09 12:37:05 +01:00
49dd273b92 Fix tests 2024-12-09 12:37:05 +01:00
10b6aa198f Add test that checks that existing keys are kept in buffer files' metadata 2024-12-09 12:37:05 +01:00
1f9be701b3 Fix race condition that could cause the editor to not scroll the cursor(s) into the viewport upon loading 2024-12-09 12:37:05 +01:00
9ca0fabb71 Add test for saving and restoring cursor positions 2024-12-09 12:37:05 +01:00
78150c2b70 Fix broken tests 2024-12-09 12:37:05 +01:00
0aaf62925f Add test for custom default block language 2024-07-14 12:19:29 +02:00
bc3a9b66a1 Add test that ensures that getBlocksFromSyntaxTree() and getBlocksFromString() functions produces the same results 2024-07-07 22:05:33 +02:00
5eed314e32 fix: Block corruption when deleting block content using deleteLine command (#134)
* fix: cell corruption when deleting block contents

* customize deleteLine to fix cell corruption

* implemented tests for delete line

* moved deleteLine and selectedLineBlocks to delete-line.js
2024-02-07 13:03:59 +01:00
41d9ef7025 Copy whole current line(s) when selection(s) are empty (#177)
* Copy whole current line(s) when selection(s) are empty

* Fix tests on Linux/Windows
2024-01-25 17:44:38 +01:00
5adbbc72ec Add prev variable to Math blocks that holds the previous value (#156)
Moved documentation on Math blocks from the FAQ into it's own section in the Readme.
2024-01-11 21:28:11 +01:00
090b6fc1dd Add tests for custom fonts 2024-01-09 00:35:33 +01:00
554e04ea67 Fix test on linux/windows
Change Playwright reporter when running in Github action

Change default emacs meta key to Alt on non Linux and Windows

Always set emacsMetaKey to "alt" if not on Mac, since the option is only available on Mac
2024-01-06 01:51:07 +01:00
17091d323c Remove debug log 2024-01-06 01:51:07 +01:00
957b22c70e Refactor the way we handle copy/cut/paste in Emacs mode
Previously we listened for the key bindings for copy, cut and paste in the Electron main process, and triggered the event using copy(), paste() and cut() methods on win.webContent. Now this is fully handled within the renderer process using the window.navigator.clipboard API.

This will make it simpler to implement fully customizable key bindings.
2024-01-06 01:51:07 +01:00
d0d8f872a6 Add key bindings for inserting new blocks at the end/top of the buffer, as well as before the current block (#85)
* Add functionality to insert new block after the last block

- Update key bindings in `initial-content.ts` to include `Alt + Enter` for adding a new block after the last block.
- Implement `getLastNoteBlock` function in `block.js` to retrieve the last block in the note.
- Add `addNewBlockAfterLast` command in `commands.js` to handle the insertion of a new block after the last one.
- Integrate `addNewBlockAfterLast` command into the keymap in `keymap.js`.

* Add block insertion before/after current, before first and after last. Also, tests.

- Added `getFirstNoteBlock` in `block.js` for accessing the first text block.
- Implemented new functions in `commands.js` like `addNewBlockBeforeCurrent` and `addNewBlockBeforeFirst`.
- Updated `keymap.js` with new key bindings to facilitate block creation.
- Introduced `block-creation.spec.js` for testing the new block manipulation features.

* Fix visual bug when inserting new block at the top

* Update help text and Readme

* Fix wrong cursor position after inserting new blocks at the top of the buffer, when the previous first block's delimiter is long (e.g. Markdown)

* Make RegEx more generic

* Fix import

* Auto-generate the README.md and initial-content documentation

- Add a documentation generator
- Add an option to force the initial content to be erased with an env variable

* Add more specific tests

* Fix Mod key on Mac in test

---------

Co-authored-by: Jonatan Heyman <jonatan@heyman.info>
2024-01-04 16:11:26 +01:00
0f3c714d56 CloseBrackets setting toggle (#102)
* Add a setting to toggle the auto bracket-closing of CodeMirror

* Move Auto-close brackets setting into new settings tab Editing

* Add tests for Auto-close bracket setting

---------

Co-authored-by: Jonatan Heyman <jonatan@heyman.info>
2024-01-04 14:52:41 +01:00
acb7ddf189 Add Settings to web app (#125)
* Add support for opening settings dialog in the webapp

* Add tests for settings dialog

* Hide stand-alone app specific settings in web app

* Remove debug log
2024-01-04 14:27:04 +01:00
0b6a1a49e8 Add support for specifying a custom format function within a math block (#99) 2023-12-31 10:43:42 +01:00
a1cad5b335 Don't display string quotes for math results that are strings. (#92)
Fix bug that could cause the cursor to be positioned immediately to the left of the widget (within its margin) making it look like there was a space character in the buffer when there was not.
Add tests for math blocks.

Fixes #21.
2023-12-29 10:47:02 +01:00
60caac45ab Add TOML support 2023-12-26 01:31:36 +01:00
bb511b868b Add support for more languages (#69)
* Contain language selection dialog in an element that can be scrolled, and automatically scroll it if needed when navigating the list with arrow keys

* Add support for more languages:

Clojure, Erlang, Golang, Lezer, Ruby, Shell, YAML

* Move prettier auto format settings for languages into Language() class

* Remove invalid import

* Fix bug that could cause auto formatting to fail for the last block.
Add tests for language auto detection and formatting.

* Fix broken tests

* Fix language auto detection on Safari Webkit which was broken

* Remove unnecessary wait time
2023-12-26 00:27:43 +01:00
1006fd4580 Implement tests using Playwright (#68)
* Set up Playwright and add first test

* Add npm run commands for running tests
Run tests in github actions

* Fix tests on non Mac environments

* Add method to HeynoteEditor class to set the buffer content

* Add more tests

* Set Github action job name
2023-12-25 17:41:15 +01:00