Procházet zdrojové kódy

feat: fix emoji preview

https://youtrack.weseek.co.jp/issue/GW-7732
- Add markdown-it-emoji-mart
I Komang Mudana před 4 roky
rodič
revize
60e30eed6e

+ 1 - 0
packages/app/package.json

@@ -181,6 +181,7 @@
     "diff2html": "^3.1.2",
     "eazy-logger": "^3.1.0",
     "emoji-mart": "^3.0.1",
+    "markdown-it-emoji-mart": "^0.1.1",
     "file-loader": "^5.0.2",
     "handsontable": "=6.2.2",
     "hard-source-webpack-plugin": "^0.13.1",

+ 2 - 2
packages/app/src/components/PageEditor/EmojiPickerHelper.ts

@@ -23,7 +23,7 @@ addEmojiOnSearch = (emoji) => {
   const currentPos = this.editor.getCursor();
   const sc = this.getSearchCursor();
   if (sc.findPrevious()) {
-    sc.replace(emoji.native, this.editor.getTokenAt(currentPos).string);
+    sc.replace(emoji.colons, this.editor.getTokenAt(currentPos).string);
     this.editor.focus();
     this.editor.refresh();
   }
@@ -34,7 +34,7 @@ addEmojiOnSearch = (emoji) => {
 addEmoji = (emoji) => {
   const currentPos = this.editor.getCursor();
   const doc = this.editor.getDoc();
-  doc.replaceRange(emoji.native, currentPos);
+  doc.replaceRange(emoji.colons, currentPos);
   this.editor.focus();
   this.editor.refresh();
 }

+ 5 - 0
yarn.lock

@@ -12640,6 +12640,11 @@ markdown-it-drawio-viewer@^1.3.1:
     "@kaishuu0123/markdown-it-fence" "^1.0.1"
     xmldoc "^1.1.2"
 
+markdown-it-emoji-mart@^0.1.1:
+  version "0.1.1"
+  resolved "https://registry.yarnpkg.com/markdown-it-emoji-mart/-/markdown-it-emoji-mart-0.1.1.tgz#65cb7206df88da4dd8c8d4449e62b6c0c9e548ab"
+  integrity sha1-ZctyBt+I2k3YyNREnmK2wMnlSKs=
+
 markdown-it-emoji@^1.4.0:
   version "1.4.0"
   resolved "https://registry.yarnpkg.com/markdown-it-emoji/-/markdown-it-emoji-1.4.0.tgz#9bee0e9a990a963ba96df6980c4fddb05dfb4dcc"