diff --git a/app/community/routes.py b/app/community/routes.py index d52576c6..25fdc294 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -512,7 +512,7 @@ def add_post(actor): form.notify_author.data = True return render_template('community/add_post.html', title=_('Add post to community'), form=form, community=community, - markdown_editor=True, low_bandwidth=request.cookies.get('low_bandwidth', '0') == '1', + markdown_editor=current_user.markdown_editor, low_bandwidth=request.cookies.get('low_bandwidth', '0') == '1', moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.id), inoculation=inoculation[randint(0, len(inoculation) - 1)] diff --git a/app/models.py b/app/models.py index 4a6ec936..487dfe96 100644 --- a/app/models.py +++ b/app/models.py @@ -465,6 +465,7 @@ class User(UserMixin, db.Model): default_sort = db.Column(db.String(25), default='hot') theme = db.Column(db.String(20), default='') referrer = db.Column(db.String(256)) + markdown_editor = db.Column(db.Boolean, default=False) avatar = db.relationship('File', lazy='joined', foreign_keys=[avatar_id], single_parent=True, cascade="all, delete-orphan") cover = db.relationship('File', lazy='joined', foreign_keys=[cover_id], single_parent=True, cascade="all, delete-orphan") diff --git a/app/post/routes.py b/app/post/routes.py index 16f3ebdc..2f26ce2f 100644 --- a/app/post/routes.py +++ b/app/post/routes.py @@ -176,7 +176,7 @@ def show_post(post_id: int): canonical=post.ap_id, form=form, replies=replies, THREAD_CUTOFF_DEPTH=constants.THREAD_CUTOFF_DEPTH, description=description, og_image=og_image, POST_TYPE_IMAGE=constants.POST_TYPE_IMAGE, POST_TYPE_LINK=constants.POST_TYPE_LINK, POST_TYPE_ARTICLE=constants.POST_TYPE_ARTICLE, - etag=f"{post.id}{sort}_{hash(post.last_active)}", markdown_editor=True, + etag=f"{post.id}{sort}_{hash(post.last_active)}", markdown_editor=current_user.markdown_editor, low_bandwidth=request.cookies.get('low_bandwidth', '0') == '1', SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()), @@ -368,7 +368,8 @@ def continue_discussion(post_id, comment_id): replies = get_comment_branch(post.id, comment.id, 'top') return render_template('post/continue_discussion.html', title=_('Discussing %(title)s', title=post.title), post=post, - is_moderator=is_moderator, comment=comment, replies=replies, markdown_editor=True, moderating_communities=moderating_communities(current_user.get_id()), + is_moderator=is_moderator, comment=comment, replies=replies, markdown_editor=current_user.markdown_editor, + moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()), community=post.community, inoculation=inoculation[randint(0, len(inoculation) - 1)]) @@ -530,7 +531,7 @@ def add_reply(post_id: int, comment_id: int): else: form.notify_author.data = True return render_template('post/add_reply.html', title=_('Discussing %(title)s', title=post.title), post=post, - is_moderator=is_moderator, form=form, comment=in_reply_to, markdown_editor=True, + is_moderator=is_moderator, form=form, comment=in_reply_to, markdown_editor=current_user.markdown_editor, moderating_communities=moderating_communities(current_user.get_id()), joined_communities = joined_communities(current_user.id), inoculation=inoculation[randint(0, len(inoculation) - 1)]) @@ -674,7 +675,7 @@ def post_edit(post_id: int): form.nsfw.data = post.nsfw form.nsfl.data = post.nsfl return render_template('post/post_edit.html', title=_('Edit post'), form=form, post=post, - markdown_editor=True, + markdown_editor=current_user.markdown_editor, moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()), inoculation=inoculation[randint(0, len(inoculation) - 1)] @@ -1009,7 +1010,7 @@ def post_reply_edit(post_id: int, comment_id: int): form.body.data = post_reply.body form.notify_author.data = post_reply.notify_author return render_template('post/post_reply_edit.html', title=_('Edit comment'), form=form, post=post, post_reply=post_reply, - comment=comment, markdown_editor=True, moderating_communities=moderating_communities(current_user.get_id()), + comment=comment, markdown_editor=current_user.markdown_editor, moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()), inoculation=inoculation[randint(0, len(inoculation) - 1)]) else: diff --git a/app/static/js/scripts.js b/app/static/js/scripts.js index a8c2f365..a00aea38 100644 --- a/app/static/js/scripts.js +++ b/app/static/js/scripts.js @@ -388,7 +388,7 @@ var showCurrentPost = false; // when true, the currently selected post will b function setupKeyboardShortcuts() { document.addEventListener('keydown', function(event) { if (document.activeElement.tagName !== 'INPUT' && document.activeElement.tagName !== 'TEXTAREA') { - if(document.activeElement.tagName !== 'A' && document.activeElement.classList.contains('skip-link')) { + if(document.activeElement.classList.contains('skip-link')) { return; } var didSomething = false; diff --git a/app/static/structure.css b/app/static/structure.css index c215bfe3..dd9305e7 100644 --- a/app/static/structure.css +++ b/app/static/structure.css @@ -460,7 +460,7 @@ fieldset legend { left: 0; background-color: #fff; /* Background color to cover the link for screen readers */ - z-index: 1030; + z-index: 1060; /* Ensure it's above other content */ } @@ -1174,14 +1174,6 @@ fieldset legend { padding-top: 0; } -.skip-link { - position: absolute; - top: -40px; - left: 0; - background-color: #fff; - z-index: 999; -} - .skip-link:focus { top: 0; } diff --git a/app/static/structure.scss b/app/static/structure.scss index 0951d03d..124c28da 100644 --- a/app/static/structure.scss +++ b/app/static/structure.scss @@ -54,7 +54,7 @@ html { top: -40px; /* Adjust as needed to hide the link off-screen */ left: 0; background-color: #fff; /* Background color to cover the link for screen readers */ - z-index: 1030; /* Ensure it's above other content */ + z-index: 1060; /* Ensure it's above other content */ } .skip-link:focus { @@ -853,13 +853,6 @@ fieldset { padding-top: 0; } -.skip-link { - position: absolute; - top: -40px; - left: 0; - background-color: #fff; - z-index: 999; -} .skip-link:focus { top: 0; } diff --git a/app/templates/base.html b/app/templates/base.html index 0b2db4d2..1c96c0f7 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -5,7 +5,7 @@ {% else %} {% if user.avatar_id and not low_bandwidth %} - Avatar + {% endif %} {{ user.display_name() }} {% if user.created_recently() %} @@ -179,7 +179,7 @@ {% endif %}