add reusable babycode editor
This commit is contained in:
8
views/common/babycode-editor-component.etlua
Normal file
8
views/common/babycode-editor-component.etlua
Normal file
@ -0,0 +1,8 @@
|
||||
<span>
|
||||
<button type=button id="post-editor-bold" title="Insert Bold">B</button>
|
||||
<button type=button id="post-editor-italics" title="Insert Italics">I</button>
|
||||
<button type=button id="post-editor-strike" title="Insert Strikethrough">S</button>
|
||||
<button type=button id="post-editor-code" title="Insert Code block">Code</button>
|
||||
</span>
|
||||
<textarea class="babycode-editor" name="<%= ta_name %>" id="post_content" placeholder="Post body" required><%- prefill or "" %></textarea>
|
||||
<script src="/static/js/post-editor.js"></script>
|
16
views/common/babycode-editor.etlua
Normal file
16
views/common/babycode-editor.etlua
Normal file
@ -0,0 +1,16 @@
|
||||
<%
|
||||
local save_button_text = "Post reply"
|
||||
if cancel_url then
|
||||
save_button_text = "Save"
|
||||
end
|
||||
%>
|
||||
<form class="post-edit-form" method="post" action="<%= url or "" %>">
|
||||
<% render ("views.common.babycode-editor-component", {ta_name = ta_name, prefill = prefill}) %>
|
||||
<span>
|
||||
<input type=submit value="<%= save_button_text %>">
|
||||
<% if cancel_url then %>
|
||||
<a class="linkbutton warn" href="<%= cancel_url %>">Cancel</a>
|
||||
<% end %>
|
||||
</span>
|
||||
<% render("views.common.bbcode_help") %>
|
||||
</form>
|
@ -1,5 +1,5 @@
|
||||
<details>
|
||||
<summary>Supported babycode tags</summary>
|
||||
<summary>babycode guide</summary>
|
||||
<ul>
|
||||
<li>[b]<b>bold</b>[/b]</li>
|
||||
<li>[i]<i>italic</i>[/i]</li>
|
||||
@ -8,4 +8,4 @@
|
||||
<li>[url]<a href="https://unlabeled-url.example.com">https://unlabeled-url.example.com</a>[/url]</li>
|
||||
<li>[code]<code>code block</code>[/code]</li>
|
||||
</ul>
|
||||
</details>
|
||||
</details>
|
||||
|
Reference in New Issue
Block a user