@layers-app/editor-video 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.css
CHANGED
|
@@ -99,6 +99,14 @@ div.doc-space-styles-provider .video-upload-container *::after {
|
|
|
99
99
|
pointer-events: auto !important;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
.editor-select__chevron {
|
|
103
|
+
transition: transform 150ms ease;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
[data-expanded=true] + * .editor-select__chevron {
|
|
107
|
+
transform: rotate(180deg);
|
|
108
|
+
}
|
|
109
|
+
|
|
102
110
|
.media-actions .media-action {
|
|
103
111
|
border: none;
|
|
104
112
|
background-color: var(--mantine-color-body, white);
|
package/dist/index.js
CHANGED
|
@@ -5,11 +5,12 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
5
5
|
import { createContext, useState, useRef, useCallback, useMemo, useContext, forwardRef, createElement, useEffect } from "react";
|
|
6
6
|
import { createCommand, $getNodeByKey, $setSelection, COMMAND_PRIORITY_LOW, DecoratorNode } from "lexical";
|
|
7
7
|
import { useTranslation } from "react-i18next";
|
|
8
|
-
import { Tooltip, ActionIcon, Text, Progress, Paper, Button, TextInput, Menu, Box, Slider, Flex,
|
|
8
|
+
import { Tooltip, ActionIcon, Text, Progress, Paper, Button, TextInput, Menu, Box, Slider, Flex, useCombobox, Combobox, InputBase, Group, Stack, Divider, Textarea, Loader, Switch, Modal } from "@mantine/core";
|
|
9
9
|
import { BlockWithAlignableContents } from "@lexical/react/LexicalBlockWithAlignableContents";
|
|
10
10
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
11
11
|
import { Dropzone as Dropzone$1, IMAGE_MIME_TYPE } from "@mantine/dropzone";
|
|
12
12
|
import ShakaPlayer from "shaka-player-react";
|
|
13
|
+
import { IconChevronDown, IconCheck } from "@tabler/icons-react";
|
|
13
14
|
import { Carousel } from "@mantine/carousel";
|
|
14
15
|
const VideoContext = createContext(null);
|
|
15
16
|
function VideoPluginProvider({
|
|
@@ -4972,6 +4973,115 @@ function VideoPlayerState({
|
|
|
4972
4973
|
}
|
|
4973
4974
|
);
|
|
4974
4975
|
}
|
|
4976
|
+
function VideoSelect({
|
|
4977
|
+
size = "sm",
|
|
4978
|
+
w = 150,
|
|
4979
|
+
comboboxProps,
|
|
4980
|
+
rightSection,
|
|
4981
|
+
renderOption,
|
|
4982
|
+
data,
|
|
4983
|
+
value,
|
|
4984
|
+
defaultValue,
|
|
4985
|
+
onChange,
|
|
4986
|
+
inputClassName,
|
|
4987
|
+
...inputProps
|
|
4988
|
+
}) {
|
|
4989
|
+
var _a;
|
|
4990
|
+
const {
|
|
4991
|
+
onClick: onInputClick,
|
|
4992
|
+
type: _inputType,
|
|
4993
|
+
onCopy: _onCopy,
|
|
4994
|
+
onCut: _onCut,
|
|
4995
|
+
onPaste: _onPaste,
|
|
4996
|
+
classNames: parentClassNames,
|
|
4997
|
+
allowDeselect: _allowDeselect,
|
|
4998
|
+
...restInputProps
|
|
4999
|
+
} = inputProps;
|
|
5000
|
+
const parentInputClass = typeof parentClassNames === "object" && parentClassNames && "input" in parentClassNames ? parentClassNames.input : void 0;
|
|
5001
|
+
const inputClass = [parentInputClass, inputClassName].filter(Boolean).join(" ") || void 0;
|
|
5002
|
+
const mergedClassNames = inputClass ? {
|
|
5003
|
+
...typeof parentClassNames === "object" && parentClassNames ? parentClassNames : {},
|
|
5004
|
+
input: inputClass
|
|
5005
|
+
} : parentClassNames;
|
|
5006
|
+
const [search, setSearch] = useState("");
|
|
5007
|
+
const combobox = useCombobox({
|
|
5008
|
+
onDropdownClose: () => {
|
|
5009
|
+
combobox.resetSelectedOption();
|
|
5010
|
+
combobox.focusTarget();
|
|
5011
|
+
setSearch("");
|
|
5012
|
+
},
|
|
5013
|
+
onDropdownOpen: () => {
|
|
5014
|
+
combobox.focusSearchInput();
|
|
5015
|
+
}
|
|
5016
|
+
});
|
|
5017
|
+
const normalizedData = useMemo(
|
|
5018
|
+
() => (Array.isArray(data) ? data : []).map(
|
|
5019
|
+
(item) => typeof item === "string" ? { value: item, label: item } : item
|
|
5020
|
+
),
|
|
5021
|
+
[data]
|
|
5022
|
+
);
|
|
5023
|
+
const selectedValue = value ?? defaultValue ?? null;
|
|
5024
|
+
const selectedLabel = ((_a = normalizedData.find((item) => item.value === selectedValue)) == null ? void 0 : _a.label) ?? "";
|
|
5025
|
+
const renderOptionNode = (optionValue, optionLabel, checked) => renderOption ? renderOption({
|
|
5026
|
+
option: { value: optionValue, label: optionLabel },
|
|
5027
|
+
checked
|
|
5028
|
+
}) : /* @__PURE__ */ jsxs(Group, { justify: "space-between", wrap: "nowrap", w: "100%", children: [
|
|
5029
|
+
optionLabel,
|
|
5030
|
+
checked && /* @__PURE__ */ jsx(IconCheck, { size: 16, color: "var(--primary-color-text, #4C6EF5)" })
|
|
5031
|
+
] });
|
|
5032
|
+
const { width: comboboxWidth, ...restComboboxProps } = comboboxProps || {};
|
|
5033
|
+
const dropdownWidth = comboboxWidth ?? 250;
|
|
5034
|
+
return /* @__PURE__ */ jsxs(
|
|
5035
|
+
Combobox,
|
|
5036
|
+
{
|
|
5037
|
+
store: combobox,
|
|
5038
|
+
withinPortal: true,
|
|
5039
|
+
onOptionSubmit: (val) => {
|
|
5040
|
+
const option = normalizedData.find((item) => item.value === val) ?? {
|
|
5041
|
+
value: val,
|
|
5042
|
+
label: val
|
|
5043
|
+
};
|
|
5044
|
+
onChange == null ? void 0 : onChange(val, option);
|
|
5045
|
+
combobox.closeDropdown();
|
|
5046
|
+
},
|
|
5047
|
+
width: dropdownWidth,
|
|
5048
|
+
...restComboboxProps,
|
|
5049
|
+
children: [
|
|
5050
|
+
/* @__PURE__ */ jsx(Combobox.Target, { children: /* @__PURE__ */ jsx(
|
|
5051
|
+
InputBase,
|
|
5052
|
+
{
|
|
5053
|
+
component: "button",
|
|
5054
|
+
size,
|
|
5055
|
+
w,
|
|
5056
|
+
classNames: mergedClassNames,
|
|
5057
|
+
pointer: true,
|
|
5058
|
+
rightSection: rightSection ?? /* @__PURE__ */ jsx(IconChevronDown, { size: 16, className: "editor-select__chevron" }),
|
|
5059
|
+
rightSectionPointerEvents: "none",
|
|
5060
|
+
onClick: (e) => {
|
|
5061
|
+
onInputClick == null ? void 0 : onInputClick(e);
|
|
5062
|
+
combobox.toggleDropdown();
|
|
5063
|
+
},
|
|
5064
|
+
...restInputProps,
|
|
5065
|
+
children: selectedLabel
|
|
5066
|
+
}
|
|
5067
|
+
) }),
|
|
5068
|
+
/* @__PURE__ */ jsx(Combobox.Dropdown, { children: /* @__PURE__ */ jsx(
|
|
5069
|
+
Combobox.Options,
|
|
5070
|
+
{
|
|
5071
|
+
style: {
|
|
5072
|
+
maxHeight: 200,
|
|
5073
|
+
overflowY: "auto"
|
|
5074
|
+
},
|
|
5075
|
+
children: normalizedData.length > 0 ? normalizedData.map((item) => {
|
|
5076
|
+
const checked = item.value === selectedValue;
|
|
5077
|
+
return /* @__PURE__ */ jsx(Combobox.Option, { value: item.value, children: renderOptionNode(item.value, item.label, checked) }, item.value);
|
|
5078
|
+
}) : /* @__PURE__ */ jsx(Combobox.Empty, { children: "Nothing found" })
|
|
5079
|
+
}
|
|
5080
|
+
) })
|
|
5081
|
+
]
|
|
5082
|
+
}
|
|
5083
|
+
);
|
|
5084
|
+
}
|
|
4975
5085
|
const isLinkPlatform = (value) => value === "link" || value === "youtube" || value === "vk" || value === "rutube";
|
|
4976
5086
|
const isUploadPlatform = (value) => value === "upload" || value === "download";
|
|
4977
5087
|
function VideoUploadComponent({
|
|
@@ -4997,7 +5107,7 @@ function VideoUploadComponent({
|
|
|
4997
5107
|
const { t, i18n } = useTranslation();
|
|
4998
5108
|
const { config, dependencies, registerUpload, unregisterUpload, reportError } = useVideoPluginContext();
|
|
4999
5109
|
const { maxFileSize = 5, pageId } = config;
|
|
5000
|
-
const SelectComponent = dependencies.Select ||
|
|
5110
|
+
const SelectComponent = dependencies.Select || VideoSelect;
|
|
5001
5111
|
const [currentState, setCurrentState] = useState(
|
|
5002
5112
|
initialVideoState ?? "default"
|
|
5003
5113
|
);
|
|
@@ -5841,7 +5951,7 @@ function ChaptersSection({
|
|
|
5841
5951
|
addTranscriptManuallyLabel
|
|
5842
5952
|
}) {
|
|
5843
5953
|
const dependencies = useVideoPluginDependencies();
|
|
5844
|
-
const SelectComponent = dependencies.Select ||
|
|
5954
|
+
const SelectComponent = dependencies.Select || VideoSelect;
|
|
5845
5955
|
const [editableChapters, setEditableChapters] = useState(
|
|
5846
5956
|
[]
|
|
5847
5957
|
);
|
|
@@ -6494,7 +6604,7 @@ function ManualSubtitlesPanel({
|
|
|
6494
6604
|
const { t } = useTranslation();
|
|
6495
6605
|
const { reportError } = useVideoPluginContext();
|
|
6496
6606
|
const dependencies = useVideoPluginDependencies();
|
|
6497
|
-
const SelectComponent = dependencies.Select ||
|
|
6607
|
+
const SelectComponent = dependencies.Select || VideoSelect;
|
|
6498
6608
|
const [tracks, setTracks] = useState([]);
|
|
6499
6609
|
const [drafts, setDrafts] = useState([]);
|
|
6500
6610
|
const uploadControllersRef = useRef(/* @__PURE__ */ new Map());
|