livebook/assets/js/focus_on_update/index.js
Jonatan Kłosko 0925ec77cd
Implement notebook persistence and import (#44)
* Basic filesystem navigation

* Add file picker modal

* Implement autosave when dirty and show the status

* Add hompage link in the session view

* Improve file picker and use in both places

* Move session list to homepage

* Some refactoring

* Show import messages if any

* Fix and extend tests

* Show a message when there are no sessions running

* Rename import to fork and make that clear in notebook name

* Fix old route

* Show info when no file is connected to the given session

* Show runtime type next to filename

* Show button for joining session when a running path is selected

* Move modal components to SessionLive namespace

* Add FileGuard to lock files used for notebook persistence

* Use radio for specifying persistence type

* Don't lock nil path

* Simplify FileGuard implementation

* Test notebook persistence

* Fix typo

* Further simplify FileGuard

* Improve file listing

* Don't show parent dir when there's a basename being typed

* Add path component tests
2021-02-21 16:54:44 +01:00

19 lines
327 B
JavaScript

/**
* A hook used to focus an element whenever it receives LV update.
*/
const FocusOnUpdate = {
mounted() {
this.__focus();
},
updated() {
this.__focus();
},
__focus() {
this.el.focus();
this.el.selectionStart = this.el.selectionEnd = this.el.value.length;
},
};
export default FocusOnUpdate;