mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Lexical: Got working with attachment insert/drop
This commit is contained in:
parent
9a7edc6e52
commit
d86837ac07
@ -1,7 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
$getNearestNodeFromDOMNode,
|
|
||||||
$getRoot,
|
|
||||||
$insertNodes,
|
|
||||||
$isDecoratorNode,
|
$isDecoratorNode,
|
||||||
LexicalEditor,
|
LexicalEditor,
|
||||||
LexicalNode
|
LexicalNode
|
||||||
@ -9,7 +6,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
$getNearestBlockNodeForCoords,
|
$getNearestBlockNodeForCoords,
|
||||||
$htmlToBlockNodes,
|
$htmlToBlockNodes,
|
||||||
$insertNewBlockNodeAtSelection, $insertNewBlockNodesAtSelection,
|
$insertNewBlockNodesAtSelection,
|
||||||
$selectSingleNode
|
$selectSingleNode
|
||||||
} from "./helpers";
|
} from "./helpers";
|
||||||
|
|
||||||
@ -54,8 +51,19 @@ function createDropListener(editor: LexicalEditor): (event: DragEvent) => void {
|
|||||||
// Template handling
|
// Template handling
|
||||||
const templateId = event.dataTransfer?.getData('bookstack/template') || '';
|
const templateId = event.dataTransfer?.getData('bookstack/template') || '';
|
||||||
if (templateId) {
|
if (templateId) {
|
||||||
event.preventDefault();
|
|
||||||
insertTemplateToEditor(editor, templateId, event);
|
insertTemplateToEditor(editor, templateId, event);
|
||||||
|
event.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTML contents drop
|
||||||
|
const html = event.dataTransfer?.getData('text/html') || '';
|
||||||
|
if (html) {
|
||||||
|
editor.update(() => {
|
||||||
|
const newNodes = $htmlToBlockNodes(editor, html);
|
||||||
|
$insertNodesAtEvent(newNodes, event, editor);
|
||||||
|
});
|
||||||
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## In progress
|
## In progress
|
||||||
|
|
||||||
//
|
- Draft/change management (connect with page editor component)
|
||||||
|
|
||||||
## Main Todo
|
## Main Todo
|
||||||
|
|
||||||
@ -11,9 +11,7 @@
|
|||||||
- Table features
|
- Table features
|
||||||
- Image paste upload
|
- Image paste upload
|
||||||
- Keyboard shortcuts support
|
- Keyboard shortcuts support
|
||||||
- Draft/change management (connect with page editor component)
|
|
||||||
- Add ID support to all block types
|
- Add ID support to all block types
|
||||||
- Video attachment drop / insert
|
|
||||||
- Task list render/import from existing format
|
- Task list render/import from existing format
|
||||||
- Link popup menu for cross-content reference
|
- Link popup menu for cross-content reference
|
||||||
- Link heading-based ID reference menu
|
- Link heading-based ID reference menu
|
||||||
|
Loading…
Reference in New Issue
Block a user