@koi-br/ocr-web-sdk 1.0.51 → 1.0.52

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.
@@ -1,4 +1,4 @@
1
- import { g as getAugmentedNamespace, a as getDefaultExportFromCjs } from "./index-DDXh067T.mjs";
1
+ import { g as getAugmentedNamespace, a as getDefaultExportFromCjs } from "./index-C0NlHof9.mjs";
2
2
  function _mergeNamespaces(U, W) {
3
3
  for (var Z = 0; Z < W.length; Z++) {
4
4
  const s0 = W[Z];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koi-br/ocr-web-sdk",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "一个支持多种Office文件格式预览的Vue3组件SDK,包括PDF、Word、Excel、图片、OFD、TIF等格式",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -2059,7 +2059,6 @@ const saveAnnotation = () => {
2059
2059
  } else {
2060
2060
  // 添加新批注
2061
2061
  emit("annotation-add", annotation);
2062
- Message.success("批注已添加");
2063
2062
  }
2064
2063
 
2065
2064
  // 关闭输入框
@@ -2253,6 +2252,8 @@ const highlightPosition = (
2253
2252
  // 清除之前的高亮
2254
2253
  const hadHighlight = activeBlockDiv.value !== null && isHighlighted.value;
2255
2254
  if (activeBlockDiv.value) {
2255
+ // 移除动画类
2256
+ activeBlockDiv.value.classList.remove("highlight-animated");
2256
2257
  activeBlockDiv.value.style.backgroundColor = "transparent";
2257
2258
  activeBlockDiv.value.style.boxShadow = "none";
2258
2259
  activeBlockDiv.value.style.border = "none";
@@ -2346,6 +2347,65 @@ const highlightPosition = (
2346
2347
  elementRef.style.border = "none";
2347
2348
  }
2348
2349
 
2350
+ // 添加明显的放大-缩小动画
2351
+ // 保存原来的 transition 和 transform,临时禁用以避免与动画冲突
2352
+ const originalTransition = elementRef.style.transition || "";
2353
+ const originalTransform = elementRef.style.transform || "";
2354
+
2355
+ // 先移除可能存在的动画类,确保可以重新触发
2356
+ elementRef.classList.remove("highlight-animated");
2357
+
2358
+ // 强制浏览器重新计算样式(触发重排),确保动画可以重新开始
2359
+ void elementRef.offsetHeight;
2360
+
2361
+ // 使用 requestAnimationFrame 确保动画正确触发
2362
+ requestAnimationFrame(() => {
2363
+ // 临时禁用 transition,避免与动画的 transform 冲突
2364
+ elementRef.style.transition = "none";
2365
+ // 清除内联 transform,让动画的 transform 生效
2366
+ elementRef.style.transform = "";
2367
+ elementRef.style.transformOrigin = "center center";
2368
+
2369
+ // 使用内联样式直接设置动画(优先级最高)
2370
+ elementRef.style.animation = "highlightPulse 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 2";
2371
+ elementRef.style.animationFillMode = "forwards";
2372
+
2373
+ // 调试:检查动画是否应用
2374
+ const computedStyle = window.getComputedStyle(elementRef);
2375
+ console.log("跳转高亮动画已应用:", {
2376
+ element: elementRef,
2377
+ inlineAnimation: elementRef.style.animation,
2378
+ computedAnimation: computedStyle.animation,
2379
+ transform: computedStyle.transform,
2380
+ transformOrigin: computedStyle.transformOrigin,
2381
+ });
2382
+
2383
+ // 监听动画开始事件(用于调试)
2384
+ const handleAnimationStart = (e: AnimationEvent) => {
2385
+ console.log("动画开始", e);
2386
+ elementRef.removeEventListener("animationstart", handleAnimationStart);
2387
+ };
2388
+ elementRef.addEventListener("animationstart", handleAnimationStart);
2389
+
2390
+ // 监听动画结束事件,移除动画并恢复样式(确保动画可以重复触发)
2391
+ const handleAnimationEnd = (e: AnimationEvent) => {
2392
+ console.log("动画结束", e);
2393
+ // 清除动画
2394
+ elementRef.style.animation = "";
2395
+ elementRef.style.animationFillMode = "";
2396
+ elementRef.style.transform = "";
2397
+ elementRef.style.transformOrigin = "";
2398
+ // 恢复原来的 transition
2399
+ if (originalTransition) {
2400
+ elementRef.style.transition = originalTransition;
2401
+ } else {
2402
+ elementRef.style.transition = "all 0.2s ease";
2403
+ }
2404
+ elementRef.removeEventListener("animationend", handleAnimationEnd);
2405
+ };
2406
+ elementRef.addEventListener("animationend", handleAnimationEnd);
2407
+ });
2408
+
2349
2409
  // 只有在需要滚动且元素不在视口内时才滚动
2350
2410
  if (shouldScroll && containerRef.value) {
2351
2411
  const isVisible = isElementVisible(elementRef, containerRef.value);
@@ -2365,6 +2425,8 @@ const highlightPosition = (
2365
2425
  // 5秒后自动取消高亮
2366
2426
  setTimeout(() => {
2367
2427
  if (activeBlockDiv.value === elementRef && isHighlighted.value) {
2428
+ // 移除动画类
2429
+ elementRef.classList.remove("highlight-animated");
2368
2430
  elementRef.style.backgroundColor = "transparent";
2369
2431
  elementRef.style.boxShadow = "none";
2370
2432
  elementRef.style.border = "none";
@@ -2725,6 +2787,28 @@ defineExpose({
2725
2787
  });
2726
2788
  </script>
2727
2789
 
2790
+ <!-- 全局动画样式(非 scoped,供内联样式引用) -->
2791
+ <style lang="less">
2792
+ // 跳转高亮放大-缩小动画(明显的动画效果)
2793
+ @keyframes highlightPulse {
2794
+ 0% {
2795
+ transform: scale(1);
2796
+ }
2797
+ 25% {
2798
+ transform: scale(1.15);
2799
+ }
2800
+ 50% {
2801
+ transform: scale(1);
2802
+ }
2803
+ 75% {
2804
+ transform: scale(1.15);
2805
+ }
2806
+ 100% {
2807
+ transform: scale(1);
2808
+ }
2809
+ }
2810
+ </style>
2811
+
2728
2812
  <style lang="less" scoped>
2729
2813
  // 样式已统一到公共样式文件,这里只保留组件特定样式
2730
2814
  .toolbar-group {
@@ -3031,4 +3115,40 @@ defineExpose({
3031
3115
  transform: translateY(0);
3032
3116
  }
3033
3117
  }
3118
+
3119
+ // 跳转高亮放大-缩小动画(明显的动画效果)
3120
+ @keyframes highlightPulse {
3121
+ 0% {
3122
+ transform: scale(1);
3123
+ }
3124
+ 25% {
3125
+ transform: scale(1.15);
3126
+ }
3127
+ 50% {
3128
+ transform: scale(1);
3129
+ }
3130
+ 75% {
3131
+ transform: scale(1.15);
3132
+ }
3133
+ 100% {
3134
+ transform: scale(1);
3135
+ }
3136
+ }
3137
+
3138
+ // 跳转高亮动画类
3139
+ .text-block.highlight-animated {
3140
+ animation: highlightPulse 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
3141
+ // 闪烁两次后停止
3142
+ animation-iteration-count: 2;
3143
+ // 确保动画不影响布局(使用 transform 而不是改变尺寸)
3144
+ transform-origin: center center !important;
3145
+ // 确保 overflow 可见,允许放大时超出边界
3146
+ overflow: visible !important;
3147
+ // 优化动画性能
3148
+ will-change: transform !important;
3149
+ // 确保动画的 transform 能够正确应用,即使父元素也有 transform
3150
+ isolation: isolate;
3151
+ // 确保 z-index 足够高
3152
+ z-index: 30 !important;
3153
+ }
3034
3154
  </style>