copy image markdown from admin area

This commit is contained in:
2023-12-03 11:12:08 +11:00
parent 92c435c1ed
commit 65be48b519
6 changed files with 5531 additions and 26 deletions

View File

@@ -5,6 +5,12 @@ import TinyMDE from "tiny-markdown-editor";
import defo from "@icelab/defo";
(function() {
document.addEventListener('alpine:init', () => {
Alpine.magic('clipboard', () => {
return subject => navigator.clipboard.writeText(subject)
})
})
document.addEventListener("DOMContentLoaded", function () {
const views = {
markdown: (el, attrs) => {

View File

@@ -14,6 +14,9 @@ div class="mb-4 max-w-prose mx-auto prose dark:prose-invert"
- photos.each_with_index do |photo, idx|
- next if photo.match(/small/)
div class="rounded max-w-xs" x-data="" id="photo-#{idx}"
img class="rounded object-cover hover:opacity-80 h-48 w-48" src="/#{photo.gsub("public/", "")}"
button class="hover:text-blue-400 p-2 bg-blue-100 rounded text-blue-600 mr-4 no-underline" @click="$clipboard('#{Hanami.app.settings.micropub_site_url}/#{photo.gsub("public/", "")}')" Copy URL
button class="text-red-600 hover:text-red-400" hx-delete="/admin/media/#{photo}" hx-target="#photo-#{idx}" Delete
img class="rounded object-cover hover:opacity-80 h-48 w-48 mb-2" src="/#{photo.gsub("public/", "")}"
div class="grid grid-cols-2 gap-2"
button class="hover:text-blue-400 p-1 bg-blue-100 rounded text-blue-600 no-underline" @click="$clipboard('#{Hanami.app.settings.micropub_site_url}/#{photo.gsub("public/", "")}')" Copy URL
button class="hover:text-blue-400 p-1 bg-blue-100 rounded text-blue-600 no-underline" @click="$clipboard('![](#{Hanami.app.settings.micropub_site_url}/#{photo.gsub("public/", "")})')" Copy .md
div class="grid grid-cols-1"
button class="text-red-600 p-1 bg-red-50 rounded hover:text-red-400 mt-2" hx-delete="/admin/media/#{photo}" hx-target="#photo-#{idx}" Delete