Commit Graph

109 Commits

Author SHA1 Message Date
Gnome Ann a1c378deea Fix CSS issues when editing a chunk that has a comment 2021-11-21 00:48:43 -05:00
Gnome Ann c2ed31de28 Add syntax for comments <|...|> 2021-11-20 01:27:57 -05:00
henk717 b926170fb0
Merge branch 'KoboldAI:main' into united 2021-11-19 00:05:21 +01:00
Gnome Ann bb51198f40 Fix some editor issues in Firefox and possibly mobile browsers
When Firefox 93.0 was released, they broke the ability to edit text
across multiple chunks or across multiple paragraphs. If you tried,
nothing would happen.

Also, we are no longer using Mutation Observers to detect when a chunk
is modified. We are now using the beforeinput event.
2021-11-18 13:18:18 -05:00
henk717 c2371cf801
Merge pull request #23 from VE-FORBRYDERNE/scan-test
Dynamic world info scan
2021-11-10 03:31:42 +01:00
henk717 bc0f9c8032 Allow remote mode to load from client-side story files
(cherry picked from commit a1345263df)
2021-11-06 11:48:20 -04:00
Gnome Ann 7a0b0b0d2d Remove debug logging from application.js 2021-11-04 19:36:45 -04:00
Gnome Ann 7c099fe93c Allow remote mode to load from client-side story files 2021-11-04 19:33:17 -04:00
Gnome Ann 0a91ea27b3 Make the dynamic world info scan toggleable 2021-11-03 12:18:48 -04:00
Gnome Ann 4e3cc93020 Merge branch 'united' into sp 2021-10-23 11:45:03 -04:00
henk717 7b73d7cfdd Single Line Mode
Adds Single Line mode, optimized for things like chatbot testing and other cases where you want to have control over what happens after a paragraph.

This can also be used as a foundation for a chatbot optimized interface mode.
2021-10-23 17:30:48 +02:00
Gnome Ann 9e82ce34a6 HTML-escape strings in the soft prompt selection menu 2021-10-22 14:25:25 -04:00
Gnome Ann 1f449a9dda Soft prompt support (6B Colabs not supported yet) 2021-10-22 14:18:10 -04:00
Gnome Ann fdbe730a1f Fix an incorrect document.queryCommandSupported call 2021-10-13 12:51:31 -04:00
Gnome Ann 99d26c44e0 Handle CRLF newlines properly when pasting 2021-10-13 12:43:45 -04:00
Gnome Ann 718af6f7fa Pasting fallback for browsers with no execCommand support 2021-10-13 12:41:43 -04:00
Gnome Ann 407d8f7419 Also apply the enter patch to pasted text 2021-10-13 12:05:15 -04:00
Gnome Ann aaa0c3374e Fix problems with stories that end in newlines
Today I learned that the editor only works properly when the last
<chunk> tag has a <br> inside it at the end.  This last <br> is
invisible and is automatically created by all major browsers when you
use the enter key to type a newline at the end of a story to "prevent
the element from collapsing".  When there's more than one <br> at the
end of the last <chunk>, only the last of those <br>s is invisible, so
if you have three <br>s, they are rendered as two newlines.  This only
applies to the last <chunk>, so if the second last <chunk> has three
<br>s at the end, they are still rendered as three newlines.  Since
the browser is really insistent on doing this, this commit mostly deals
with dynamically creating and deleting <br> tags at the ends of <chunk>
tags as needed to provide a consistent experience, and making sure
that all <br> tags actually go inside of <chunk> tags to prevent
breaking the editor.  The latter behaviour was exhibited by Chrome and
caused a bug when you added a newline at the end of your story using
the editor.
2021-10-13 00:42:03 -04:00
Gnome Ann b3d33cc852 Fix enter key behaviour in the editor when not using Firefox 2021-10-12 00:09:02 -04:00
Gnome Ann e69e15bec7 Move using_webkit_patch to earlier in the code
I don't know it this or help or not but I hope it does.
2021-09-30 22:58:54 -04:00
Gnome Ann d7893a0b52 Check for WebKit after connecting to the server
For some reason the original way only works in Safari after pressing the
refresh button. It did not work if you typed the URL into the address
bar in Safari without refreshing afterwards.
2021-09-30 19:00:15 -04:00
Gnome Ann 00c1f49ca1 Fix slow typing speed on mobile devices 2021-09-30 17:52:35 -04:00
Gnome Ann a923b3bfa7 Safari compatibility
Only tested on macOS so far, not iOS.
2021-09-30 14:13:54 -04:00
Gnome Ann e325197748 Fix for submitting memory/AN when memory is empty 2021-09-30 10:57:29 -04:00
Gnome Ann 9ab1d182ac Guard against empty prompts 2021-09-28 19:48:43 -04:00
Gnome Ann 4961273a26 Don't scroll to the bottom of screen when exiting world info
One of my earlier commits apparently removed the need for this.
2021-09-28 19:03:43 -04:00
Gnome Ann 8447ec44ab Fix world info screen and bump application.js version 2021-09-28 19:00:23 -04:00
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 cc207109bc Merge branch 'main' into editor 2021-09-27 22:46:05 -04:00
henk717 431acce0bb
Remove unneeded scrollbars
There was an unneeded scrollbar growing as you were expanding towards the top of the screen, now this scrollbar is hidden until you actually need it making the UI look a bit more polished.
2021-09-28 04:44:17 +02: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
henk717 9ddab39266 Make pin more visible
If its invisible then it will be harder for new players to know its there. Now its less visible when its not selected, a little more visible when the box is selected, and fully visible when your hovering over.
2021-09-08 15:11:28 +02: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