Skip to content

Commit

Permalink
Fixed bug in markItUp-editor causing feature detection being used inc…
Browse files Browse the repository at this point in the history
…orrectly
  • Loading branch information
Chi Shang Cheng committed Jun 28, 2011
1 parent aee8846 commit b988ffa
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions fiber/static/fiber/js/fiber.markitup.js
Expand Up @@ -7,9 +7,6 @@ Fiber.enhance_textarea = function(textarea) {
// Helper class to retrieve/replace user text selection in IE
var UserSelectionIE = function() {
this.textRange = (document.selection && document.selection.createRange) ? document.selection.createRange() : false;
if (!this.textRange) {
return false;
}
};
UserSelectionIE.prototype.markItUp = function(options) {
if (this.textRange && options) {
Expand Down Expand Up @@ -41,7 +38,7 @@ Fiber.enhance_textarea = function(textarea) {
page_select_dialog.action_click = function() {
var selected_page_path = this.uiDialog.find('a.ui-state-active').attr('href');

if (userSelectionIE) {
if (userSelectionIE.textRange) {
// Replace textarea selection for IE
userSelectionIE.markItUp({
openWith: '"',
Expand Down Expand Up @@ -70,7 +67,7 @@ Fiber.enhance_textarea = function(textarea) {
file_select_dialog.action_click = function() {
var selected_file_path = $(this.uiDialog.find('tr.ui-state-highlight td')[0]).text();

if (userSelectionIE) {
if (userSelectionIE.textRange) {
// Replace textarea selection for IE
userSelectionIE.markItUp({
openWith: '"',
Expand Down Expand Up @@ -99,7 +96,7 @@ Fiber.enhance_textarea = function(textarea) {
image_select_dialog.action_click = function() {
var selected_image_path = $(this.uiDialog.find('tr.ui-state-highlight td')[0]).text();

if (userSelectionIE) {
if (userSelectionIE.textRange) {
// Replace textarea selection for IE
userSelectionIE.markItUp({
openWith: '"',
Expand Down Expand Up @@ -129,7 +126,7 @@ Fiber.enhance_textarea = function(textarea) {
var selected_image_path = $(this.uiDialog.find('tr.ui-state-highlight td')[0]).text();
var selected_image_textile = '!' + selected_image_path + '!';

if (userSelectionIE) {
if (userSelectionIE.textRange) {
// Replace textarea selection for IE
userSelectionIE.markItUp({
replaceWith: selected_image_textile
Expand Down

0 comments on commit b988ffa

Please sign in to comment.