Commit Graph

70 Commits

Author SHA1 Message Date
Gnome Ann 231290608d Do a better job of preventing editing of text when required 2021-09-28 00:48:37 -04:00
Gnome Ann f632ad9880 Use a more robust scheme for restorePrompt
The original way didn't work properly in Firefox on Android when you
select all text and replace it with something else.
2021-09-27 23:38:41 -04:00
Gnome Ann e8cefcc2c6 (Firefox) Fix certain chunks not updating when editing
I don't know why Firefox is so weird but we need to do this or else
some chunks don't update properly when you edit multiple chunks at the
same time.

One example of when this happened is when you have a story with at least
one chunk other than the prompt. Then, if you select the entire story
except for the first few characters of the prompt and then delete the
selected characters, and then defocus the story to save your changes,
the last chunk in the story will not register as having been deleted,
which you can verify if you refresh the page.

Another example. If your story has a chunk with no trailing newlines
followed by a chunk with exactly two leading newlines, if you delete
the first newline from the latter chunk and then defocus to save your
edits, the newline will be there again when you refresh the page.
2021-09-27 23:10:34 -04:00
Gnome Ann 3297c27fcd Fix using escape to save edits 2021-09-27 22:56:12 -04:00
Gnome Ann b39f12b60b Remove unneeded console.log() 2021-09-27 22:47:27 -04:00
Gnome Ann 13b81c7523 Prevent the user from deleting the prompt 2021-09-27 22:21:14 -04:00
Gnome Ann fff095b496 Stop all animations before performing scroll-to-bottom
So that if the animation is triggered multiple times you don't have to
wait for all the animations to be performed one after the other before
you can finally manually scroll.
2021-09-27 18:10:33 -04:00
Gnome Ann 09d540b580 Prevent editing the "Welcome to KoboldAI!" message 2021-09-27 17:55:54 -04:00
Gnome Ann a327eed2c3 Fix editor scrolling issues 2021-09-27 17:44:22 -04:00
Gnome Ann 47c6f48e94 Move padding and overflow-y from #gamescreen to #gametext
For stories that are long enough for the scroll bar to appear on the
screen, Firefox on desktop would originally only allow you to start
editing if you click on the actual text, i.e. you couldn't click on the
blank part of a line. This behaviour is now fixed.
2021-09-27 16:37:38 -04:00
Gnome Ann 25758dc3ab Fix event handler for clicking on story text
It wouldn't trigger any events originally when you click on parts of the
story text area that didn't contain any text, e.g. on a blank line or on
the blank part of a line to the right of the actual text.
2021-09-27 16:33:24 -04:00
Gnome Ann 5f154b8b55 Replace all references to #gametext with game_text
Come to think of it, I'm not sure where the variable "gametext" was even
defined. Is this some kind of sorcery?
2021-09-27 16:04:42 -04:00
Gnome Ann 3b19d4518a Remove "Desktop only" from application.js comments 2021-09-27 15:57:07 -04:00
Gnome Ann c3781e0e2f Rewrite the code for the editor for better browser compat
Does not work well on mobile. That's on my to-do list, don't you worry!
2021-09-27 13:11:15 -04:00
Gnome Ann e953f2d75e Use 3-space indentation instead of 4 in downloaded JSON
This is to match the indentation style of the JSON files created by
aiserver.py which apparently use 3 space indentation...
2021-09-19 23:48:04 -04:00
Gnome Ann dff5a4e754 More missing semicolons... 2021-09-19 17:16:01 -04:00
Gnome Ann 42ecd6d2d1 Fix missing semicolon 2021-09-19 11:59:31 -04:00
Gnome Ann b5883148a5 Download Story as JSON/Plaintext no longer requires server 2021-09-19 11:41:37 -04:00
Gnome Ann 34af94d760 Fix deselected stories in Load dialog not un-highlighting 2021-09-01 14:21:07 -04:00
Gnome Ann 7e896c98fe Move #newsavename keydown event handler 2021-09-01 14:12:12 -04:00
Gnome Ann f1633d3e5c Prevent scope leakage of some variables in application.js 2021-09-01 14:01:04 -04:00
Gnome Ann 543acf9ba4 Also allow downloading stories as plaintext 2021-09-01 13:46:37 -04:00
Gnome Ann 25bb6486eb Add an option under "Save" to download story (as JSON) 2021-09-01 13:32:11 -04:00
Gnome Ann cb446d2113 Copy the event handlers from "Save As" to the Rename dialog 2021-09-01 13:10:21 -04:00
Gnome Ann 556835cd34 Move some of the delete/rename dialog event handlers 2021-09-01 13:05:24 -04:00
Gnome Ann c276220a35 Allow deleting and renaming stories in the browser 2021-08-31 18:22:30 -04:00
Gnome Ann 0fbf620f22 Added scroll-to-bottom for closing genseqs/W Info
Scroll time is halved now also.
2021-08-26 15:15:42 -04:00
Gnome Ann d7605a717b Merge branch 'united' into big-o
This resolves two merge conflicts that arose because this branch was
a few commits behind.
2021-08-26 01:37:40 -04:00
Gnome Ann 8fd8612cca Adventure mode colouring now controlled by a CSS class
So that we can just toggle the class instead of having aiserver.py send
back the entire story.
2021-08-26 01:06:57 -04:00
henk717 bbd5bd0cd7
Merge pull request #8 from VE-FORBRYDERNE/misc
General usability fixes
2021-08-26 01:56:42 +02:00
Gnome Ann 796f5ffd05 Make vars.actions a dictionary instead of a list 2021-08-25 19:28:26 -04:00
Gnome Ann 5604d7f317 Replace non-breaking spaces with regular spaces 2021-08-25 19:25:57 -04:00
Gnome Ann 5603bf0584 Hide messages on updatechunk and removechunk 2021-08-25 19:22:35 -04:00
Gnome Ann cf677c60fc Stability fixes for back/retry re genseqs/useprompt
* Back and Retry buttons no longer pop a story chunk while in the
  "Select sequence to keep" menu
* No longer freezes if you retry with no story chunks beyond the initial
  prompt chunk
* When "Always Add Prompt" is on, allow Retry even if the prompt is the
  only chunk in the story
* Added error messages for Back and Retry buttons
2021-08-25 14:42:37 -04:00
Gnome Ann b52f782d92 Disable post-edit blurring and the curtain
Because we don't need them anymore.
This, combined with the chunk optimization, will allow you to
seamlessly continue editing a different chunk after you've finished
editing your current one; e.g. if you edit a chunk and use arrow keys,
backspace or the mouse to select a different chunk, you can immediately
start editing your new chunk without it defocusing.

This patch really has killed two birds with one stone, eh?
Thanks, Javalar!
2021-08-25 01:21:01 -04:00
Gnome Ann b1c6aee8d3 Integrate inline chunk editor and Adventure mode with Javalar's branch 2021-08-24 19:02:52 -04:00
Gnome Ann 62ad2f0228 Code indentation consistency 2021-08-24 18:32:48 -04:00
Gnome Ann 6d5845ff8d Merge https://github.com/KoboldAI/KoboldAI-Client/pull/45 into big-o 2021-08-24 17:27:50 -04:00
Gnome Ann 2a7c6244cb Constant world info keys 2021-08-24 13:45:20 -04:00
Gnome Ann ce59c9d399 Fix left/right arrow key bug
This happens when you have a chunk that has no trailing
newlines followed by a chunk with a single newline at the start.
Moving between those chunks would cause the caret to jump to the wrong
position sometimes.
2021-08-24 13:32:29 -04:00
Gnome Ann 90e558cf3f Won't freeze anymore if you delete the prompt 2021-08-24 11:24:29 -04:00
Gnome Ann 7059c18f70 Prevent current_editing_chunk from being a non-chunk element 2021-08-24 11:14:18 -04:00
henk717 f0962155b8
Merge pull request #5 from VE-FORBRYDERNE/editable-chunks
Scroll down on submit
2021-08-24 01:22:57 +02:00
Gnome Ann 13ce16b859 Scroll down on submit 2021-08-23 19:19:36 -04:00
henk717 c108e080bf Various Fixes
Various Fixes, mostly to make the UI play a little nicer in the new edit mode. Also reverted and optimized some of the setting stuff.
2021-08-24 01:18:09 +02:00
Gnome Ann 3bf467e63c Added dedicated inline editing commands to aiserver.py
It's a lot faster now.
2021-08-23 18:52:45 -04:00
Gnome Ann a907c0a554 Prevent aiserver.py from rarely editing the wrong chunk 2021-08-23 18:26:38 -04:00
Gnome Ann 7ce5b120a0 Also allow backspacing into another chunk
It will still defocus the chunk almost immediately though,
this needs to be fixed later
2021-08-23 18:11:03 -04:00
Gnome Ann 3c9f6963b8 Allow using left and right arrow keys to move between chunks 2021-08-23 18:00:35 -04:00
Gnome Ann 81c83dfef7 Fix bug where chunks still editable with Allow Editing off
If, with Allow Editing on, you change a chunk and then click directly on
the "Allow Editing" switch again to turn it off without defocusing the
chunk in-between (by clicking outside the chunk, using enter/escape,
etc), all story chunks would still be editable.
That behaviour has now been fixed.
2021-08-23 14:25:40 -04:00