需要突出显示并将文档从Google文档查看器复制到剪贴板 [英] Need to highlight and copy text from google doc viewer to clipboard

查看:233
本文介绍了需要突出显示并将文档从Google文档查看器复制到剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须创建一个流程,向用户显示文档,用户可以突出显示文本并复制(并最终粘贴)文档某些部分的文本。

I have to create a process where a document is shown to the user and the user can highlight text and copy (and eventually paste) the text from some portions of the document.

我在iframe中使用谷歌文档查看器(因为我需要一个免费的通用文档查看器 - 虽然我对观众的其他想法持开放态度)。谷歌文档查看器做我需要的,但似乎我无法访问iframe的内部以获得突出显示的内容。

I am using google doc viewer in an iframe (since I need a universal doc viewer that's free - although I'm open to other ideas on viewers). Google doc viewer does what I need but it seems that I don't have access to the internals of the iframe to get the highlighted contents.

我看过很多与在javascript中触发副本(cntl-c)相关的链接,但在此过程中没有任何确定。

I've looked at many links related to triggering a copy (cntl-c) in javascript, but nothing firm in the process.

理想情况下,我想在iframe外部点击一个按钮,将按钮复制到剪贴板中,用户在google doc viewer内部进行选择。

Ideally I would like a button outside of the iframe to click on which would copy to the clipboard the selection a user made inside of the google doc viewer.

有关如何实现此目的的任何建议吗?

Any suggestion on how to achieve this?

推荐答案

利用 window.getSelection();

tutorial: http://mark.koli.ch/2009/09/use-javascript-and -jquery-to-get-user-selected-text.html

tutorial: http://mark.koli.ch/2009/09/use-javascript-and-jquery-to-get-user-selected-text.html

这篇关于需要突出显示并将文档从Google文档查看器复制到剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆