diff --git a/editor/svg-editor.js b/editor/svg-editor.js index b6dd66be..eeb7a261 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -1469,7 +1469,10 @@ $('#font_size').val(elem.getAttribute("font-size")); $('#text').val(elem.textContent); if (svgCanvas.addedNew) { - $('#text').focus().select(); + // Timeout needed for IE9 + setTimeout(function() { + $('#text').focus().select(); + },100); } } // text else if(el_name == 'image') { diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 5aeb1869..1aeeeb80 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -11095,7 +11095,28 @@ this.getPrivateMethods = function() { return obj; }; -// console.log('canvas.getPrivateMethods',canvas.getPrivateMethods); +// Temporary fix until MS fixes: +// https://connect.microsoft.com/IE/feedback/details/599257/ +function disableAdvancedTextEdit() { + var curtext; + var textInput = $('#text').css({ + position: 'static' + }); + + $.each(['mouseDown','mouseUp','mouseMove', 'setCursor', 'init', 'select', 'toEditMode'], function() { + textActions[this] = $.noop; + }); + + textActions.init = function(elem) { + curtext = elem; + $(curtext).unbind('dblclick').bind('dblclick', function() { + textInput.focus(); + }); + } + + canvas.textActions = textActions; + +} // Test support for features/bugs (function() { @@ -11118,6 +11139,19 @@ this.getPrivateMethods = function() { support.pathInsertItemBefore = false; } + var text = document.createElementNS(svgns,'text'); + text.textContent = 'a'; + + // text character positioning + try { + text.getStartPositionOfChar(0); + support.textCharPos = true; + } catch(err) { + support.textCharPos = false; + + disableAdvancedTextEdit(); + } + // TODO: Find better way to check support for this support.editableText = isOpera;