Pārlūkot izejas kodu

修复表情链接可能获取不正确

zhangchao 4 gadus atpakaļ
vecāks
revīzija
3fac0438c3
3 mainītis faili ar 5 papildinājumiem un 5 dzēšanām
  1. 2
    2
      src/RichTextEditor.js
  2. 1
    1
      src/WebviewMessageHandler.js
  3. 2
    2
      src/editor.html

+ 2
- 2
src/RichTextEditor.js Parādīt failu

@@ -462,8 +462,8 @@ export default class RichTextEditor extends Component {
462 462
     this._sendAction(actions.insertImage, url);
463 463
   }
464 464
 
465
-  insertEmoji(url) {
466
-    this._sendAction(actions.insertEmoji, url);
465
+  insertEmoji(url, tag) {
466
+    this._sendAction(actions.insertEmoji, { tag, url });
467 467
   }
468 468
 
469 469
   deleteEmoji(url) {

+ 1
- 1
src/WebviewMessageHandler.js Parādīt failu

@@ -63,7 +63,7 @@ export const MessageConverter = (action) => {
63 63
     case `${actions.insertImage}`:
64 64
       return `zss_editor.insertImage('${action.data}');`;
65 65
     case `${actions.insertEmoji}`:
66
-        return `zss_editor.insertEmoji('${action.data}');`;
66
+        return `zss_editor.insertEmoji('${action.data.url}', '${action.data.tag}');`;
67 67
     case `${actions.deleteEmoji}`:
68 68
         return `zss_editor.deleteEmoji();`;
69 69
     case `${actions.setSubscript}`:

+ 2
- 2
src/editor.html Parādīt failu

@@ -1357,9 +1357,9 @@
1357 1357
 				zss_editor.enabledEditingItems();
1358 1358
 			}
1359 1359
 
1360
-			zss_editor.insertEmoji = function(url) {
1360
+			zss_editor.insertEmoji = function(url, tag) {
1361 1361
 				zss_editor.restorerange();
1362
-				document.execCommand('insertHTML', false, '<img class="emoji" src="' + encodeHtmlEntities(url) + '"/>');
1362
+				document.execCommand('insertHTML', false, '<img tag="' + tag + '" class="emoji" src="' + encodeHtmlEntities(url) + '"/>');
1363 1363
 				zss_editor.backuprange(true);
1364 1364
 				zss_editor.blurContentEditor();
1365 1365
 				zss_editor.enabledEditingItems();