diff --git a/remarkbox/static/css/common.css b/remarkbox/static/css/common.css index 325c02e..431572d 100644 --- a/remarkbox/static/css/common.css +++ b/remarkbox/static/css/common.css @@ -675,6 +675,24 @@ form.node-action { font-size: 0.8em; } +.export-menu { + font-size: 0.75em; + margin-top: 8px; + display: flex; + flex-wrap: wrap; + gap: 14px; + align-items: baseline; +} + +.export-label { + color: var(--color-muted); + font-weight: bold; +} + +.export-link { + color: var(--color-muted); +} + div.user-watching { display: grid; grid-template-columns: 1fr 1fr; diff --git a/remarkbox/templates/snippets/snippets.j2 b/remarkbox/templates/snippets/snippets.j2 index 9959f6b..d2c3469 100644 --- a/remarkbox/templates/snippets/snippets.j2 +++ b/remarkbox/templates/snippets/snippets.j2 @@ -243,41 +243,37 @@ {% endmacro %} {% macro export_menu(node) %} -
- export -
- markdown - html - pdf - epub - docx - rst - latex - odt - plain text - {% if request.namespace.wiki %} - history (json) - history (html) - {% endif %} -
-
+
+ export: + markdown + html + pdf + epub + docx + rst + latex + odt + plain text + {% if request.namespace.wiki %} + history (json) + history (html) + {% endif %} +
{% endmacro %} {% macro export_node_menu(node) %} -
- export -
- markdown - html - pdf - epub - docx - {% if request.namespace.wiki %} - history (json) - history (html) - {% endif %} -
-
+
+ export: + markdown + html + pdf + epub + docx + {% if request.namespace.wiki %} + history (json) + history (html) + {% endif %} +
{% endmacro %} {% macro wiki_actions(node) %} diff --git a/remarkbox/views/modify_node.py b/remarkbox/views/modify_node.py index 4f02281..d94f978 100644 --- a/remarkbox/views/modify_node.py +++ b/remarkbox/views/modify_node.py @@ -20,7 +20,10 @@ def edit_node(request): request.session.flash(("You must log in to edit your messages.", "error")) return HTTPFound(get_referer_or_home(request)) - if not request.namespace.can_alter_node(request.node, request.user): + # In wiki mode, any authenticated user can edit root nodes — match the + # `can_wiki_edit` gate used by the edit-button macro. Outside wiki mode + # this collapses back to owner/moderator only. + if not request.namespace.can_wiki_edit(request.node, request.user): request.session.flash(("You do not own this message.", "error")) return HTTPFound(get_referer_or_home(request)) @@ -34,7 +37,13 @@ def edit_node(request): if thread_data or thread_title: if thread_title: request.node.title = thread_title - request.node.edit(thread_data) + # In wiki-mode namespaces every edit gets a revision row so the history + # endpoint has something to show. The API wiki-edit endpoint already + # does this; the browser form path was silently dropping revisions. + if request.namespace.wiki: + request.node.wiki_edit(thread_data, user=request.user) + else: + request.node.edit(thread_data) # set return_to URI. return_to = get_node_route_uri(request, request.node.root, request.node.id)