Inserting content: always insert at start in IE 7

6 views
Skip to first unread message

Barryvan

unread,
Jun 20, 2010, 11:26:43 PM6/20/10
to MooEditable
Hi,

I'm attempting to insert content into a MooEditable-ified textarea
dynamically, in response to a user's actions. (It's from a symbol
dialog that I wrote before the official one came around, with a few
bespoke features for the app I'm working on.) Everything works
fantastically in IE8 and Fx, but in IE7, the content is always
inserted at the beginning of the text.

My working hypothesis is that IE7 isn't preserving the selection
information when the editor loses focus, but I'm having trouble
ascertaining whether or not that is, in fact, the case. In the
'command' handler for my custom action, I've tried temporarily storing
the range and using setRange() before the content is inserted, but
this doesn't seem to work either: it looks like when you focus() the
editor (as getRange() does), IE pushes the cursor to the beginning.

I've had a look through the code for the supplied character map, and I
can't really see that I'm doing anything differently. The action code
is as follows (here's hoping the tabs don't get lost!):

if (window['MooEditable'] && MooEditable.Actions) {
MooEditable.Actions.extend({
symbol: {
title: 'Add Symbol',
command: function() {
if (!this.symbolDialog) {
this.symbolDialog = new xxx.ui.SymbolDialog({
onAccept: function(symbol) {
this.selection.insertContent(symbol);
}.bind(this)
});
}
this.symbolDialog.show();
}
}
});
}

The dialog itself creates a whole lot of divs that contain the various
symbols; when the user clicks on one, the 'onAccept' event is fired
with the clicked element's content. Any thoughts?

- Barry van Oudtshoorn
Reply all
Reply to author
Forward
0 new messages