1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Issue #87 - Media-Manager insert should now work correctly. (text selection/replacement does not at the moment)

This commit is contained in:
Cameron
2013-04-20 18:09:33 -07:00
parent cff013c5e5
commit e6c7cc420f
3 changed files with 18 additions and 14 deletions

View File

@@ -2,24 +2,21 @@ $(document).ready(function()
{
$(".e-dialog-save").live("click", function(){// FIXME TODO missing caret , text selection overwrite etc.
var newval = $('#bbcode_holder').val();
// alert(newval);
var target = $(this).attr('data-target');
if(!target){ return true; }
$('#' + target, window.top.document).atCaret('insert', newval); // http://code.google.com/p/jquery-at-caret/wiki/GettingStarted
//var cursorIndex = $('#' + target, window.top.document).attr("selectionStart");
//var lStr = $('#' + target, window.top.document).attr('value').substr(0,cursorIndex) + " " + newval + " ";
//var rStr = $('#' + target, window.top.document).attr('value').substr(cursorIndex);
//alert('hello');
if(!target){return true; }
//console.log($('#' + target, window.top.document).attr('value'));
var cursorIndex = $('#' + target, window.top.document).attr("selectionStart");
var lStr = $('#' + target, window.top.document).attr('value').substr(0,cursorIndex) + " " + newval + " ";
var rStr = $('#' + target, window.top.document).attr('value').substr(cursorIndex);
$('#' + target, window.top.document).attr('value',lStr+rStr);
$('#' + target, window.top.document).attr("selectionStart",lStr.length);
//$('#' + target, window.top.document).attr('value',lStr+rStr);
//$('#' + target, window.top.document).attr("selectionStart",lStr.length);
//('#' + target, window.top.document).insertAtCaret(newVal);
@@ -41,6 +38,9 @@ $(document).ready(function()
eMediaAttribute();
});
function eMediaAttribute(e)
{
var style = '';