diff --git a/50_bubble.py b/50_bubble.py

index d6a25a7..815cfef 100644

--- a/50_bubble.py

+++ b/50_bubble.py

@@ -387,6 +387,14 @@ In the "New post" and "Comment" prompts, there are special commands available:

+

+In the "Edit text" prompts of the draft composer:

+

+* Entering \e will open the text segment in a raw view so that it can be edited via Titan directly, if the client supports page editing.

+

+### Undoing Mistakes

+

+When editing segments in the draft composer, you may sometimes accidentally submit the input and overwrite the contents, losing some text that you meant to keep in there. While Bubble does not currently keep a history of past edited versions, your client may be able to help you. If you navigate backwards, the old contents of the segment may be found in a cached copy of the page.

"""

         return page



@@ -407,7 +415,8 @@ when the administrator assigns at least one moderator to it.

         return admin_actions(session)



     elif req.path.startswith(self.path + 'edit-segment/') or \

- req.path.startswith(self.path + 'move-segment/'):

+ req.path.startswith(self.path + 'move-segment/') or \

+ req.path.startswith(self.path + 'raw-segment/'):

         return edit_segment(session)



     elif req.path.startswith(self.path + 'edit/'):

diff --git a/composer.py b/composer.py

index 6f7390c..90db7eb 100644

--- a/composer.py

+++ b/composer.py

@@ -10,15 +10,15 @@ def edit_segment(session):

 db = session.db

 req = session.req



- found = re.match(r'^(edit|move)-segment/(\d+)$', req.path[len(session.path):])

+ found = re.match(r'^(edit|move|raw)-segment/(\d+)$', req.path[len(session.path):])

 seg_action = found.group(1)

 seg_id = int(found.group(2))

 segment = db.get_segment(seg_id)

 if not segment:

     return 51, 'Not found'



- if is_empty_query(req) and session.is_gemini:

- if seg_action =='edit':

+ if session.is_gemini and is_empty_query(req) and seg_action != 'raw':

+ if seg_action == 'edit':

         if segment.type == Segment.LINK:

             return 10, 'Edit link: (URL followed by label, separated with space)'

         if segment.type == Segment.POLL:

@@ -27,15 +27,26 @@ def edit_segment(session):

         if segment.type == Segment.POLL:

             return 10, 'Move to which position in the poll: (X to remove)'



- return 10, 'Edited text:' if seg_action == 'edit' else \

- 'Move to which position §? (X to remove)'

+ return 10, 'Edited text: (see Help for special commands)' if seg_action == 'edit' else \

+ 'Move to which position §? (X to remove)'



 post = db.get_post(segment.post)



 if not session.is_editable(post):

     return 61, 'Cannot edit posts by other users'



- if seg_action == 'edit':

+ if seg_action == 'raw':

+ if segment.type != Segment.TEXT:

+ return 50, 'Only text segments can be viewed in raw mode'

+ if session.is_gemini:

+ return segment.content

+ else:

+ if not req.content_mime.startswith('text/'):

+ return 50, 'Bad content format (must be text)'

+ seg_text = req.content.decode('utf-8')

+ db.update_segment(segment, content=seg_text)

+

+ elif seg_action == 'edit':

     if segment.type == Segment.LINK:

         seg_url, seg_text = parse_link_segment_query(req)

         db.update_segment(segment, url=seg_url, content=seg_text)

@@ -43,6 +54,8 @@ def edit_segment(session):

     elif segment.type == Segment.TEXT:

         if session.is_gemini:

             seg_text = clean_query(req)

+ if seg_text == '\e':

+ return 30, f'{session.server_root()}{session.path}raw-segment/{segment.id}'

         else:

             seg_text = clean_text(req.content.decode('utf-8'))

         db.update_segment(segment, content=seg_text)

Proxy Information
Original URL
gemini://git.skyjake.fi/bubble/main/pcdiff/57611f41296640cabfdd1e674f01b2efe657b3e5
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
28.306114 milliseconds
Gemini-to-HTML Time
5.582668 milliseconds

This content has been proxied by September (3851b).