}
return url('/attachments/' . $this->id);
}
+
+ public function htmlLink(): string
+ {
+ return '<a target="_blank" href="'.e($this->getUrl()).'">'.e($this->name).'</a>';
+ }
+
+ public function markdownLink(): string
+ {
+
+ }
}
/**
* SortableList
+ *
+ * Can have data set on the dragged items by setting a 'data-drag-content' attribute.
+ * This attribute must contain JSON where the keys are content types and the values are
+ * the data to set on the data-transfer.
+ *
* @extends {Component}
*/
class SortableList {
animation: 150,
onSort: () => {
this.$emit('sort', {ids: sortable.toArray()});
- }
+ },
+ setData(dataTransferItem, dragEl) {
+ console.log('cat');
+ const jsonContent = dragEl.getAttribute('data-drag-content');
+ if (jsonContent) {
+ const contentByType = JSON.parse(jsonContent);
+ dataTransferItem.setData('bookstack/json', jsonContent);
+ for (const [type, content] of Object.entries(contentByType)) {
+ dataTransferItem.setData(type, content);
+ }
+ }
+ },
+ revertOnSpill: true,
+ dropBubble: true,
+ dragoverBubble: false,
});
}
}
<div component="ajax-delete-row"
option:ajax-delete-row:url="{{ url('/attachments/' . $attachment->id) }}"
data-id="{{ $attachment->id }}"
+ data-drag-content="{{ json_encode(['text/html' => $attachment->htmlLink()]) }}"
class="card drag-card">
<div class="handle">@icon('grip')</div>
<div class="py-s">