mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-02 15:30:06 +00:00
Continued implementation of attachment drag+drop
Cannot get working in chrome reliably due to conflicting handling of events and drag+drop API. Getting attachment drop working breaks other parts of TinyMCE. Implementing current work as should still work for MD editor and within FireFox. Related to #1460
This commit is contained in:
parent
e305ba14d9
commit
ad48cd3e48
5 changed files with 17 additions and 6 deletions
resources/js/components
|
@ -256,7 +256,7 @@ class MarkdownEditor {
|
|||
}
|
||||
|
||||
const clipboard = new Clipboard(event.dataTransfer);
|
||||
if (clipboard.hasItems()) {
|
||||
if (clipboard.hasItems() && clipboard.getImages().length > 0) {
|
||||
const cursorPos = cm.coordsChar({left: event.pageX, top: event.pageY});
|
||||
cm.setCursor(cursorPos);
|
||||
event.stopPropagation();
|
||||
|
|
|
@ -21,11 +21,9 @@ class SortableList {
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -638,8 +638,8 @@ class WysiwygEditor {
|
|||
|
||||
});
|
||||
|
||||
// Custom drop event handling
|
||||
editor.on('drop', function (event) {
|
||||
console.log('drop')
|
||||
let dom = editor.dom,
|
||||
rng = tinymce.dom.RangeUtils.getCaretRangeFromPoint(event.clientX, event.clientY, editor.getDoc());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue