add quoting posts

This commit is contained in:
2026-05-29 00:26:23 +03:00
parent 594272d298
commit 06b417f9a1
3 changed files with 11 additions and 3 deletions

View File

@@ -112,7 +112,7 @@
<span class="flex-last js-only" data-r="enhance babycodeEditorCharCount">stub: char count</span> <span class="flex-last js-only" data-r="enhance babycodeEditorCharCount">stub: char count</span>
</span> </span>
<input type="hidden" name="babycode_banned_tags" id="{{id}}-banned-tags" value="{{banned_tags | unique | list | tojson | forceescape}}"> <input type="hidden" name="babycode_banned_tags" id="{{id}}-banned-tags" value="{{banned_tags | unique | list | tojson | forceescape}}">
<textarea name="babycode_content" id="{{id}}" class="babycode-editor" placeholder="{{placeholder}}" {{'required' if required else ''}} autocomplete="off" maxlength="5000" data-r="insertBabycode babycodePreviewInit babycodeEditorCharCountInit" data-listeners="input" data-s="babycodeEditorCharCount" data-banned-tags="{{banned_tags | unique | list | tojson | forceescape}}">{{ prefill }}</textarea> <textarea name="babycode_content" id="{{id}}" class="babycode-editor" placeholder="{{placeholder}}" {{'required' if required else ''}} autocomplete="off" maxlength="5000" data-r="insertBabycode babycodePreviewInit babycodeEditorCharCountInit babycodeEditorQuote" data-listeners="input" data-s="babycodeEditorCharCount" data-banned-tags="{{banned_tags | unique | list | tojson | forceescape}}">{{ prefill }}</textarea>
{%- if banned_tags -%} {%- if banned_tags -%}
<div> <div>
<span>Forbidden tags:</span> <span>Forbidden tags:</span>
@@ -186,7 +186,7 @@
<a class="linkbutton" href="{{url_for('posts.edit', post_id=post.id, _anchor='babycode-content')}}">Edit</a> <a class="linkbutton" href="{{url_for('posts.edit', post_id=post.id, _anchor='babycode-content')}}">Edit</a>
{%- endif -%} {%- endif -%}
{%- if can_reply -%} {%- if can_reply -%}
<button data-r="enhance" disabled title="This feature requires JavaScript to be enabled.">Quote</button> <button data-r="enhance" data-s="babycodeEditorQuote" disabled title="This feature requires JavaScript to be enabled." data-quote="{{post.original_markup}}" data-poster-name="{{ post.display_name if post.display_name else post.username }}">Quote</button>
{%- endif -%} {%- endif -%}
{%- if can_delete -%} {%- if can_delete -%}
<a class="linkbutton critical" href="{{url_for('posts.delete', post_id=post.id)}}">Delete</a> <a class="linkbutton critical" href="{{url_for('posts.delete', post_id=post.id)}}">Delete</a>

View File

@@ -29,7 +29,7 @@
<input type="hidden" name="last_post_id" value="{{last_post.id}}"> <input type="hidden" name="last_post_id" value="{{last_post.id}}">
<input type="submit" value="{{'Subscribe' if not get_active_user().is_subscribed(thread.id) else 'Unsubscribe'}}"> <input type="submit" value="{{'Subscribe' if not get_active_user().is_subscribed(thread.id) else 'Unsubscribe'}}">
</form> </form>
<button disabled title="This feature requires JavaScript to be enabled.">{{icn_bookmark(24)}}Bookmark&hellip;</button> <button data-r="enhance" disabled title="This feature requires JavaScript to be enabled.">{{icn_bookmark(24)}}Bookmark&hellip;</button>
{%- endif -%} {%- endif -%}
<a href="{{url_for('threads.feed', thread_id=thread.id)}}" class="linkbutton rss">Subscribe via RSS</a> <a href="{{url_for('threads.feed', thread_id=thread.id)}}" class="linkbutton rss">Subscribe via RSS</a>
</fieldset> </fieldset>

View File

@@ -162,3 +162,11 @@ export function showBabycodePreview(payload, _, el) {
el.innerHTML = payload.html; el.innerHTML = payload.html;
} }
} }
export function babycodeEditorQuote(ev, sender, el) {
console.log(sender.dataset.quote);
const newline = el.value.length === 0 ? '' : '\n'
el.value += `${newline}[quote=${sender.dataset.posterName}]\n${sender.dataset.quote}\n[/quote]\n\n`
b.send({ sender: el }, 'babycodeEditorCharCount');
el.focus();
}