Key shortcuts on edit newswire screen

main
Bob Mottram 2021-04-23 20:23:29 +01:00
parent 5c25e262a8
commit 775255125b
2 changed files with 16 additions and 4 deletions

View File

@ -10469,6 +10469,14 @@ class PubServer(BaseHTTPRequestHandler):
"""Show the newswire from the right column
"""
if '/users/' in path and path.endswith('/editnewswire'):
nickname = path.split('/users/')[1]
if '/' in nickname:
nickname = nickname.split('/')[0]
accessKeys = self.server.accessKeys
if self.server.keyShortcuts.get(nickname):
accessKeys = self.server.keyShortcuts[nickname]
msg = htmlEditNewswire(self.server.cssCache,
translate,
baseDir,
@ -10476,7 +10484,8 @@ class PubServer(BaseHTTPRequestHandler):
port,
httpPrefix,
self.server.defaultTimeline,
self.server.themeName).encode('utf-8')
self.server.themeName,
accessKeys).encode('utf-8')
if msg:
msglen = len(msg)
self._set_headers('text/html', msglen,

View File

@ -516,7 +516,8 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str,
def htmlEditNewswire(cssCache: {}, translate: {}, baseDir: str, path: str,
domain: str, port: int, httpPrefix: str,
defaultTimeline: str, theme: str) -> str:
defaultTimeline: str, theme: str,
accessKeys: {}) -> str:
"""Shows the edit newswire screen
"""
if '/users/' not in path:
@ -549,7 +550,8 @@ def htmlEditNewswire(cssCache: {}, translate: {}, baseDir: str, path: str,
'<header>' + \
'<a href="/users/' + nickname + '/' + defaultTimeline + '" title="' + \
translate['Switch to timeline view'] + '" alt="' + \
translate['Switch to timeline view'] + '">\n'
translate['Switch to timeline view'] + '" ' + \
'accesskey="' + accessKeys['menuTimeline'] + '">\n'
editNewswireForm += '<img loading="lazy" class="timeline-banner" src="' + \
'/users/' + nickname + '/' + bannerFile + '" ' + \
'alt="" /></a>\n</header>'
@ -565,7 +567,8 @@ def htmlEditNewswire(cssCache: {}, translate: {}, baseDir: str, path: str,
' <div class="containerSubmitNewPost">\n'
editNewswireForm += \
' <input type="submit" name="submitNewswire" value="' + \
translate['Submit'] + '">\n'
translate['Submit'] + '" ' + \
'accesskey="' + accessKeys['submitButton'] + '">\n'
editNewswireForm += \
' </div>\n'