【问题标题】:Add Handsontable to Colorbox将 Handsontable 添加到 Colorbox
【发布时间】:2017-01-13 00:03:32
【问题描述】:
我想知道是否有其他人遇到过这个问题。我已经添加了可在颜色框中打开的可动手做,但是当我尝试复制并粘贴到可动手做时没有任何反应。我查看了 DOM 元素,并且 event.target 设置为 div#colorbox 而不是由 handsontable 创建的 textarea.copyPaste。所以我可以明白为什么这不起作用,但有人知道如何覆盖 event.target 以指向正确的目标。
谢谢
杰森
【问题讨论】:
标签:
javascript
dom
colorbox
handsontable
【解决方案1】:
好的,为什么这不起作用的问题是,由于 handsontable 正在渲染,它正在为这些值的复制和粘贴创建一个新的 div。这个 div 是在 colorbox 之外创建的,handsontable 无法访问,现在我在 handontable.full.js 中添加了 2 行,以将此 div 附加到 colorbox div 元素中,并且它正在工作。
这是暂时的修复。
【解决方案2】:
我遇到了同样的问题,所以我在颜色框内添加了可动手操作的代码:
<div id="cboxLoadedContent">
<!-- All colorbox code -->
<div id="CopyPasteDiv" style="position: fixed; top: -10000px; left: -10000px;">
<textarea class="copyPaste" style="width: 10000px; height: 10000px; overflow: hidden; opacity: 0;"></textarea>
</div>
</div>