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