FIX issues with quote button

Fix the following issues
- Quote button quotes only one word on iOS
- Quote reply popup should not come up when selecting the text in the ‘reply’ button
This commit is contained in:
Régis Hanol 2013-11-04 12:51:39 +01:00
parent 934ede7d91
commit 12ac2f2e99
10 changed files with 30 additions and 97 deletions

View File

@ -45,9 +45,7 @@ Discourse.QuoteButtonController = Discourse.Controller.extend({
cloned = range.cloneRange(),
$ancestor = $(range.commonAncestorContainer);
// don't display the "quote reply" button if you select text spanning two posts
// note: the ".contents" is here to prevent selection of the topic summary
if ($ancestor.closest('.topic-body > .contents').length === 0) {
if ($ancestor.closest('.cooked').length === 0) {
this.set('buffer', '');
return;
}

View File

@ -88,18 +88,18 @@ Discourse.Utilities = {
var html = '';
if (typeof window.getSelection !== "undefined") {
var sel = window.getSelection();
if (sel.rangeCount) {
var container = document.createElement("div");
for (var i = 0, len = sel.rangeCount; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
html = container.innerHTML;
var sel = window.getSelection();
if (sel.rangeCount) {
var container = document.createElement("div");
for (var i = 0, len = sel.rangeCount; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
html = container.innerHTML;
}
} else if (typeof document.selection !== "undefined") {
if (document.selection.type === "Text") {
html = document.selection.createRange().htmlText;
}
if (document.selection.type === "Text") {
html = document.selection.createRange().htmlText;
}
}
// Strip out any .click elements from the HTML before converting it to text

View File

@ -64,8 +64,8 @@ Discourse.QuoteButtonView = Discourse.View.extend({
})
.on('selectionchange', function() {
// there is no need to handle this event when the mouse is down
// or if there is not a touch in progress
if (view.get('isMouseDown') || !view.get('isTouchInProgress')) return;
// or if there a touch in progress
if (view.get('isMouseDown') || view.get('isTouchInProgress')) return;
// `selection.anchorNode` is used as a target
view.selectText(window.getSelection().anchorNode, controller);
});

View File

@ -55,23 +55,13 @@
// Border radius
@mixin border-radius-all($radius) {
border-radius: $radius;
}
@mixin border-radius-top($radius) {
border-top-right-radius: $radius;
border-top-left-radius: $radius;
}
@mixin border-radius-bottom($radius) {
border-bottom-right-radius: $radius;
border-bottom-left-radius: $radius;
border-radius: $radius;
}
// Box shadow
@mixin box-shadow($shadow) {
box-shadow: $shadow;
box-shadow: $shadow;
}
// Linear gradient
@ -81,32 +71,6 @@
background-image: linear-gradient(to bottom, $start-color, $end-color);
}
// Background size
@mixin background-size($size) {
background-size: $size;
}
// Background clip
@mixin background-clip($clip) {
background-clip: $clip;
}
// Rotate
@mixin rotate($degrees) {
-webkit-transform: rotate($degrees);
transform: rotate($degrees);
}
// Scale
@mixin scale($ratio) {
-webkit-transform: scale($ratio);
transform: scale($ratio);
}
// Transition
@mixin transition($transition) {
@ -138,12 +102,6 @@
}
}
@mixin fade-soft($time: 1s) {
-webkit-transition: opacity $time ease-in-out;
-ms-transition: opacity $time ease-in-out;
transition: opacity $time ease-in-out;
}
@mixin visible {
opacity: 1;
visibility: visible;
@ -151,16 +109,6 @@
transition-delay: 0s;
}
// Decorations
// --------------------------------------------------
// Glow
@mixin glow($color) {
border: 1px solid $color;
box-shadow: 0 0 5px $color;
}
//
// --------------------------------------------------

View File

@ -309,7 +309,7 @@
border: 1px dashed $gray;
overflow: auto;
visibility: visible;
&.hidden {
width: 0;
visibility: hidden;
@ -432,8 +432,7 @@ div.ac-wrap {
}
#wmd-input, #wmd-preview {
box-sizing: border-box;
-moz-box-sizing: border-box;
@include box-sizing(border-box);
width: 100%;
height: 100%;
min-height: 100%;
@ -453,7 +452,7 @@ div.ac-wrap {
top: 0;
height: 100%;
min-height: 100%;
box-sizing: border-box;
@include box-sizing(border-box);
border: 0;
border-top: 36px solid transparent;
@include border-radius-all(0);
@ -461,8 +460,7 @@ div.ac-wrap {
}
.textarea-wrapper, .preview-wrapper {
position: relative;
box-sizing: border-box;
-moz-box-sizing: border-box;
@include box-sizing(border-box);
height: 100%;
min-height: 100%;
margin: 0;

View File

@ -11,13 +11,14 @@
}
.post-actions {
@include unselectable;
clear: both;
text-align: right;
.post-action {
.post-action {
display: inline-block;
margin-left: 10px;
margin-top: 10px;
}
}
}
.post-menu-area {
margin-bottom: 10px;

View File

@ -78,9 +78,7 @@
.btn {
width: 100%;
margin-bottom: 5px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
@include box-sizing(border-box);
}
}
h2 {

View File

@ -389,8 +389,7 @@ div.ac-wrap {
}
#wmd-input, #wmd-preview {
box-sizing: border-box;
-moz-box-sizing: border-box;
@include box-sizing(border-box);
width: 100%;
height: 100%;
min-height: 100%;
@ -410,7 +409,7 @@ div.ac-wrap {
top: 0;
height: 100%;
min-height: 100%;
box-sizing: border-box;
@include box-sizing(border-box);
border: 0;
border-top: 36px solid transparent;
@include border-radius-all(0);
@ -418,8 +417,7 @@ div.ac-wrap {
}
.textarea-wrapper, .preview-wrapper {
position: relative;
box-sizing: border-box;
-moz-box-sizing: border-box;
@include box-sizing(border-box);
height: 100%;
min-height: 100%;
margin: 0;

View File

@ -147,9 +147,7 @@ $caption-subtitle-color: #BDBDBD !default;
left: 0;
top: 0;
padding: 0 $popup-padding-left;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
@include box-sizing(border-box);
}
// Vertical centerer helper
@ -453,9 +451,7 @@ button::-moz-focus-inner {
height: auto;
display: block;
line-height: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
@include box-sizing(border-box);
padding: $image-padding-top 0 $image-padding-bottom;
margin: 0 auto;
}
@ -534,9 +530,7 @@ button::-moz-focus-inner {
top: auto;
padding: 3px 5px;
position: fixed;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
@include box-sizing(border-box);
}
.mfp-img-mobile .mfp-bottom-bar:empty {
padding: 0;

View File

@ -73,9 +73,7 @@
.btn {
width: 100%;
margin-bottom: 5px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
@include box-sizing(border-box);
}
}
h2 {