ASP Classic blog framework - BrainOrdure
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

89 Zeilen
3.3KB

  1. <div class="row">
  2. <div class="col-lg-8">
  3. <div class="card shadow-sm">
  4. <div class="card-body">
  5. <h1 class="h3 mb-4">New Post</h1>
  6. <form method="post" action="<%= PostsUrl() %>">
  7. <div class="mb-3">
  8. <label class="form-label" for="Title">Title</label>
  9. <input class="form-control" type="text" id="Title" name="Title" required>
  10. </div>
  11. <div class="mb-3">
  12. <label class="form-label" for="Summary">Summary</label>
  13. <textarea class="form-control" id="Summary" name="Summary" rows="3"></textarea>
  14. </div>
  15. <div class="mb-3">
  16. <label class="form-label" for="BodyEditor">Body</label>
  17. <input type="hidden" id="Body" name="Body" value="">
  18. <div class="editor-shell">
  19. <div id="BodyEditor" class="rich-editor" aria-label="Post body editor"></div>
  20. </div>
  21. <div class="form-text">Use the toolbar to format the post or add an AI-generated image.</div>
  22. </div>
  23. <div class="mb-4">
  24. <label class="form-label" for="CategoryID">Category ID</label>
  25. <input class="form-control" type="number" id="CategoryID" name="CategoryID" min="0" value="0">
  26. </div>
  27. <div class="d-flex gap-2">
  28. <button class="btn btn-primary" type="submit">Create Post</button>
  29. <a class="btn btn-outline-secondary" href="<%= PostsUrl() %>">Cancel</a>
  30. </div>
  31. </form>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. <link href="https://cdn.jsdelivr.net/npm/quill@1.3.7/dist/quill.snow.css" rel="stylesheet" />
  37. <script src="https://cdn.jsdelivr.net/npm/quill@1.3.7/dist/quill.min.js"></script>
  38. <script>
  39. (function () {
  40. if (!window.Quill) return;
  41. var bodyInput = document.getElementById('Body');
  42. var bodyEditor = document.getElementById('BodyEditor');
  43. bodyEditor.innerHTML = bodyInput.value || '';
  44. var quill = new Quill(bodyEditor, {
  45. theme: 'snow',
  46. modules: {
  47. toolbar: {
  48. container: [
  49. [{ header: [1, 2, 3, false] }],
  50. ['bold', 'italic', 'underline', 'blockquote', 'code-block'],
  51. [{ list: 'ordered' }, { list: 'bullet' }],
  52. ['link', 'image', 'clean']
  53. ]
  54. }
  55. }
  56. });
  57. var toolbar = quill.getModule('toolbar').container;
  58. var aiButton = document.createElement('button');
  59. aiButton.type = 'button';
  60. aiButton.className = 'btn btn-sm btn-outline-secondary ms-2 ql-aiimage';
  61. aiButton.innerHTML = '<i class="bi bi-image me-1"></i>AI Image';
  62. aiButton.addEventListener('click', function () {
  63. var prompt = window.prompt('Describe the image to generate with AI');
  64. if (!prompt) return;
  65. var url = 'https://gen.pollinations.ai/image/' + encodeURIComponent(prompt);
  66. var range = quill.getSelection(true) || { index: quill.getLength() };
  67. quill.insertEmbed(range.index, 'image', url, Quill.sources.USER);
  68. quill.insertText(range.index + 1, '\n', Quill.sources.SILENT);
  69. quill.setSelection(range.index + 2, Quill.sources.SILENT);
  70. });
  71. toolbar.appendChild(aiButton);
  72. var form = bodyInput.closest('form');
  73. form.addEventListener('submit', function () {
  74. bodyInput.value = quill.root.innerHTML;
  75. });
  76. })();
  77. </script>

Powered by TurnKey Linux.