mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-01-03 23:42:28 +03:00
Lexical: Added media src conversions
Only actuall added YT in the end. Google had changed URL scheme, and Vimeo seems to just be something else now, can't really browse video pages like before.
This commit is contained in:
@@ -32,7 +32,7 @@ import {
|
||||
} from "../../../utils/selection";
|
||||
import {$isDiagramNode, $openDrawingEditorForNode, showDiagramManagerForInsert} from "../../../utils/diagrams";
|
||||
import {$createLinkedImageNodeFromImageData, showImageManager} from "../../../utils/images";
|
||||
import {$showDetailsForm, $showImageForm, $showLinkForm} from "../forms/objects";
|
||||
import {$showDetailsForm, $showImageForm, $showLinkForm, $showMediaForm} from "../forms/objects";
|
||||
import {formatCodeBlock} from "../../../utils/formats";
|
||||
|
||||
export const link: EditorButtonDefinition = {
|
||||
@@ -168,24 +168,11 @@ export const media: EditorButtonDefinition = {
|
||||
label: 'Insert/edit Media',
|
||||
icon: mediaIcon,
|
||||
action(context: EditorUiContext) {
|
||||
const mediaModal = context.manager.createModal('media');
|
||||
|
||||
context.editor.getEditorState().read(() => {
|
||||
const selection = $getSelection();
|
||||
const selectedNode = $getNodeFromSelection(selection, $isMediaNode) as MediaNode | null;
|
||||
|
||||
let formDefaults = {};
|
||||
if (selectedNode) {
|
||||
const nodeAttrs = selectedNode.getAttributes();
|
||||
formDefaults = {
|
||||
src: nodeAttrs.src || nodeAttrs.data || '',
|
||||
width: nodeAttrs.width,
|
||||
height: nodeAttrs.height,
|
||||
embed: '',
|
||||
}
|
||||
}
|
||||
|
||||
mediaModal.show(formDefaults);
|
||||
$showMediaForm(selectedNode, context);
|
||||
});
|
||||
},
|
||||
isActive(selection: BaseSelection | null): boolean {
|
||||
|
||||
Reference in New Issue
Block a user