From 0356c9e60c3629c85c65e995ee35db57c5dc91c7 Mon Sep 17 00:00:00 2001 From: benweet Date: Thu, 12 Jun 2014 21:13:48 +0100 Subject: [PATCH] Fixed HTML code paste --- public/res/editor.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/public/res/editor.js b/public/res/editor.js index 2510a7a4..86fc527a 100644 --- a/public/res/editor.js +++ b/public/res/editor.js @@ -758,16 +758,11 @@ define([ .on('mouseup', _.bind(selectionMgr.saveSelectionState, selectionMgr, true, false)) .on('paste', function(evt) { undoMgr.currentMode = 'paste'; + evt.preventDefault(); + var data = (evt.originalEvent || evt).clipboardData.getData('text/plain') || prompt('Paste something...'); + data = escape(data); adjustCursorPosition(); - try { - var data = evt.originalEvent.clipboardData.getData("text/plain"); - if(data) { - evt.preventDefault(); - document.execCommand("insertHTML", false, data); - } - } - catch(e) { - } + document.execCommand('insertHtml', false, data); }) .on('cut', function() { undoMgr.currentMode = 'cut';