Browse Source

修改编辑器

raingad 1 năm trước cách đây
mục cha
commit
2888b8a980
3 tập tin đã thay đổi với 147 bổ sung17 xóa
  1. 81 2
      package-lock.json
  2. 4 1
      package.json
  3. 62 14
      packages/components/editor.vue

+ 81 - 2
package-lock.json

@@ -1,13 +1,16 @@
 {
   "name": "lemon-imui",
-  "version": "1.7.5",
+  "version": "1.7.7",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "lemon-imui",
-      "version": "1.7.5",
+      "version": "1.7.7",
       "license": "MIT",
+      "dependencies": {
+        "chatarea": "^3.4.5"
+      },
       "devDependencies": {
         "@vue/cli-plugin-babel": "^3.6.0",
         "@vue/cli-plugin-eslint": "^3.6.0",
@@ -3066,6 +3069,11 @@
       "dev": true,
       "optional": true
     },
+    "node_modules/chatarea": {
+      "version": "3.4.5",
+      "resolved": "https://registry.npmmirror.com/chatarea/-/chatarea-3.4.5.tgz",
+      "integrity": "sha512-AK0kRkcltVSM7InQ4M+pdcni0TGvzxZxsokvTdyvy+fTkvVd8tKndxI8i3jKlQFNy1Ko1hJsO9qLUTV74Sc4oQ=="
+    },
     "node_modules/check-types": {
       "version": "8.0.3",
       "resolved": "https://registry.npm.taobao.org/check-types/download/check-types-8.0.3.tgz",
@@ -16702,6 +16710,11 @@
       "dev": true,
       "optional": true
     },
+    "chatarea": {
+      "version": "3.4.5",
+      "resolved": "https://registry.npmmirror.com/chatarea/-/chatarea-3.4.5.tgz",
+      "integrity": "sha512-AK0kRkcltVSM7InQ4M+pdcni0TGvzxZxsokvTdyvy+fTkvVd8tKndxI8i3jKlQFNy1Ko1hJsO9qLUTV74Sc4oQ=="
+    },
     "check-types": {
       "version": "8.0.3",
       "resolved": "https://registry.npm.taobao.org/check-types/download/check-types-8.0.3.tgz",
@@ -19175,24 +19188,28 @@
       "dependencies": {
         "abbrev": {
           "version": "1.1.1",
+          "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "ansi-regex": {
           "version": "2.1.1",
+          "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "aproba": {
           "version": "1.2.0",
+          "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "are-we-there-yet": {
           "version": "1.1.5",
+          "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19203,12 +19220,14 @@
         },
         "balanced-match": {
           "version": "1.0.0",
+          "integrity": "sha512-9Y0g0Q8rmSt+H33DfKv7FOc3v+iRI+o1lbzt8jGcIosYW37IIW/2XVYq5NPdmaD5NQ59Nk26Kl/vZbwW9Fr8vg==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "brace-expansion": {
           "version": "1.1.11",
+          "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19219,36 +19238,42 @@
         },
         "chownr": {
           "version": "1.1.1",
+          "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "code-point-at": {
           "version": "1.1.0",
+          "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "concat-map": {
           "version": "0.0.1",
+          "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "console-control-strings": {
           "version": "1.1.0",
+          "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "core-util-is": {
           "version": "1.0.2",
+          "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "debug": {
           "version": "4.1.1",
+          "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19258,24 +19283,28 @@
         },
         "deep-extend": {
           "version": "0.6.0",
+          "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "delegates": {
           "version": "1.0.0",
+          "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "detect-libc": {
           "version": "1.0.3",
+          "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "fs-minipass": {
           "version": "1.2.5",
+          "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19285,12 +19314,14 @@
         },
         "fs.realpath": {
           "version": "1.0.0",
+          "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "gauge": {
           "version": "2.7.4",
+          "integrity": "sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19307,6 +19338,7 @@
         },
         "glob": {
           "version": "7.1.3",
+          "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19321,12 +19353,14 @@
         },
         "has-unicode": {
           "version": "2.0.1",
+          "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "iconv-lite": {
           "version": "0.4.24",
+          "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19336,6 +19370,7 @@
         },
         "ignore-walk": {
           "version": "3.0.1",
+          "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19345,6 +19380,7 @@
         },
         "inflight": {
           "version": "1.0.6",
+          "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19355,18 +19391,21 @@
         },
         "inherits": {
           "version": "2.0.3",
+          "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "ini": {
           "version": "1.3.5",
+          "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "is-fullwidth-code-point": {
           "version": "1.0.0",
+          "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19376,12 +19415,14 @@
         },
         "isarray": {
           "version": "1.0.0",
+          "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "minimatch": {
           "version": "3.0.4",
+          "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19391,12 +19432,14 @@
         },
         "minimist": {
           "version": "0.0.8",
+          "integrity": "sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "minipass": {
           "version": "2.3.5",
+          "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19407,6 +19450,7 @@
         },
         "minizlib": {
           "version": "1.2.1",
+          "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19416,6 +19460,7 @@
         },
         "mkdirp": {
           "version": "0.5.1",
+          "integrity": "sha512-SknJC52obPfGQPnjIkXbmA6+5H15E+fR+E4iR2oQ3zzCLbd7/ONua69R/Gw7AgkTLsRG+r5fzksYwWe1AgTyWA==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19425,12 +19470,14 @@
         },
         "ms": {
           "version": "2.1.1",
+          "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "needle": {
           "version": "2.3.0",
+          "integrity": "sha512-QBZu7aAFR0522EyaXZM0FZ9GLpq6lvQ3uq8gteiDUp7wKdy0lSd2hPlgFwVuW1CBkfEs9PfDQsQzZghLs/psdg==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19442,6 +19489,7 @@
         },
         "node-pre-gyp": {
           "version": "0.12.0",
+          "integrity": "sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19460,6 +19508,7 @@
         },
         "nopt": {
           "version": "4.0.1",
+          "integrity": "sha512-+5XZFpQZEY0cg5JaxLwGxDlKNKYxuXwGt8/Oi3UXm5/4ymrJve9d2CURituxv3rSrVCGZj4m1U1JlHTdcKt2Ng==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19470,12 +19519,14 @@
         },
         "npm-bundled": {
           "version": "1.0.6",
+          "integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "npm-packlist": {
           "version": "1.4.1",
+          "integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19486,6 +19537,7 @@
         },
         "npmlog": {
           "version": "4.1.2",
+          "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19498,18 +19550,21 @@
         },
         "number-is-nan": {
           "version": "1.0.1",
+          "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "object-assign": {
           "version": "4.1.1",
+          "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "once": {
           "version": "1.4.0",
+          "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19519,18 +19574,21 @@
         },
         "os-homedir": {
           "version": "1.0.2",
+          "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "os-tmpdir": {
           "version": "1.0.2",
+          "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "osenv": {
           "version": "0.1.5",
+          "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19541,18 +19599,21 @@
         },
         "path-is-absolute": {
           "version": "1.0.1",
+          "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "process-nextick-args": {
           "version": "2.0.0",
+          "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "rc": {
           "version": "1.2.8",
+          "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19565,6 +19626,7 @@
           "dependencies": {
             "minimist": {
               "version": "1.2.0",
+              "integrity": "sha512-7Wl+Jz+IGWuSdgsQEJ4JunV0si/iMhg42MnQQG6h1R6TNeVenp4U9x5CC5v/gYqz/fENLQITAWXidNtVL0NNbw==",
               "bundled": true,
               "dev": true,
               "optional": true
@@ -19573,6 +19635,7 @@
         },
         "readable-stream": {
           "version": "2.3.6",
+          "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19588,6 +19651,7 @@
         },
         "rimraf": {
           "version": "2.6.3",
+          "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19597,42 +19661,49 @@
         },
         "safe-buffer": {
           "version": "5.1.2",
+          "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "safer-buffer": {
           "version": "2.1.2",
+          "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "sax": {
           "version": "1.2.4",
+          "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "semver": {
           "version": "5.7.0",
+          "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "set-blocking": {
           "version": "2.0.0",
+          "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "signal-exit": {
           "version": "3.0.2",
+          "integrity": "sha512-meQNNykwecVxdu1RlYMKpQx4+wefIYpmxi6gexo/KAbwquJrBUrBmKYJrE8KFkVQAAVWEnwNdu21PgrD77J3xA==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "string_decoder": {
           "version": "1.1.1",
+          "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19642,6 +19713,7 @@
         },
         "string-width": {
           "version": "1.0.2",
+          "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19653,6 +19725,7 @@
         },
         "strip-ansi": {
           "version": "3.0.1",
+          "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19662,12 +19735,14 @@
         },
         "strip-json-comments": {
           "version": "2.0.1",
+          "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "tar": {
           "version": "4.4.8",
+          "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19683,12 +19758,14 @@
         },
         "util-deprecate": {
           "version": "1.0.2",
+          "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "wide-align": {
           "version": "1.1.3",
+          "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
           "bundled": true,
           "dev": true,
           "optional": true,
@@ -19698,12 +19775,14 @@
         },
         "wrappy": {
           "version": "1.0.2",
+          "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
           "bundled": true,
           "dev": true,
           "optional": true
         },
         "yallist": {
           "version": "3.0.3",
+          "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
           "bundled": true,
           "dev": true,
           "optional": true

+ 4 - 1
package.json

@@ -39,5 +39,8 @@
     "vue-template-compiler": "^2.5.21"
   },
   "author": "fanjun",
-  "license": "MIT"
+  "license": "MIT",
+  "dependencies": {
+    "chatarea": "^3.4.5"
+  }
 }

+ 62 - 14
packages/components/editor.vue

@@ -1,5 +1,8 @@
 <script>
 import { useScopedSlot, messageToHtml, clearHtmlExcludeImg } from "utils";
+import ChatArea from 'chatarea'
+// 引入css样式
+import 'chatarea/lib/ChatArea.css'
 const command = (command, val) => {
   document.execCommand(command, false, val);
 };
@@ -30,13 +33,13 @@ export default {
     wrapKey: {
       type: Function,
       default: function(e) {
-        return e.keyCode == 13 && e.ctrlKey == false && e.shiftKey == false;
+        return e.keyCode == 13 && e.ctrlKey === true;
       },
     },
     sendKey: {
       type: Function,
       default(e) {
-        return e.keyCode == 13 && e.ctrlKey === true;
+        return e.keyCode == 13 && e.ctrlKey == false && e.shiftKey == false;
       },
     },
   },
@@ -48,12 +51,34 @@ export default {
       submitDisabled: true,
       //proxyTools: [],
       accept: "",
+      chatArea:null,
+      // 兼容多个输入框
+      key:new Date().getTime()
     };
   },
   created() {
     this.IMUI.$on("change-contact", () => {
       this.closeClipboardImage();
     });
+    this.$nextTick(() => {
+      this.chatArea = new ChatArea({
+      // 注* 当这个元素style属性position未设置为absolute,relative,fixed之一将会默认赋值relative
+      elm: document.getElementById('lemon-editor_'+this.key), // 从dom上抓取一个元素将其改造
+      userList: [ // 当输入@键时弹出人员选择的列表
+        {
+          id: '1',
+          name: '张三',
+          avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
+          pinyin: 'zhang san' // 如已有数据未支持,可以自行下载pinyin-pro以支持该交互效果
+        },
+        {
+          id: '2',
+          name: '李四'
+        },
+      ],
+      placeholder: ' '
+    })
+    })
   },
   render() {
     const toolLeft = [];
@@ -125,12 +150,13 @@ export default {
         <div class="lemon-editor__inner">
           <div
             class="lemon-editor__input"
-            ref="textarea"
-            contenteditable="true"
+            id={'lemon-editor_'+this.key}
             on-keyup={this._handleKeyup}
             on-keydown={this._handleKeydown}
             on-paste={this._handlePaste}
             on-click={this._handleClick}
+            on-input={this._handleInput}
+            on-drop={this._handleDrop}
             spellcheck="false"
           />
         </div>
@@ -138,7 +164,7 @@ export default {
           <div class="lemon-editor__tip">
             {useScopedSlot(
               this.IMUI.$scopedSlots["editor-footer"],
-              "使用 ctrl + enter 快捷发送消息",
+              "使用 ctrl + enter 换行",
             )}
           </div>
           <div class="lemon-editor__submit">
@@ -234,7 +260,7 @@ export default {
       range = selection.getRangeAt(0);
     },
     focusRange() {
-      this.$refs.textarea.focus();
+      // this.$refs.textarea.focus();
       if (range) {
         selection.removeAllRanges();
         selection.addRange(range);
@@ -243,6 +269,17 @@ export default {
     _handleClick() {
       this.saveRange();
     },
+    _handleInput() {
+      this._checkSubmitDisabled();
+    },
+    _handleDrop(e) {
+      e.preventDefault();
+      const { dataTransfer } = e;
+      const { files } = dataTransfer;
+      Array.from(files).forEach(file => {
+        this.$emit("upload", file);
+      });
+    },
     _renderEmojiTabs() {
       const renderImageGrid = items => {
         return items.map(item => (
@@ -272,7 +309,7 @@ export default {
       }
     },
     _handleSelectEmoji(item) {
-      this.inertContent(
+      this.chatArea.insertHtml(
         `<img emoji-name="${item.name}" src="${item.src}"></img>`,
       );
       this._checkSubmitDisabled();
@@ -288,8 +325,9 @@ export default {
       const text = clipboardData.getData("Text");
       if (text) {
         this.submitDisabled = false;
+        this.clear();
         if (window.clipboardData) {
-          this.$refs.textarea.innerHTML = text;
+          this.chatArea.insertHtml(text);
         } else {
           command("insertText", text);
         }
@@ -324,8 +362,11 @@ export default {
         e.preventDefault();
         command("insertLineBreak");
       }
-      if (this.submitDisabled == false && this.sendKey(e)) {
-        this._handleSend();
+      this.chatArea.enterSend = () => {
+        // 在此处执行你对发送消息的处理
+        if (this.submitDisabled == false && this.sendKey(e)) {
+          this._handleSend();
+        }
       }
     },
     getFormatValue() {
@@ -335,11 +376,11 @@ export default {
       //     .replace(/<div>|<p>/g, "\r\n")
       //     .replace(/<\/div>|<\/p>/g, "")
       // );
-      return this.IMUI.emojiImageToName(this.$refs.textarea.innerHTML);
+      return this.IMUI.emojiImageToName(this.chatArea.getHtml());
     },
     _checkSubmitDisabled() {
       this.submitDisabled = !clearHtmlExcludeImg(
-        this.$refs.textarea.innerHTML.trim(),
+        this.chatArea.getHtml().trim(),
       );
     },
     _handleSend(e) {
@@ -356,14 +397,15 @@ export default {
       fileInput.value = "";
     },
     clear() {
-      this.$refs.textarea.innerHTML = "";
+      this.chatArea.clear();
     },
     initEmoji(data) {
       emojiData = data;
       this.$forceUpdate();
     },
     setValue(val) {
-      this.$refs.textarea.innerHTML = this.IMUI.emojiNameToImage(val);
+      this.clear();
+      this.chatArea.insertHtml(this.IMUI.emojiNameToImage(val));
       this._checkSubmitDisabled();
     },
   },
@@ -485,3 +527,9 @@ gap = 10px;
     &:hover
       background #e9e9e9
 </style>
+<style>
+.chat-rich-text{
+  min-height: 100px;
+  padding:0;
+}
+</style>