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

Writable Books #27

Open
BenCheung0422 opened this issue Dec 23, 2024 · 0 comments
Open

Writable Books #27

BenCheung0422 opened this issue Dec 23, 2024 · 0 comments

Comments

@BenCheung0422
Copy link
Member

BenCheung0422 commented Dec 23, 2024

Original: MinicraftPlus/minicraft-plus-revived#319
Requires #26 and #53

Background

The current book item is not editable and useable for players, but just placeholders.

Details

Instead of just single BookItem, we would have WrittenBook and EditableBook for both written version (read-only) and writable version (read-write). Both types can be used in structures for loots with written contents. However, writable books would allow players to author, sign and complete the books as written ones. The actual implementation might be similar to Minecraft, but adding that there might be more formattable parts like page linking in the content page. Other than book-favoured syntaxes, the general text formatting codes (#53) would be available.

Markup

The formatting codes in #53 would be supported, plus hyperlinks. Complex markups like lists or tables could not be supported, but simple links could be supported. They could either by website URLs (i.e. protocol with HTTP or HTTPS) or page numbers (a specific page in the book). Others would not be supported. If the links are websites, a warning is always popped up and could not be disabled for security concerns. Anyway, even keyboard-only controls would be able to access the hyperlinks, by iterating over available hyperlinks on the current page. An unselected one would be displayed with an inverted-colored underline for distinguishment and identification; a selected one would be displayed without the underline (or blinking the underline) informing the user. The syntax might just be extended from the formatting codes without having to bother more escapable sequences.

Editing

Due to the above complexity, having a live preview is pretty challenging in this menu style. So, other than editing previewing text, there could still be a toggle to preview on the editing menu of an editable book.

If using a mouse, the user could click on empty area to hide the caret but it still functions at the position. In addition, regardless of controls, if the caret has been rest for a few seconds, it stops blinking but stays visible. This behavior would be configurable in accessibility settings.

Lines & Pages

Line breaks (ENTER) and form feeds (SHIFT+ENTER) would display as is. However, if certain lines are long in editor, the lines may not be broken, but depending on the resulting length on display. If there are lines across page without any form feed, the lines may be merged onto the page in the front, depending how many lines are displayed in the pages, but a form feed is not affected by this. A line break or a form feed can be deleted by DELETE or BACKSPACE according to the position of cursor.

See Also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment