1、修复拖动素材到轨道的BUG
2、修复lottie文件上传的BUG
This commit is contained in:
1 parent
dbe6963f4e
commit
95b1e63ae2
24 files changed
+272
-359
No files matched your search
@@ -67,21 +67,21 @@ export default function DragItem(props: IProps) {
|
||||
}
|
||||
const hasAudio = await util.checkVideoUrlHasAudio(editor.movie.reURL(item.urls.url), item.type);
|
||||
// 通过 _localPath 判断资源是否来自本地存储
|
||||
const isLocal = !!(item._localPath);
|
||||
const isLocal = !!item._localPath;
|
||||
|
||||
console.log('hasAudio', hasAudio);
|
||||
// 添加素材
|
||||
const resource = new ResourceItem({
|
||||
id: utils.createID(),
|
||||
originId: item.id,
|
||||
url: isLocal ? (item._localPath || item.urls.url) : item.urls.url,
|
||||
url: isLocal ? item._localPath || item.urls.url : item.urls.url,
|
||||
name: item.name,
|
||||
fileType: item.type,
|
||||
type: item.type as any,
|
||||
isLocal: isLocal ? true : false,
|
||||
noAudioTracks: !hasAudio,
|
||||
mustFetch: item.type === 'image' ? true : false,
|
||||
thumb: isLocal ? (item._thumbPath || item.urls.thumb) : item.urls.thumb,
|
||||
thumb: isLocal ? item._thumbPath || item.urls.thumb : item.urls.thumb,
|
||||
frames: item.attrs.frames,
|
||||
wave: item.attrs.wave,
|
||||
styleSize: {
|
||||
@@ -260,7 +260,8 @@ export default function DragItem(props: IProps) {
|
||||
await replaceElementById($item.attr('data-id'), d);
|
||||
}
|
||||
} else {
|
||||
let trackIndex = tempElement.trackIndex;
|
||||
console.log('tempElement', { ...tempElement });
|
||||
let trackIndex = editor.tempInsertIndex + 0.5;
|
||||
setElement({
|
||||
id: 'temp',
|
||||
duration: 5,
|
||||
|
||||
@@ -44,10 +44,10 @@ export class DragItemCls {
|
||||
if ($(e.target).closest('a')[0]) {
|
||||
return;
|
||||
}
|
||||
const [id, type] = $(this).attr('data-dragitem').split('_');
|
||||
const item = editor.getFromActiveItems(id, type);
|
||||
const [id, type] = $(this).attr('data-dragitem').split('#');
|
||||
const item = editor.getFromActiveItems(id);
|
||||
if (!item) {
|
||||
console.error('数据异常', id, type, this);
|
||||
console.error('数据异常', id, this);
|
||||
return;
|
||||
}
|
||||
self.events.dragstart(item, { x: e.pageX, y: e.pageY }, e);
|
||||
|
||||
@@ -64,7 +64,7 @@ export default function SourceList(props: IProps) {
|
||||
}
|
||||
|
||||
// 设置缓存数据,用于拖动元素的时候获取数据
|
||||
editor.setActiveItems(items, props.type);
|
||||
editor.setActiveItems(items);
|
||||
|
||||
return (
|
||||
<div className={styles.sourceListWrapper}>
|
||||
@@ -79,7 +79,7 @@ export default function SourceList(props: IProps) {
|
||||
return (
|
||||
<span
|
||||
data-type={item.type}
|
||||
data-dragitem={props.type === 'template' ? undefined : item.id + '_' + props.type}
|
||||
data-dragitem={props.type === 'template' ? undefined : item.id + '#' + item.type}
|
||||
className={classNames(styles.item, props.itemClassName)}
|
||||
onClick={e => {
|
||||
if (props.type === 'template') {
|
||||
|
||||
@@ -9,6 +9,7 @@ import type * as st from '@config/sdk.d';
|
||||
import { addImageVideoAudioItem } from '../sources/addItem';
|
||||
import { getUploadBeforeData } from '../../tools/uploadBeforeData';
|
||||
import { getSystemPrompt, parseToolCalls, executeToolCall, splitUserCommand } from './aiMovieEditor';
|
||||
import { DEFAULT_LLM_MODEL } from './aiConfig';
|
||||
import { getCredits } from './price';
|
||||
import ChatMessages from './ChatMessages';
|
||||
import type { ChatMessage, MediaContent } from './ChatMessages';
|
||||
@@ -835,7 +836,7 @@ export default function AIChat() {
|
||||
];
|
||||
|
||||
const [res, err] = await editor.apiServer!.openAiChat({
|
||||
model: 'doubao-seed-1-6-251015',
|
||||
model: DEFAULT_LLM_MODEL,
|
||||
messages: chatMessages,
|
||||
});
|
||||
|
||||
@@ -865,7 +866,7 @@ export default function AIChat() {
|
||||
{ role: 'user' as const, content: '请立即使用 <tool_calls> 格式直接执行上述操作,不要只回复文字或计划。' },
|
||||
];
|
||||
const [res2, err2] = await editor.apiServer!.openAiChat({
|
||||
model: 'doubao-seed-1-6-251015',
|
||||
model: DEFAULT_LLM_MODEL,
|
||||
messages: retryMessages,
|
||||
});
|
||||
|
||||
|
||||
@@ -2,6 +2,51 @@ import { Toast } from '@douyinfe/semi-ui';
|
||||
import { stores } from '@stores/index';
|
||||
import { util } from '@utils/index';
|
||||
|
||||
// ==================== LLM 模型配置 ====================
|
||||
|
||||
interface LLMModelConfig {
|
||||
name: string;
|
||||
modelId: string;
|
||||
provider: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
/** 可用的 LLM 模型列表 */
|
||||
export const LLM_MODELS: Record<string, LLMModelConfig> = {
|
||||
'doubao-seed-1-6-251015': {
|
||||
name: '豆包 Seed 1.6',
|
||||
modelId: 'doubao-seed-1-6-251015',
|
||||
provider: 'huoshan',
|
||||
description: '通用大语言模型,用于 AI 对话和指令拆解',
|
||||
},
|
||||
'deepseek-v4-pro-260425': {
|
||||
name: 'Deepseek V4 Pro',
|
||||
modelId: 'deepseek-v4-pro-260425',
|
||||
provider: 'deepseek',
|
||||
description: '专业级大语言模型,用于复杂任务和专业领域',
|
||||
},
|
||||
'deepseek-v4-flash-260425': {
|
||||
name: 'Deepseek V4 Flash',
|
||||
modelId: 'deepseek-v4-flash-260425',
|
||||
provider: 'deepseek',
|
||||
description: '专业级大语言模型,用于复杂任务和专业领域',
|
||||
},
|
||||
};
|
||||
|
||||
/** 默认 LLM 模型 */
|
||||
export const DEFAULT_LLM_MODEL = 'deepseek-v4-pro-260425';
|
||||
|
||||
/**
|
||||
* 获取 LLM 模型配置
|
||||
* @param modelId 模型 ID,默认使用 DEFAULT_LLM_MODEL
|
||||
*/
|
||||
export function getLLMModel(modelId?: string): LLMModelConfig {
|
||||
const id = modelId || DEFAULT_LLM_MODEL;
|
||||
return LLM_MODELS[id] || LLM_MODELS[DEFAULT_LLM_MODEL];
|
||||
}
|
||||
|
||||
// ==================== 图片/视频生成参数 ====================
|
||||
|
||||
// https://www.volcengine.com/docs/82379/1393047
|
||||
export async function getImageToVideoParams(formData: Record<string, any>) {
|
||||
const { editor } = stores;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type * as sdkTypes from 'video-core-sdk';
|
||||
import { utils, speedHelper } from 'video-core-sdk';
|
||||
import type { Editor } from '@stores/editor';
|
||||
import { DEFAULT_LLM_MODEL } from './aiConfig';
|
||||
|
||||
// ==================== Tool Definitions ====================
|
||||
|
||||
@@ -1604,7 +1605,7 @@ export async function splitUserCommand(
|
||||
|
||||
try {
|
||||
const [res, err] = await apiServer.openAiChat({
|
||||
model: 'doubao-seed-1-6-251015',
|
||||
model: DEFAULT_LLM_MODEL,
|
||||
messages: [
|
||||
{ role: 'system', content: systemPrompt },
|
||||
{ role: 'user', content: userCommand },
|
||||
|
||||
@@ -103,27 +103,34 @@ export const addImageVideoAudioItem = async (
|
||||
export const addLottieItem = async (item: any, insertTime?: number, trackIndex?: number) => {
|
||||
console.log('添加元素', item);
|
||||
const { editor } = stores;
|
||||
const resource = new ResourceItem({
|
||||
const isLocal = !!item._localPath;
|
||||
|
||||
let resource: ResourceItem | any = new ResourceItem({
|
||||
id: utils.createID(),
|
||||
originId: item.id,
|
||||
url: item.urls.url,
|
||||
url: isLocal ? item._localPath : item.urls.url,
|
||||
name: item.name,
|
||||
fileType: item.urls.url.split('.').pop(),
|
||||
fileType: item.type,
|
||||
type: 'lottie',
|
||||
isLocal: isLocal ? true : false,
|
||||
mustFetch: true,
|
||||
thumb: item.thumb || item.urls.thumb,
|
||||
frames: item.attrs.frames,
|
||||
thumb: isLocal ? item._thumbPath || '' : item.urls.thumb,
|
||||
frames: isLocal ? item.attrs.frames || '' : item.attrs.frames,
|
||||
styleSize: {
|
||||
width: item.attrs.width,
|
||||
height: item.attrs.height,
|
||||
width: Number(item.attrs.width),
|
||||
height: Number(item.attrs.height),
|
||||
},
|
||||
duration: itemDuration(item),
|
||||
from: item.from,
|
||||
extend: { ...item.attrs },
|
||||
attrs: { ...item.attrs },
|
||||
});
|
||||
console.log('resource', resource);
|
||||
// 素材duration保留一位小数
|
||||
resource.duration = util.timeToNum(resource.duration);
|
||||
// 本地存储模式:将资源中的相对路径解析为 blob URL
|
||||
if (isLocal && editor.movie?.resourceManage) {
|
||||
await hydrateResourcePaths([resource as any], editor.movie.resourceManage);
|
||||
}
|
||||
|
||||
const elementData = await editor.movie.addElementByResource(resource as any, {
|
||||
time: insertTime || editor.currentTime,
|
||||
@@ -499,6 +506,7 @@ export function itemDuration(item: any): number {
|
||||
}
|
||||
|
||||
export async function addItem(item: any, insertTime: number, trackIndex: number) {
|
||||
|
||||
const { editor } = stores;
|
||||
|
||||
if (editor.globalLoading) {
|
||||
@@ -526,6 +534,7 @@ export async function addItem(item: any, insertTime: number, trackIndex: number)
|
||||
} else {
|
||||
item.from = 'system';
|
||||
}
|
||||
|
||||
let elem = null;
|
||||
switch (item.type) {
|
||||
// case 'model3D':
|
||||
|
||||
@@ -9,14 +9,7 @@ import Login from '@components/login';
|
||||
import { language, Intl } from '@language/index';
|
||||
import { stores } from '@stores/index';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
export default function AiMain(props: IProps) {
|
||||
if (!props.show) {
|
||||
return null;
|
||||
}
|
||||
export default function AiMain() {
|
||||
const { editor } = stores;
|
||||
|
||||
if (!editor.token) {
|
||||
|
||||
@@ -4,31 +4,17 @@ import { observer } from 'mobx-react';
|
||||
import AudioItem from './AudioItem';
|
||||
// import { addImageVideoAudioItem } from '../addItem';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
let hasRender = false;
|
||||
|
||||
function Audio(props: IProps) {
|
||||
if (!hasRender) {
|
||||
if (props.show) {
|
||||
hasRender = true;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function Audio() {
|
||||
|
||||
return (
|
||||
<div style={{ height: '100%', display: props.show ? 'block' : 'none' }}>
|
||||
<Source
|
||||
type="audio"
|
||||
item={d => {
|
||||
return <AudioItem item={d} />;
|
||||
}}
|
||||
itemClassName={styles.audioItem + ' audioSourceItem'}
|
||||
// addItem={addImageVideoAudioItem}
|
||||
/>
|
||||
</div>
|
||||
<Source
|
||||
type="audio"
|
||||
item={d => {
|
||||
return <AudioItem item={d} />;
|
||||
}}
|
||||
itemClassName={styles.audioItem + ' audioSourceItem'}
|
||||
// addItem={addImageVideoAudioItem}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,7 @@ import React from 'react';
|
||||
import styles from './caption.module.less';
|
||||
import Captions from './captions';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
export default function Caption(props: IProps) {
|
||||
if (!props.show) {
|
||||
return null;
|
||||
}
|
||||
export default function Caption() {
|
||||
return (
|
||||
<div className={styles.caption}>
|
||||
<Captions />
|
||||
|
||||
@@ -5,15 +5,8 @@ import { stores } from '@stores/index';
|
||||
// import { editor } from '@stores/index';
|
||||
// import { addEffectItem } from '../addItem';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
export default function Effect(props: IProps) {
|
||||
export default function Effect() {
|
||||
const { editor } = stores;
|
||||
if (!props.show) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Source
|
||||
|
||||
@@ -5,15 +5,8 @@ import { stores } from '@stores/index';
|
||||
|
||||
// import { addFilterItem } from '../addItem';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
export default function Filter(props: IProps) {
|
||||
export default function Filter() {
|
||||
const { editor } = stores;
|
||||
if (!props.show) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Source
|
||||
|
||||
@@ -4,36 +4,20 @@ import { addImageVideoAudioItem } from '../addItem';
|
||||
import { util } from '@utils/index';
|
||||
import { stores } from '@stores/index';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
// 判断是否加载了,只加载一次
|
||||
let hasRender = false;
|
||||
|
||||
export default function Image(props: IProps) {
|
||||
export default function Image() {
|
||||
const { editor } = stores;
|
||||
if (!hasRender) {
|
||||
if (props.show) {
|
||||
hasRender = true;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ height: '100%', display: props.show ? 'block' : 'none' }}>
|
||||
<Source
|
||||
type="image"
|
||||
item={d => {
|
||||
if (d.urls.url.indexOf('.gif') !== -1) {
|
||||
return <img src={editor.movie.reURL(d.urls.url)} />;
|
||||
}
|
||||
return <img src={editor.movie.reURL(d.urls?.thumb)} />;
|
||||
}}
|
||||
itemClassName={styles.imgItem}
|
||||
// addItem={addImageVideoAudioItem}
|
||||
/>
|
||||
</div>
|
||||
<Source
|
||||
type="image"
|
||||
item={d => {
|
||||
if (d.urls.url.indexOf('.gif') !== -1) {
|
||||
return <img src={editor.movie.reURL(d.urls.url)} />;
|
||||
}
|
||||
return <img src={editor.movie.reURL(d.urls?.thumb)} />;
|
||||
}}
|
||||
itemClassName={styles.imgItem}
|
||||
// addItem={addImageVideoAudioItem}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import Text from './text';
|
||||
import Filter from './filter';
|
||||
import Effect from './effect';
|
||||
import Transition from './transition';
|
||||
// import Background from '../options/components/background';
|
||||
import Audio from './audio';
|
||||
import More from './more';
|
||||
import Lottie from './lottie';
|
||||
@@ -14,44 +13,41 @@ import Template from './template';
|
||||
import Caption from './caption';
|
||||
import AiComp from './ai';
|
||||
import { stores } from '@stores/index';
|
||||
// import styles from './sources.module.less';
|
||||
|
||||
export interface IProps {}
|
||||
|
||||
function Sources(props: IProps) {
|
||||
const { editor } = stores;
|
||||
const type = editor.sourceType;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Template show={editor.sourceType === 'template'} />
|
||||
<My show={editor.sourceType === 'my'} />
|
||||
<Caption show={editor.sourceType === 'caption'} />
|
||||
<Image show={editor.sourceType === 'image'} />
|
||||
<Audio show={editor.sourceType === 'audio'} />
|
||||
<Video show={editor.sourceType === 'video'} />
|
||||
<Text show={editor.sourceType === 'text'} />
|
||||
<Lottie show={editor.sourceType === 'lottie'} />
|
||||
<Filter show={editor.sourceType === 'filter'} />
|
||||
<Effect show={editor.sourceType === 'effect'} />
|
||||
<Transition show={editor.sourceType === 'transition'} />
|
||||
<AiComp show={editor.sourceType === 'ai'} />
|
||||
<More show={editor.sourceType === 'more'} />
|
||||
{type === 'template' ? <Template /> : null}
|
||||
{type === 'my' ? <My /> : null}
|
||||
{type === 'caption' ? <Caption /> : null}
|
||||
{type === 'image' ? <Image /> : null}
|
||||
{type === 'audio' ? <Audio /> : null}
|
||||
{type === 'video' ? <Video /> : null}
|
||||
{type === 'text' ? <Text /> : null}
|
||||
{type === 'lottie' ? <Lottie /> : null}
|
||||
{type === 'filter' ? <Filter /> : null}
|
||||
{type === 'effect' ? <Effect /> : null}
|
||||
{type === 'transition' ? <Transition /> : null}
|
||||
{type === 'ai' ? <AiComp /> : null}
|
||||
{type === 'more' ? <More /> : null}
|
||||
{editor.sides?.map(item => {
|
||||
const Panel = item.panel as any;
|
||||
if (!Panel) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
return type === item.type ? (
|
||||
<div
|
||||
style={{
|
||||
height: '100%',
|
||||
position: 'relative',
|
||||
display: editor.sourceType === item.type ? 'block' : 'none',
|
||||
}}
|
||||
style={{ height: '100%', position: 'relative' }}
|
||||
key={item.type}
|
||||
>
|
||||
<Panel editor={editor} show={editor.sourceType === item.type} />
|
||||
</div>
|
||||
);
|
||||
) : null;
|
||||
})}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -3,33 +3,17 @@ import styles from './lottie.module.less';
|
||||
import { addLottieItem } from '../addItem';
|
||||
import LottieItem from './LottieItem';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
// 判断是否加载了,只加载一次
|
||||
let hasRender = false;
|
||||
|
||||
export default function Lottie(props: IProps) {
|
||||
if (!hasRender) {
|
||||
if (props.show) {
|
||||
hasRender = true;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
export default function Lottie() {
|
||||
|
||||
return (
|
||||
<div style={{ height: '100%', display: props.show ? 'block' : 'none' }}>
|
||||
<Source
|
||||
type="sticker"
|
||||
item={d => {
|
||||
// console.log(d);
|
||||
return <LottieItem item={d} />;
|
||||
}}
|
||||
itemClassName={styles.imgItem}
|
||||
// addItem={addLottieItem}
|
||||
/>
|
||||
</div>
|
||||
<Source
|
||||
type="sticker"
|
||||
item={d => {
|
||||
// console.log(d);
|
||||
return <LottieItem item={d} />;
|
||||
}}
|
||||
itemClassName={styles.imgItem}
|
||||
// addItem={addLottieItem}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -8,20 +8,8 @@ import { QrcodeElement } from '@pages/editor/plugins/qrcode/ElementData';
|
||||
import { language } from '@language/language';
|
||||
import { stores } from '@stores/index';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
let hasRender = false;
|
||||
|
||||
export default function More(props: IProps) {
|
||||
export default function More() {
|
||||
const { editor } = stores;
|
||||
if (!hasRender) {
|
||||
if (props.show) {
|
||||
hasRender = true;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const addPlus = d => {
|
||||
console.log('添加插件', d);
|
||||
@@ -56,77 +44,75 @@ export default function More(props: IProps) {
|
||||
const languageType = language.getLanguage();
|
||||
|
||||
return (
|
||||
<div style={{ height: '100%', display: props.show ? 'block' : 'none' }}>
|
||||
<div className={styles.moreList + ' scroll'}>
|
||||
<h1 className={styles.title}>{language.val('more_plus')}</h1>
|
||||
<WaterFull
|
||||
itemWidth={60}
|
||||
itemClassName={styles.waterfull}
|
||||
item={(d: any) => {
|
||||
return (
|
||||
<div
|
||||
onClick={() => {
|
||||
addPlus(d);
|
||||
}}
|
||||
className={styles.item}
|
||||
>
|
||||
<span>
|
||||
{d.icon}
|
||||
<p>
|
||||
{d.vip && <VipOne theme="filled" size="14" fill="#FFA24D" />}
|
||||
{languageType === 'zh-CN' ? d.name : d.ename}
|
||||
</p>
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
list={[
|
||||
{
|
||||
id: 'qrcode',
|
||||
name: '二维码',
|
||||
ename: 'qrcode',
|
||||
icon: <PayCodeOne theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
},
|
||||
// {
|
||||
// id: 'magnifyingGlass',
|
||||
// name: '放大镜',
|
||||
// icon: <Search theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
// {
|
||||
// id: 'chart',
|
||||
// name: '动态图表',
|
||||
// vip: true,
|
||||
// icon: <ChartHistogramOne theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
// {
|
||||
// id: 'model3D',
|
||||
// name: '3D模型',
|
||||
// vip: true,
|
||||
// icon: <StereoPerspective theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
// {
|
||||
// id: 'peopleKeletonMan',
|
||||
// name: '人物',
|
||||
// vip: true,
|
||||
// icon: <SoccerOne theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
// {
|
||||
// id: 'watermark',
|
||||
// name: '水印',
|
||||
// vip: true,
|
||||
// icon: <Audit theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
// {
|
||||
// id: 'barrage',
|
||||
// name: '弹幕',
|
||||
// vip: true,
|
||||
// icon: <DanMuIcon theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
].map(d => {
|
||||
return { ...d, width: 100, height: 100 };
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.moreList + ' scroll'}>
|
||||
<h1 className={styles.title}>{language.val('more_plus')}</h1>
|
||||
<WaterFull
|
||||
itemWidth={60}
|
||||
itemClassName={styles.waterfull}
|
||||
item={(d: any) => {
|
||||
return (
|
||||
<div
|
||||
onClick={() => {
|
||||
addPlus(d);
|
||||
}}
|
||||
className={styles.item}
|
||||
>
|
||||
<span>
|
||||
{d.icon}
|
||||
<p>
|
||||
{d.vip && <VipOne theme="filled" size="14" fill="#FFA24D" />}
|
||||
{languageType === 'zh-CN' ? d.name : d.ename}
|
||||
</p>
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
list={[
|
||||
{
|
||||
id: 'qrcode',
|
||||
name: '二维码',
|
||||
ename: 'qrcode',
|
||||
icon: <PayCodeOne theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
},
|
||||
// {
|
||||
// id: 'magnifyingGlass',
|
||||
// name: '放大镜',
|
||||
// icon: <Search theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
// {
|
||||
// id: 'chart',
|
||||
// name: '动态图表',
|
||||
// vip: true,
|
||||
// icon: <ChartHistogramOne theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
// {
|
||||
// id: 'model3D',
|
||||
// name: '3D模型',
|
||||
// vip: true,
|
||||
// icon: <StereoPerspective theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
// {
|
||||
// id: 'peopleKeletonMan',
|
||||
// name: '人物',
|
||||
// vip: true,
|
||||
// icon: <SoccerOne theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
// {
|
||||
// id: 'watermark',
|
||||
// name: '水印',
|
||||
// vip: true,
|
||||
// icon: <Audit theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
// {
|
||||
// id: 'barrage',
|
||||
// name: '弹幕',
|
||||
// vip: true,
|
||||
// icon: <DanMuIcon theme="filled" size="25" fill="var(--theme-icon)" />,
|
||||
// },
|
||||
].map(d => {
|
||||
return { ...d, width: 100, height: 100 };
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import Decoding from './Decoding';
|
||||
import Intl from '@language/Intl';
|
||||
import { language } from '@language/language';
|
||||
import QrcodeUpload from './QrcodeUpload';
|
||||
import LottieItem from '../lottie/LottieItem';
|
||||
import { IconTreeTriangleDown } from '@douyinfe/semi-icons';
|
||||
import { config } from '@config/index';
|
||||
import { stores } from '@stores/index';
|
||||
@@ -661,6 +662,8 @@ export default function List(props: IProps) {
|
||||
<span className={styles.myAudioItem}>
|
||||
<Like theme="filled" size="60" fill="#FF6B6B" />
|
||||
</span>
|
||||
) : d.status !== 'ready' && d.type === 'sticker' ? (
|
||||
<LottieItem item={d} />
|
||||
) : (
|
||||
<img
|
||||
src={editor.movie.reURL(d.urls?.thumb || d.thumb)}
|
||||
|
||||
@@ -8,15 +8,11 @@ import { language, Intl } from '@language/index';
|
||||
import { stores } from '@stores/index';
|
||||
import { useState } from 'react';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
function Sources(props: IProps) {
|
||||
function Sources() {
|
||||
const { editor } = stores;
|
||||
const [activeKey, setActiveKey] = useState('1');
|
||||
return (
|
||||
<div className={styles.sources} style={{ display: props.show ? 'block' : 'none' }}>
|
||||
<>
|
||||
{editor.userInfo ? (
|
||||
<Tabs lazyRender={true} className={styles.tabs} type="line" activeKey={activeKey} onChange={setActiveKey}>
|
||||
<TabPane tab={language.val('my_tab_material')} itemKey="1">
|
||||
@@ -47,7 +43,7 @@ function Sources(props: IProps) {
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,47 +8,31 @@ import { Modal } from '@douyinfe/semi-ui';
|
||||
import { config } from '@config/index';
|
||||
import { stores } from '@stores/index';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
// 判断是否加载了,只加载一次
|
||||
let hasRender = false;
|
||||
|
||||
export default function Template(props: IProps) {
|
||||
export default function Template() {
|
||||
const { editor } = stores;
|
||||
if (!hasRender) {
|
||||
if (props.show) {
|
||||
hasRender = true;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ height: '100%', display: props.show ? 'block' : 'none' }}>
|
||||
<Source
|
||||
type="template"
|
||||
item={(d: any) => {
|
||||
return <img src={editor.movie.reURL(d.thumb)} />;
|
||||
}}
|
||||
itemClassName={styles.imgItem}
|
||||
addItem={item => {
|
||||
Modal.confirm({
|
||||
title: '系统提示',
|
||||
content: '模版替换会覆盖当前视频内容,是否继续?',
|
||||
onOk: async () => {
|
||||
console.log(item);
|
||||
const json = await $.get(editor.movie.reURL(item.url + '?t=' + +new Date()));
|
||||
transaction(() => {
|
||||
editor.data = util.reJSON(json) as MovieData;
|
||||
editor.movieDataUpdateKey = util.randomID();
|
||||
// editor.editMode = 'template';
|
||||
});
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Source
|
||||
type="template"
|
||||
item={(d: any) => {
|
||||
return <img src={editor.movie.reURL(d.thumb)} />;
|
||||
}}
|
||||
itemClassName={styles.imgItem}
|
||||
addItem={item => {
|
||||
Modal.confirm({
|
||||
title: '系统提示',
|
||||
content: '模版替换会覆盖当前视频内容,是否继续?',
|
||||
onOk: async () => {
|
||||
console.log(item);
|
||||
const json = await $.get(editor.movie.reURL(item.url + '?t=' + +new Date()));
|
||||
transaction(() => {
|
||||
editor.data = util.reJSON(json) as MovieData;
|
||||
editor.movieDataUpdateKey = util.randomID();
|
||||
// editor.editMode = 'template';
|
||||
});
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -4,15 +4,8 @@ import { addTextItem } from '../addItem';
|
||||
import { util } from '@utils/index';
|
||||
import { stores } from '@stores/index';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
export default function Text(props: IProps) {
|
||||
export default function Text() {
|
||||
const { editor } = stores;
|
||||
if (!props.show) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Source
|
||||
|
||||
@@ -4,35 +4,22 @@ import { addTransitionItem } from '../addItem';
|
||||
import { util } from '@utils/index';
|
||||
import { stores } from '@stores/index';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
let hasRender = false;
|
||||
|
||||
export default function Transition(props: IProps) {
|
||||
export default function Transition() {
|
||||
const { editor } = stores;
|
||||
if (!hasRender) {
|
||||
if (props.show) {
|
||||
hasRender = true;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ height: '100%', display: props.show ? 'block' : 'none' }}>
|
||||
<Source
|
||||
type="transition"
|
||||
item={d => {
|
||||
return (
|
||||
<>
|
||||
<img src={editor.movie.reURL(d.urls?.thumb)} />
|
||||
<span className={styles.name}>{d.name}</span>
|
||||
</>
|
||||
);
|
||||
}}
|
||||
itemClassName={styles.imgItem}
|
||||
// addItem={addTransitionItem}
|
||||
/>
|
||||
</div>
|
||||
<Source
|
||||
type="transition"
|
||||
item={d => {
|
||||
return (
|
||||
<>
|
||||
<img src={editor.movie.reURL(d.urls?.thumb)} />
|
||||
<span className={styles.name}>{d.name}</span>
|
||||
</>
|
||||
);
|
||||
}}
|
||||
itemClassName={styles.imgItem}
|
||||
// addItem={addTransitionItem}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -5,35 +5,22 @@ import { addImageVideoAudioItem } from '../addItem';
|
||||
import { util } from '@utils/index';
|
||||
import { stores } from '@stores/index';
|
||||
|
||||
export interface IProps {
|
||||
show: boolean;
|
||||
}
|
||||
let hasRender = false;
|
||||
|
||||
export default function Video(props: IProps) {
|
||||
export default function Video() {
|
||||
const { editor } = stores;
|
||||
if (!hasRender) {
|
||||
if (props.show) {
|
||||
hasRender = true;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ height: '100%', display: props.show ? 'block' : 'none' }}>
|
||||
<Source
|
||||
type="video"
|
||||
item={d => {
|
||||
return (
|
||||
<>
|
||||
<i className={styles.time}>{utils.secToTime(d.attrs?.duration || 0, 'mm:ss')}</i>
|
||||
<img src={editor.movie.reURL(d.urls?.thumb)} />
|
||||
</>
|
||||
);
|
||||
}}
|
||||
itemClassName={styles.videoItem}
|
||||
// addItem={addImageVideoAudioItem}
|
||||
/>
|
||||
</div>
|
||||
<Source
|
||||
type="video"
|
||||
item={d => {
|
||||
return (
|
||||
<>
|
||||
<i className={styles.time}>{utils.secToTime(d.attrs?.duration || 0, 'mm:ss')}</i>
|
||||
<img src={editor.movie.reURL(d.urls?.thumb)} />
|
||||
</>
|
||||
);
|
||||
}}
|
||||
itemClassName={styles.videoItem}
|
||||
// addItem={addImageVideoAudioItem}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -333,7 +333,6 @@ export default function useDragItem(params: Params) {
|
||||
if (canInsertIndex !== null) {
|
||||
$(`.tempInsertDom[data-insertindex="${canInsertIndex}"]`).addClass('tempInsertDomActive');
|
||||
}
|
||||
// console.log('canInsertIndex', canInsertIndex);
|
||||
|
||||
// canIn可插入判断
|
||||
canInIndex = null;
|
||||
@@ -350,7 +349,8 @@ export default function useDragItem(params: Params) {
|
||||
});
|
||||
})
|
||||
.on('mouseup.timelineDragElement', eu => {
|
||||
console.log('canInsert', canInsertIndex, canInIndex, editor.data);
|
||||
console.log('canInsertIndex------------------------------->', canInsertIndex);
|
||||
editor.tempInsertIndex = canInsertIndex;
|
||||
$('.tempInsertDom').remove();
|
||||
$(document).off('mousemove.timelineDragElement');
|
||||
$(document).off('mouseup.timelineDragElement');
|
||||
|
||||
+10
-12
@@ -216,6 +216,9 @@ export class Editor {
|
||||
public copyTempFrameData: any;
|
||||
public copyTempFrameDataType: string = '';
|
||||
|
||||
// 记录临时插入的位置
|
||||
public tempInsertIndex: number = null;
|
||||
|
||||
// 水印配置
|
||||
public watermark?: types.IWatermark;
|
||||
|
||||
@@ -229,21 +232,16 @@ export class Editor {
|
||||
@observable trackBodysKey: string = '1';
|
||||
|
||||
// 资源切换后,缓存list数据
|
||||
public activeItems: Record<ctypes.SourceType, SourceItem[]> = {};
|
||||
public activeItems: SourceItem[] = [];
|
||||
// 设置缓存数据
|
||||
setActiveItems = (items: SourceItem[], type: ctypes.SourceType) => {
|
||||
this.activeItems[type] = items;
|
||||
|
||||
// 测试用
|
||||
if (!(window as any).activeItems) {
|
||||
(window as any).activeItems = {};
|
||||
}
|
||||
(window as any).activeItems[type] = items;
|
||||
setActiveItems = (items: SourceItem[]) => {
|
||||
this.activeItems = items;
|
||||
};
|
||||
|
||||
// 从缓存数据中读取数据
|
||||
getFromActiveItems = (id: string, type: ctypes.SourceType) => {
|
||||
const items = this.activeItems[type] || [];
|
||||
getFromActiveItems = (id: string) => {
|
||||
// console.log('getFromActiveItems', id, this.activeItems);
|
||||
const items = this.activeItems || [];
|
||||
return items.find(d => d.id === id);
|
||||
};
|
||||
|
||||
@@ -916,7 +914,7 @@ export class Editor {
|
||||
this.movie = null;
|
||||
this.copyTempData = null;
|
||||
this.copyTempFrameData = null;
|
||||
this.activeItems = {};
|
||||
this.activeItems = [];
|
||||
this.watermark = null;
|
||||
this.previewSource = null;
|
||||
this.selectedElementIds = [];
|
||||
|
||||
Reference in new issue
Block a user