浏览代码

feat: visual editor - link to page

NGPixel 5 年之前
父节点
当前提交
b2115143e3
共有 3 个文件被更改,包括 441 次插入257 次删除
  1. 15 1
      client/components/editor/editor-ckeditor.vue
  2. 29 29
      package.json
  3. 397 227
      yarn.lock

+ 15 - 1
client/components/editor/editor-ckeditor.vue

@@ -11,6 +11,7 @@
         v-spacer
         v-spacer
         .caption {{$t('editor:ckeditor.stats', { chars: stats.characters, words: stats.words })}}
         .caption {{$t('editor:ckeditor.stats', { chars: stats.characters, words: stats.words })}}
     editor-conflict(v-model='isConflict', v-if='isConflict')
     editor-conflict(v-model='isConflict', v-if='isConflict')
+    page-selector(mode='select', v-model='insertLinkDialog', :open-handler='insertLinkHandler', :path='path', :locale='locale')
 </template>
 </template>
 
 
 <script>
 <script>
@@ -19,6 +20,8 @@ import { get, sync } from 'vuex-pathify'
 import DecoupledEditor from '@requarks/ckeditor5'
 import DecoupledEditor from '@requarks/ckeditor5'
 import EditorConflict from './ckeditor/conflict.vue'
 import EditorConflict from './ckeditor/conflict.vue'
 
 
+/* global siteLangs */
+
 export default {
 export default {
   components: {
   components: {
     EditorConflict
     EditorConflict
@@ -37,7 +40,8 @@ export default {
         words: 0
         words: 0
       },
       },
       content: '',
       content: '',
-      isConflict: false
+      isConflict: false,
+      insertLinkDialog: false
     }
     }
   },
   },
   computed: {
   computed: {
@@ -49,6 +53,12 @@ export default {
     activeModal: sync('editor/activeModal')
     activeModal: sync('editor/activeModal')
   },
   },
   methods: {
   methods: {
+    insertLink () {
+      this.insertLinkDialog = true
+    },
+    insertLinkHandler ({ locale, path }) {
+      this.editor.execute('link', siteLangs.length > 0 ? `/${locale}/${path})` : `/${path}`)
+    }
   },
   },
   async mounted () {
   async mounted () {
     this.$store.set('editor/editorKey', 'ckeditor')
     this.$store.set('editor/editorKey', 'ckeditor')
@@ -89,6 +99,10 @@ export default {
       }
       }
     })
     })
 
 
+    this.$root.$on('editorLinkToPage', opts => {
+      this.insertLink()
+    })
+
     // Handle save conflict
     // Handle save conflict
     this.$root.$on('saveConflict', () => {
     this.$root.$on('saveConflict', () => {
       this.isConflict = true
       this.isConflict = true

+ 29 - 29
package.json

@@ -45,10 +45,10 @@
     "acme": "3.0.3",
     "acme": "3.0.3",
     "algoliasearch": "4.1.0",
     "algoliasearch": "4.1.0",
     "apollo-fetch": "0.7.0",
     "apollo-fetch": "0.7.0",
-    "apollo-server": "2.11.0",
-    "apollo-server-express": "2.11.0",
+    "apollo-server": "2.12.0",
+    "apollo-server-express": "2.12.0",
     "auto-load": "3.0.4",
     "auto-load": "3.0.4",
-    "aws-sdk": "2.653.0",
+    "aws-sdk": "2.656.0",
     "azure-search-client": "3.1.5",
     "azure-search-client": "3.1.5",
     "bcryptjs-then": "1.0.1",
     "bcryptjs-then": "1.0.1",
     "bluebird": "3.7.2",
     "bluebird": "3.7.2",
@@ -69,7 +69,7 @@
     "dotize": "0.3.0",
     "dotize": "0.3.0",
     "elasticsearch6": "npm:@elastic/elasticsearch@6",
     "elasticsearch6": "npm:@elastic/elasticsearch@6",
     "elasticsearch7": "npm:@elastic/elasticsearch@7",
     "elasticsearch7": "npm:@elastic/elasticsearch@7",
-    "emoji-regex": "8.0.0",
+    "emoji-regex": "9.0.0",
     "express": "4.17.1",
     "express": "4.17.1",
     "express-brute": "1.0.1",
     "express-brute": "1.0.1",
     "express-session": "1.17.0",
     "express-session": "1.17.0",
@@ -84,7 +84,7 @@
     "graphql-tools": "4.0.7",
     "graphql-tools": "4.0.7",
     "he": "1.2.0",
     "he": "1.2.0",
     "highlight.js": "9.18.1",
     "highlight.js": "9.18.1",
-    "i18next": "19.3.4",
+    "i18next": "19.4.1",
     "i18next-express-middleware": "1.9.1",
     "i18next-express-middleware": "1.9.1",
     "i18next-node-fs-backend": "2.1.3",
     "i18next-node-fs-backend": "2.1.3",
     "image-size": "0.8.3",
     "image-size": "0.8.3",
@@ -118,7 +118,7 @@
     "mssql": "6.2.0",
     "mssql": "6.2.0",
     "multer": "1.4.2",
     "multer": "1.4.2",
     "mysql2": "2.1.0",
     "mysql2": "2.1.0",
-    "nanoid": "3.0.2",
+    "nanoid": "3.1.3",
     "node-2fa": "1.1.2",
     "node-2fa": "1.1.2",
     "node-cache": "5.1.0",
     "node-cache": "5.1.0",
     "nodemailer": "6.4.6",
     "nodemailer": "6.4.6",
@@ -143,9 +143,9 @@
     "passport-saml": "1.3.3",
     "passport-saml": "1.3.3",
     "passport-twitch-oauth": "1.0.0",
     "passport-twitch-oauth": "1.0.0",
     "pem-jwk": "2.0.0",
     "pem-jwk": "2.0.0",
-    "pg": "8.0.0",
+    "pg": "8.0.2",
     "pg-hstore": "2.3.3",
     "pg-hstore": "2.3.3",
-    "pg-query-stream": "3.0.4",
+    "pg-query-stream": "3.0.6",
     "pg-tsquery": "8.1.0",
     "pg-tsquery": "8.1.0",
     "pug": "2.0.4",
     "pug": "2.0.4",
     "punycode": "2.1.1",
     "punycode": "2.1.1",
@@ -157,7 +157,7 @@
     "safe-regex": "2.1.1",
     "safe-regex": "2.1.1",
     "sanitize-filename": "1.6.3",
     "sanitize-filename": "1.6.3",
     "scim-query-filter-parser": "2.0.4",
     "scim-query-filter-parser": "2.0.4",
-    "semver": "7.1.3",
+    "semver": "7.2.2",
     "serve-favicon": "2.5.0",
     "serve-favicon": "2.5.0",
     "simple-git": "1.132.0",
     "simple-git": "1.132.0",
     "solr-node": "1.2.1",
     "solr-node": "1.2.1",
@@ -188,25 +188,25 @@
     "@babel/plugin-syntax-dynamic-import": "^7.8.3",
     "@babel/plugin-syntax-dynamic-import": "^7.8.3",
     "@babel/plugin-syntax-import-meta": "^7.8.3",
     "@babel/plugin-syntax-import-meta": "^7.8.3",
     "@babel/polyfill": "^7.8.7",
     "@babel/polyfill": "^7.8.7",
-    "@babel/preset-env": "^7.9.0",
+    "@babel/preset-env": "^7.9.5",
     "@mdi/font": "5.0.45",
     "@mdi/font": "5.0.45",
     "@panter/vue-i18next": "0.15.2",
     "@panter/vue-i18next": "0.15.2",
-    "@requarks/ckeditor5": "12.4.0-wiki.14",
-    "@vue/babel-preset-app": "4.3.0",
+    "@requarks/ckeditor5": "12.4.0-wiki.16",
+    "@vue/babel-preset-app": "4.3.1",
     "animate-sass": "0.8.2",
     "animate-sass": "0.8.2",
     "animated-number-vue": "1.0.0",
     "animated-number-vue": "1.0.0",
     "apollo-cache-inmemory": "1.6.5",
     "apollo-cache-inmemory": "1.6.5",
     "apollo-client": "2.6.8",
     "apollo-client": "2.6.8",
-    "apollo-link": "1.2.13",
-    "apollo-link-batch-http": "1.2.13",
-    "apollo-link-error": "1.1.12",
-    "apollo-link-http": "1.5.16",
+    "apollo-link": "1.2.14",
+    "apollo-link-batch-http": "1.2.14",
+    "apollo-link-error": "1.1.13",
+    "apollo-link-http": "1.5.17",
     "apollo-link-persisted-queries": "0.2.2",
     "apollo-link-persisted-queries": "0.2.2",
-    "apollo-link-ws": "1.0.19",
+    "apollo-link-ws": "1.0.20",
     "apollo-utilities": "1.3.3",
     "apollo-utilities": "1.3.3",
-    "autoprefixer": "9.7.5",
+    "autoprefixer": "9.7.6",
     "babel-eslint": "10.1.0",
     "babel-eslint": "10.1.0",
-    "babel-jest": "25.2.6",
+    "babel-jest": "25.3.0",
     "babel-loader": "^8.1.0",
     "babel-loader": "^8.1.0",
     "babel-plugin-graphql-tag": "2.5.0",
     "babel-plugin-graphql-tag": "2.5.0",
     "babel-plugin-lodash": "3.3.4",
     "babel-plugin-lodash": "3.3.4",
@@ -218,8 +218,8 @@
     "clipboard": "2.0.6",
     "clipboard": "2.0.6",
     "codemirror": "5.52.2",
     "codemirror": "5.52.2",
     "copy-webpack-plugin": "5.1.1",
     "copy-webpack-plugin": "5.1.1",
-    "core-js": "3.6.4",
-    "css-loader": "3.4.2",
+    "core-js": "3.6.5",
+    "css-loader": "3.5.2",
     "cssnano": "4.1.10",
     "cssnano": "4.1.10",
     "d3": "5.15.1",
     "d3": "5.15.1",
     "duplicate-package-checker-webpack-plugin": "3.0.0",
     "duplicate-package-checker-webpack-plugin": "3.0.0",
@@ -234,21 +234,21 @@
     "eslint-plugin-vue": "6.2.2",
     "eslint-plugin-vue": "6.2.2",
     "fibers": "4.0.2",
     "fibers": "4.0.2",
     "file-loader": "6.0.0",
     "file-loader": "6.0.0",
-    "filepond": "4.13.0",
+    "filepond": "4.13.1",
     "filepond-plugin-file-validate-type": "1.2.5",
     "filepond-plugin-file-validate-type": "1.2.5",
     "filesize.js": "2.0.0",
     "filesize.js": "2.0.0",
     "graphql-persisted-document-loader": "2.0.0",
     "graphql-persisted-document-loader": "2.0.0",
     "graphql-tag": "^2.10.3",
     "graphql-tag": "^2.10.3",
     "hammerjs": "2.0.8",
     "hammerjs": "2.0.8",
-    "html-webpack-plugin": "4.0.4",
+    "html-webpack-plugin": "4.2.0",
     "html-webpack-pug-plugin": "2.0.0",
     "html-webpack-pug-plugin": "2.0.0",
     "i18next-chained-backend": "2.0.1",
     "i18next-chained-backend": "2.0.1",
     "i18next-localstorage-backend": "3.1.1",
     "i18next-localstorage-backend": "3.1.1",
     "i18next-xhr-backend": "3.2.2",
     "i18next-xhr-backend": "3.2.2",
     "ignore-loader": "0.1.2",
     "ignore-loader": "0.1.2",
-    "jest": "25.2.7",
+    "jest": "25.3.0",
     "js-cookie": "2.2.1",
     "js-cookie": "2.2.1",
-    "mermaid": "8.4.8",
+    "mermaid": "8.5.0",
     "mini-css-extract-plugin": "0.9.0",
     "mini-css-extract-plugin": "0.9.0",
     "moment-duration-format": "2.3.2",
     "moment-duration-format": "2.3.2",
     "offline-plugin": "5.0.7",
     "offline-plugin": "5.0.7",
@@ -272,9 +272,9 @@
     "script-ext-html-webpack-plugin": "2.1.4",
     "script-ext-html-webpack-plugin": "2.1.4",
     "simple-progress-webpack-plugin": "1.1.2",
     "simple-progress-webpack-plugin": "1.1.2",
     "style-loader": "1.1.3",
     "style-loader": "1.1.3",
-    "terser": "4.6.10",
+    "terser": "4.6.11",
     "twemoji-awesome": "1.0.6",
     "twemoji-awesome": "1.0.6",
-    "url-loader": "4.0.0",
+    "url-loader": "4.1.0",
     "velocity-animate": "1.5.2",
     "velocity-animate": "1.5.2",
     "viz.js": "2.1.2",
     "viz.js": "2.1.2",
     "vue": "2.6.11",
     "vue": "2.6.11",
@@ -291,7 +291,7 @@
     "vue2-animate": "2.1.3",
     "vue2-animate": "2.1.3",
     "vuedraggable": "2.23.2",
     "vuedraggable": "2.23.2",
     "vuescroll": "4.15.0",
     "vuescroll": "4.15.0",
-    "vuetify": "2.2.20",
+    "vuetify": "2.2.21",
     "vuetify-loader": "1.4.3",
     "vuetify-loader": "1.4.3",
     "vuex": "3.1.3",
     "vuex": "3.1.3",
     "vuex-pathify": "1.4.1",
     "vuex-pathify": "1.4.1",
@@ -306,7 +306,7 @@
     "webpackbar": "4.0.0",
     "webpackbar": "4.0.0",
     "whatwg-fetch": "3.0.0",
     "whatwg-fetch": "3.0.0",
     "write-file-webpack-plugin": "4.5.1",
     "write-file-webpack-plugin": "4.5.1",
-    "xterm": "4.4.0",
+    "xterm": "4.5.0",
     "zxcvbn": "4.4.2"
     "zxcvbn": "4.4.2"
   },
   },
   "browserslist": [
   "browserslist": [

文件差异内容过多而无法显示
+ 397 - 227
yarn.lock


部分文件因为文件数量过多而无法显示