소스 검색

Fix pasting of emoji (#722)

Danilo Bargen 7 년 전
부모
커밋
ee66fcf0c6
1개의 변경된 파일1개의 추가작업 그리고 23개의 파일을 삭제
  1. 1 23
      src/directives/compose_area.ts

+ 1 - 23
src/directives/compose_area.ts

@@ -435,12 +435,11 @@ export default [
                         const escaped = escapeHtml(text);
 
                         // Apply filters (emojify, convert newline, etc)
-                        const formatted = replaceWhitespace(nlToBr(mentionify(emojify(escaped)), true));
+                        const formatted = emojify(mentionify(replaceWhitespace(nlToBr(escaped, true))));
 
                         // Insert resulting HTML
                         document.execCommand('insertHTML', false, formatted);
 
-                        cleanupComposeContent();
                         updateView();
                     }
                 }
@@ -601,7 +600,6 @@ export default [
                     caretPosition.toChar = caretPosition.fromChar;
 
                     contentElement.innerHTML = currentHtml;
-                    cleanupComposeContent();
                     setCaretPosition(newPos);
 
                     // Update the draft text
@@ -631,26 +629,6 @@ export default [
                     fileInput.val('');
                 }
 
-                // Disable content editable and dragging for contained images (emoji)
-                function cleanupComposeContent() {
-                    for (const img of composeDiv[0].getElementsByTagName('img')) {
-                        img.ondragstart = () => false;
-                    }
-                    for (const span of composeDiv[0].getElementsByTagName('span')) {
-                        span.setAttribute('contenteditable', false);
-                    }
-
-                    if (browserService.getBrowser().isFirefox(false)) {
-                        // Disabling object resizing is the only way to disable resizing of
-                        // emoji (contenteditable must be true, otherwise the emoji can not
-                        // be removed with backspace (in FF))
-                        //
-                        // Note: This is not required anymore for FF63+ (but
-                        // please test before removing it to make sure).
-                        (document.execCommand as any)('enableObjectResizing', false, false);
-                    }
-                }
-
                 // Set all correct styles
                 function updateView() {
                     if (composeAreaIsEmpty()) {