mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-11 05:56:11 +00:00
82cbb4a8ba
Change-Id: I5f0aeb01da789030117028ff4cb014f4c07fab8d
42 lines
1.6 KiB
HTML
42 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html>
|
|
<head>
|
|
<title>iFrame Selection Demo</title>
|
|
<style>
|
|
.myframe {
|
|
background: #EEE;
|
|
border: 1px solid #AAA;
|
|
bottom: 5px;
|
|
display: none;
|
|
height: 50px;
|
|
position: absolute;
|
|
right: 5px;
|
|
width: 200px;
|
|
}
|
|
</style>
|
|
<script src="../../modules/rangy/rangy-core.js"></script>
|
|
<script src="../../modules/jquery/jquery.js"></script>
|
|
</head>
|
|
<body>
|
|
<div contenteditable="true">
|
|
<p>This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document.</p>
|
|
</div>
|
|
<iframe class="myframe" src="iframe2.html"></iframe>
|
|
<script>
|
|
$(function() {
|
|
$('body').on('mouseup', function() {
|
|
var sel = rangy.getSelection();
|
|
var range = sel.getRangeAt(0);
|
|
|
|
if (!range.collapsed) {
|
|
$('iframe').show();
|
|
} else {
|
|
$('iframe').hide();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|