From 2529104a3b37cffd9405f262afd2c5b43c08b30c Mon Sep 17 00:00:00 2001 From: lijisanxiong <1518062161@qq.com> Date: Thu, 11 Dec 2025 20:20:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat=EF=BC=9A=E4=BC=98=E5=8C=96ai=E8=A1=8C?= =?UTF-8?q?=E5=86=85=E8=81=8A=E5=A4=A9=E7=BB=84=E4=BB=B6=E8=B7=9F=E9=9A=8F?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E9=80=BB=E8=BE=91=EF=BC=8C=E9=80=82=E9=85=8D?= =?UTF-8?q?=E6=80=9D=E8=80=83=E4=BF=A1=E6=81=AF=E4=B8=8E=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E4=BF=A1=E6=81=AF=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inline-ai-textarea/inline-ai-textarea.hook.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.ts b/src/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.ts index f9c10524d..e96795b65 100644 --- a/src/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.ts +++ b/src/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.ts @@ -14,6 +14,7 @@ import { onMounted, onUnmounted, CSSProperties, + computed, } from 'vue'; import { IAppDEACMode, IAppDataEntity } from '@ibiz/model-core'; import { calcResPath, IInLineAiChatOptions } from '@ibiz-template/runtime'; @@ -521,8 +522,15 @@ export const useBase = ( 'max-height': `${options.maxHeight || (options.height && options.height > 300 ? options.height : 300)}px`, }); + /** + * 工具调用信息 + */ + const toolcalls = computed(() => { + return message.value.toolcalls || []; + }); + watch( - () => message.value.content, + () => [toolcalls.value.length, message.value.think, message.value.content], () => { nextTick(() => { // 根据内容自适应高度 -- Gitee From 10d70aa019427090554fc00ee14cde7e128919ef Mon Sep 17 00:00:00 2001 From: lijisanxiong <1518062161@qq.com> Date: Thu, 11 Dec 2025 20:25:35 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat=EF=BC=9A=E4=BC=98=E5=8C=96=E5=B1=8F?= =?UTF-8?q?=E5=B9=95=E6=88=AA=E5=9B=BE=E5=B7=A5=E5=85=B7=E6=A0=8F=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E9=BC=A0=E6=A0=87=E5=BD=A2=E7=8A=B6=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E9=80=89=E6=8B=A9=E7=9A=84=E5=B7=A5=E5=85=B7=E6=A0=8F?= =?UTF-8?q?=E9=A1=B9=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/screen-shot/screen-shot.scss | 16 ++++++++++++++++ .../components/screen-shot/screen-shot.tsx | 7 ++++++- .../controller/screen-shot.controller.ts | 1 + .../screen-shot/controller/screen-shot.store.ts | 7 +++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.scss b/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.scss index f4b09a45f..2da3e1e02 100644 --- a/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.scss +++ b/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.scss @@ -49,4 +49,20 @@ $screen-shot: ( display: block; } } + + &.#{bem('screen-shot','','brush')}, + &.#{bem('screen-shot','','rect')}, + &.#{bem('screen-shot','','circle')}, + &.#{bem('screen-shot','','mosaic')}, + &.#{bem('screen-shot','','arrow')} { + .#{bem('screen-shot', 'canvas')} { + cursor: crosshair; + } + } + + &.#{bem('screen-shot','','text')} { + .#{bem('screen-shot', 'canvas')} { + cursor: text; + } + } } diff --git a/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx b/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx index 895ce3528..5d04451eb 100644 --- a/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx +++ b/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx @@ -82,7 +82,12 @@ export const ScreenShot = defineComponent({ render() { return (
this.c.mouseUpEvent()} > diff --git a/src/util/screen-shot-util/screen-shot/controller/screen-shot.controller.ts b/src/util/screen-shot-util/screen-shot/controller/screen-shot.controller.ts index b20890d8e..3dca5a789 100644 --- a/src/util/screen-shot-util/screen-shot/controller/screen-shot.controller.ts +++ b/src/util/screen-shot-util/screen-shot/controller/screen-shot.controller.ts @@ -291,6 +291,7 @@ export class ScreenShotController { if (toolName === ToolbarItemType.DRAWDOWN) this.goBackToHistory(); this.brushOption = opt; this.toolName = toolName; + this.store.toolbarName.value = toolName; this.endTextEditing(); } diff --git a/src/util/screen-shot-util/screen-shot/controller/screen-shot.store.ts b/src/util/screen-shot-util/screen-shot/controller/screen-shot.store.ts index 81d3fbac6..3144ef568 100644 --- a/src/util/screen-shot-util/screen-shot/controller/screen-shot.store.ts +++ b/src/util/screen-shot-util/screen-shot/controller/screen-shot.store.ts @@ -41,6 +41,13 @@ export class ScreenShotStore { */ toolbarStatus: Ref = ref(false); + /** + * @description 当前工具名称 + * @type {Ref} + * @memberof ScreenShotStore + */ + toolbarName: Ref = ref(); + /** * @description 历史 * @type {Ref<{ data: ImageData }[]>} -- Gitee From 4ece958ddaa8db366be12db6aafa407b91275c66 Mon Sep 17 00:00:00 2001 From: lijisanxiong <1518062161@qq.com> Date: Thu, 11 Dec 2025 20:27:06 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=B1=8F?= =?UTF-8?q?=E5=B9=95=E6=88=AA=E5=9B=BE=E5=B7=A5=E5=85=B7=E6=A0=8F=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E9=80=89=E6=8B=A9=E5=99=A8=E5=B1=82=E7=BA=A7=E4=BD=8E?= =?UTF-8?q?=E4=BA=8E=E7=BB=98=E5=9B=BE=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen-shot/components/screen-shot/screen-shot.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.scss b/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.scss index 2da3e1e02..20466a0aa 100644 --- a/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.scss +++ b/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.scss @@ -23,7 +23,7 @@ $screen-shot: ( position: absolute; top: 40px; left: 50%; - z-index: 1; + z-index: 2; transform: translateX(-50%); } -- Gitee From 6527e6a2b5383923327963383198677fb52f66d9 Mon Sep 17 00:00:00 2001 From: lijisanxiong <1518062161@qq.com> Date: Thu, 11 Dec 2025 20:30:29 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feat=EF=BC=9A=E6=96=B0=E5=A2=9E=E5=B1=8F?= =?UTF-8?q?=E5=B9=95=E6=88=AA=E5=9B=BE=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E9=80=BB=E8=BE=91=EF=BC=8C=E6=94=AF=E6=8C=81=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=A0=8F=E6=8C=89=E9=92=AE=E7=82=B9=E5=87=BB=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E5=8F=8Aesc=E6=8C=89=E9=94=AE=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/screen-shot/screen-shot.tsx | 27 ++++++++++++++++++- .../screen-shot/constant/index.ts | 7 +++++ .../screen-shot/icon/icon.tsx | 15 +++++++++++ .../screen-shot/type/index.ts | 1 + 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx b/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx index 5d04451eb..236251962 100644 --- a/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx +++ b/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx @@ -1,5 +1,5 @@ import { useNamespace } from '@ibiz-template/vue3-util'; -import { PropType, defineComponent, onMounted } from 'vue'; +import { PropType, defineComponent, onMounted, onUnmounted } from 'vue'; import { ScreenShotController } from '../../controller'; import { IBrushOption, ToolbarItemType } from '../../type'; import { ScreenShotToolbar } from '../screen-shot-toolbar/screen-shot-toolbar'; @@ -46,6 +46,13 @@ export const ScreenShot = defineComponent({ textInputElement, } = c.store; + /** + * @description 处理组件关闭 + */ + const handleClose = (): void => { + emit('cancel'); + }; + /** * @description 处理工具栏点击 * @param {ToolbarItemType} type 工具栏类型 @@ -55,16 +62,34 @@ export const ScreenShot = defineComponent({ type: ToolbarItemType, opt: IBrushOption, ): void => { + if (type === ToolbarItemType.CLOSE) { + handleClose(); + return; + } c.onToolClick(type, opt); if (type === ToolbarItemType.AI) emit('complete', canvasElement.value!.toDataURL('png')); }; + /** + * @description 处理按键事件 + * @param {KeyboardEvent} e + */ + const keydownHandle = (e: KeyboardEvent): void => { + // 监听 ESC 键 + if (e.code === 'Escape') handleClose(); + }; + onMounted(() => { c.domToCanvas(props.element, { container: props.container, itemClassName: props.itemClassName, }); + document.addEventListener('keydown', keydownHandle); + }); + + onUnmounted(() => { + document.removeEventListener('keydown', keydownHandle); }); return { diff --git a/src/util/screen-shot-util/screen-shot/constant/index.ts b/src/util/screen-shot-util/screen-shot/constant/index.ts index 742442a0f..0bde79232 100644 --- a/src/util/screen-shot-util/screen-shot/constant/index.ts +++ b/src/util/screen-shot-util/screen-shot/constant/index.ts @@ -7,6 +7,7 @@ import { CircleIcon, MosaicIcon, DrawdownIcon, + CloseIcon, } from '../icon'; import { IToolbarItem, ToolbarItemType } from '../type'; @@ -178,5 +179,11 @@ export function getDefaultToolbarItems(): IToolbarItem[] { type: ToolbarItemType.AI, text: 'AI', }, + { + // 关闭 + icon: CloseIcon, + type: ToolbarItemType.CLOSE, + text: ibiz.i18n.t('app.close'), + }, ]; } diff --git a/src/util/screen-shot-util/screen-shot/icon/icon.tsx b/src/util/screen-shot-util/screen-shot/icon/icon.tsx index f65f1efe7..9bde9064f 100644 --- a/src/util/screen-shot-util/screen-shot/icon/icon.tsx +++ b/src/util/screen-shot-util/screen-shot/icon/icon.tsx @@ -125,3 +125,18 @@ export const DrawdownIcon = ( > ); + +export const CloseIcon = ( + + + +); diff --git a/src/util/screen-shot-util/screen-shot/type/index.ts b/src/util/screen-shot-util/screen-shot/type/index.ts index e71a13833..66c2a475b 100644 --- a/src/util/screen-shot-util/screen-shot/type/index.ts +++ b/src/util/screen-shot-util/screen-shot/type/index.ts @@ -11,6 +11,7 @@ export enum ToolbarItemType { AI = 'ai', // AI功能 MOSAIC = 'mosaic', // 马赛克 DRAWDOWN = 'drawdown', // 回撤 + CLOSE = 'close', // 关闭 } /** -- Gitee From a4a2b18ea313ac7b0c4507d27fe0067f030b1564 Mon Sep 17 00:00:00 2001 From: lijisanxiong <1518062161@qq.com> Date: Thu, 11 Dec 2025 20:32:17 +0800 Subject: [PATCH 5/6] =?UTF-8?q?feat=EF=BC=9A=E6=96=B0=E5=A2=9E=E5=B1=8F?= =?UTF-8?q?=E5=B9=95=E6=88=AA=E5=9B=BE=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=89=8D?= =?UTF-8?q?=E8=BF=9B=E4=B8=8E=E5=9B=9E=E9=80=80=E9=80=BB=E8=BE=91=EF=BC=88?= =?UTF-8?q?ctrl+z=E5=9B=9E=E9=80=80=E3=80=81ctrl+y=E5=89=8D=E8=BF=9B?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen-shot-toolbar.tsx | 2 +- .../components/screen-shot/screen-shot.tsx | 9 ++++ .../controller/screen-shot.controller.ts | 42 +++++++++++++++++-- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.tsx b/src/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.tsx index 9adb7b8f7..e525f12bf 100644 --- a/src/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.tsx +++ b/src/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.tsx @@ -85,7 +85,7 @@ export const ScreenShotToolbar = defineComponent({ this.ns.is( 'disabled', item.type === ToolbarItemType.DRAWDOWN && - !this.history.length, + this.history.length <= 1, ), ]} onClick={() => this.handleItemClick(item)} diff --git a/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx b/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx index 236251962..43bfee699 100644 --- a/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx +++ b/src/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.tsx @@ -78,6 +78,15 @@ export const ScreenShot = defineComponent({ const keydownHandle = (e: KeyboardEvent): void => { // 监听 ESC 键 if (e.code === 'Escape') handleClose(); + + // Ctrl + Z + if (e.ctrlKey && e.code === 'KeyZ') { + c.goBackToHistory(); + } + // Ctrl + Y + if (e.ctrlKey && e.code === 'KeyY') { + c.goForwardToHistory(); + } }; onMounted(() => { diff --git a/src/util/screen-shot-util/screen-shot/controller/screen-shot.controller.ts b/src/util/screen-shot-util/screen-shot/controller/screen-shot.controller.ts index 3dca5a789..f4fadcaee 100644 --- a/src/util/screen-shot-util/screen-shot/controller/screen-shot.controller.ts +++ b/src/util/screen-shot-util/screen-shot/controller/screen-shot.controller.ts @@ -96,6 +96,14 @@ export class ScreenShotController { */ private drawArrow = new DrawArrow(); + /** + * @description 前进历史栈 - 存储被撤销的操作 + * @private + * @type {Array<{ data: ImageData }>} + * @memberof ScreenShotController + */ + private redoHistory: Array<{ data: ImageData }> = []; + /** * Creates an instance of ScreenShotController. * @memberof ScreenShotController @@ -137,6 +145,9 @@ export class ScreenShotController { controller.height, ), }); + + // 新增操作时清空前进栈 + this.redoHistory = []; } /** @@ -144,14 +155,39 @@ export class ScreenShotController { * @private * @memberof ScreenShotController */ - private goBackToHistory(): void { - if (!this.store.history.value.length) return; - this.store.history.value.pop(); + goBackToHistory(): void { + if (this.store.history.value.length <= 1) return; + // 结束文本编辑 + this.endTextEditing(); + // 弹出最后一条历史并保存到前进栈 + const poppedHistory = this.store.history.value.pop(); + if (poppedHistory) { + this.redoHistory.push(poppedHistory); + } const data = this.store.history.value[this.store.history.value.length - 1]?.data; if (this.canvasCtx && data) this.canvasCtx.putImageData(data, 0, 0); } + /** + * @description 前进历史(重做) + * @memberof ScreenShotController + */ + goForwardToHistory(): void { + // 前进栈为空时直接返回 + if (!this.redoHistory.length) return; + // 结束文本编辑 + this.endTextEditing(); + // 从前进栈弹出最后一条记录 + const forwardHistory = this.redoHistory.pop(); + if (!forwardHistory || !this.canvasCtx) return; + + // 将前进记录添加回撤销栈 + this.store.history.value.push(forwardHistory); + // 恢复画布状态 + this.canvasCtx.putImageData(forwardHistory.data, 0, 0); + } + /** * @description 启用文本编辑 * @private -- Gitee From a97c9381786642b007cfca52d2bd562ca81f8110 Mon Sep 17 00:00:00 2001 From: lijisanxiong <1518062161@qq.com> Date: Thu, 11 Dec 2025 20:32:31 +0800 Subject: [PATCH 6/6] =?UTF-8?q?feat=EF=BC=9A=E6=9B=B4=E6=96=B0CHANGELOG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ae94aff7..12a266179 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,20 @@ ## [Unreleased] +### Added + +- 新增屏幕截图工具栏关闭逻辑,支持工具栏按钮点击关闭及esc按键关闭 +- 新增屏幕截图工具栏前进与回退逻辑(ctrl+z回退、ctrl+y前进) + +### Changed + +- 优化ai行内聊天组件跟随滚动逻辑,适配思考信息与工具调用信息场景 +- 优化屏幕截图工具栏样式,鼠标形状根据选择的工具栏项变化 + +### Fixed + +- 修复屏幕截图工具栏颜色选择器层级低于绘图元素 + ## [0.7.41-alpha.49] - 2025-12-11 ### Changed -- Gitee