From 3a174707c37e0b4f48f74daf6ae1a5fa4a7b429e Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Tue, 22 Jan 2019 15:50:05 +0100 Subject: [PATCH 01/46] Added basic editor under /post/edit --- components/Editor/Editor.vue | 132 +++++++++++++++++++++++ package.json | 2 + pages/post/create.vue | 19 ++++ yarn.lock | 199 +++++++++++++++++++++++++++++++++++ 4 files changed, 352 insertions(+) create mode 100644 components/Editor/Editor.vue create mode 100644 pages/post/create.vue diff --git a/components/Editor/Editor.vue b/components/Editor/Editor.vue new file mode 100644 index 000000000..c4bef2281 --- /dev/null +++ b/components/Editor/Editor.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/package.json b/package.json index 4707e273a..940f8cae3 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,8 @@ "nuxt": "^2.0.0", "nuxt-env": "^0.0.4", "nuxt-sass-resources-loader": "^2.0.5", + "tiptap": "~1.8.0", + "tiptap-extensions": "~1.8.0", "v-tooltip": "^2.0.0-rc.33", "vue-count-to": "^1.0.13", "vue-izitoast": "1.1.2", diff --git a/pages/post/create.vue b/pages/post/create.vue new file mode 100644 index 000000000..d0497d174 --- /dev/null +++ b/pages/post/create.vue @@ -0,0 +1,19 @@ + + + diff --git a/yarn.lock b/yarn.lock index d3ffae4a4..ea6a715b0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5259,6 +5259,13 @@ fastparse@^1.1.1: resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.2.tgz#91728c5a5942eced8531283c79441ee4122c35a9" integrity sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ== +fault@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/fault/-/fault-1.0.2.tgz#c3d0fec202f172a3a4d414042ad2bb5e2a3ffbaa" + integrity sha512-o2eo/X2syzzERAtN5LcGbiVQ0WwZSlN3qLtadwAz3X8Bu+XWD16dja/KMsjZLiQr+BLGPDnHGkc4yUJf1Xpkpw== + dependencies: + format "^0.2.2" + fb-watchman@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" @@ -5484,6 +5491,11 @@ form-data@~2.3.2: combined-stream "^1.0.6" mime-types "^2.1.12" +format@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b" + integrity sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs= + forwarded@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" @@ -5919,6 +5931,11 @@ hex-color-regex@^1.1.0: resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ== +highlight.js@~9.13.0: + version "9.13.1" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.13.1.tgz#054586d53a6863311168488a0f58d6c505ce641e" + integrity sha512-Sc28JNQNDzaH6PORtRLMvif9RSn1mYuOoX3omVjnb0+HbpPygU2ALBI0R/wsiqCb4/fcp07Gdo8g+fhtFrQl6A== + hmac-drbg@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" @@ -7568,6 +7585,14 @@ lowercase-keys@^1.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA== +lowlight@^1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/lowlight/-/lowlight-1.11.0.tgz#1304d83005126d4e8b1dc0f07981e9b689ec2efc" + integrity sha512-xrGGN6XLL7MbTMdPD6NfWPwY43SNkjf/d0mecSx/CW36fUZTjRHEq0/Cdug3TWKtRXLWi7iMl1eP0olYxj/a4A== + dependencies: + fault "^1.0.2" + highlight.js "~9.13.0" + lru-cache@4.1.x, lru-cache@^4.0.1, lru-cache@^4.1.2, lru-cache@^4.1.3: version "4.1.4" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.4.tgz#51cc46e8e6d9530771c857e24ccc720ecdbcc031" @@ -8413,6 +8438,11 @@ optionator@^0.8.1, optionator@^0.8.2: type-check "~0.3.2" wordwrap "~1.0.0" +orderedmap@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/orderedmap/-/orderedmap-1.0.0.tgz#d90fc2ba1ed085190907d601dec6e6a53f8d41ba" + integrity sha1-2Q/Cuh7QhRkJB9YB3sbmpT+NQbo= + os-browserify@^0.3.0, os-browserify@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" @@ -9496,6 +9526,114 @@ prompts@^0.1.9: kleur "^2.0.1" sisteransi "^0.1.1" +prosemirror-commands@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/prosemirror-commands/-/prosemirror-commands-1.0.7.tgz#e5a2ba821e29ea7065c88277fe2c3d7f6b0b9d37" + integrity sha512-IR8yMSdw7XlKuF68tydAak1J9P/lLD5ohsrL7pzoLsJAJAQU7mVPDXtGbQrrm0mesddFjcc1zNo/cJQN3lRYnA== + dependencies: + prosemirror-model "^1.0.0" + prosemirror-state "^1.0.0" + prosemirror-transform "^1.0.0" + +prosemirror-dropcursor@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/prosemirror-dropcursor/-/prosemirror-dropcursor-1.1.1.tgz#c60ed1ed6c58804a06a75db06a0d993b087b7622" + integrity sha512-GeUyMO/tOEf8MXrP7Xb7UIMrfK86OGh0fnyBrHfhav4VjY9cw65mNoqHy87CklE5711AhCP5Qzfp8RL/hVKusg== + dependencies: + prosemirror-state "^1.0.0" + prosemirror-transform "^1.1.0" + prosemirror-view "^1.1.0" + +prosemirror-gapcursor@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/prosemirror-gapcursor/-/prosemirror-gapcursor-1.0.3.tgz#acc6537fc5a35e9b38966f91a199a382dfc715c4" + integrity sha512-X+hJhr42PcHWiSWL+lI5f/UeOhXCxlBFb8M6O8aG1hssmaRrW7sS2/Fjg5jFV+pTdS1REFkmm1occh01FMdDIQ== + dependencies: + prosemirror-keymap "^1.0.0" + prosemirror-model "^1.0.0" + prosemirror-state "^1.0.0" + prosemirror-view "^1.0.0" + +prosemirror-history@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/prosemirror-history/-/prosemirror-history-1.0.3.tgz#5fb8591adfc272afaaf0b41bec64ee7d9522a118" + integrity sha512-IfFGbhafSx+R3aq7nLJGkXeu2iaUiP8mkU3aRu2uQcIIjU8Fq7RJfuvhIOJ2RNUoSyqF/ANkdTjnZ74F5eHs1Q== + dependencies: + prosemirror-state "^1.2.2" + prosemirror-transform "^1.0.0" + rope-sequence "^1.2.0" + +prosemirror-inputrules@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/prosemirror-inputrules/-/prosemirror-inputrules-1.0.1.tgz#f63305fd966379f218e82ca76a2a9b328b66dc7b" + integrity sha512-UHy22NmwxS5WIMQYkzraDttQAF8mpP82FfbJsmKFfx6jwkR/SZa+ZhbkLY0zKQ5fBdJN7euj36JG/B5iAlrpxA== + dependencies: + prosemirror-state "^1.0.0" + prosemirror-transform "^1.0.0" + +prosemirror-keymap@^1.0.0, prosemirror-keymap@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/prosemirror-keymap/-/prosemirror-keymap-1.0.1.tgz#03ef32b828e3a859dfb570eb84928bf2e5330bc2" + integrity sha512-e79ApE7PXXZMFtPz7WbjycjAFd1NPjgY1MkecVz98tqwlBSggXWXYQnWFk6x7UkmnBYRHHbXHkR/RXmu2wyBJg== + dependencies: + prosemirror-state "^1.0.0" + w3c-keyname "^1.1.8" + +prosemirror-model@^1.0.0, prosemirror-model@^1.1.0, prosemirror-model@^1.6.4: + version "1.6.4" + resolved "https://registry.yarnpkg.com/prosemirror-model/-/prosemirror-model-1.6.4.tgz#2ac37a629448a7dbfd1635450e2fdd63c3450d7d" + integrity sha512-C2ALle8fZsAza+6stUF9Gv28jH9XtpNeczb33bowGlnb2cpNI4FZf1HHUyZjf6ou4cEvOlbt6fAYsT4NCKmlcQ== + dependencies: + orderedmap "^1.0.0" + +prosemirror-schema-list@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/prosemirror-schema-list/-/prosemirror-schema-list-1.0.1.tgz#f216e0cf4809b6074aa27912449ac89897f1ae94" + integrity sha512-AiLIX6qm6PEeDtMCKZLcSLi55WXo1ls7DnRK+4hSkoi0IIzNdxGsRlecCd3MzEu//DVz3nAEh+zEmslyW+uk8g== + dependencies: + prosemirror-model "^1.0.0" + prosemirror-transform "^1.0.0" + +prosemirror-state@^1.0.0, prosemirror-state@^1.2.1, prosemirror-state@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/prosemirror-state/-/prosemirror-state-1.2.2.tgz#8df26d95fd6fd327c0f9984a760e84d863204154" + integrity sha512-j8aC/kf9BJSCQau485I/9pj39XQoce+TqH5xzekT7WWFARTsRYFLJtiXBcCKakv1VSeev+sC3bJP0pLfz7Ft8g== + dependencies: + prosemirror-model "^1.0.0" + prosemirror-transform "^1.0.0" + +prosemirror-tables@^0.7.10, prosemirror-tables@^0.7.9: + version "0.7.10" + resolved "https://registry.yarnpkg.com/prosemirror-tables/-/prosemirror-tables-0.7.10.tgz#4b0f623422b4b8f84cdc9c559f8a87579846b3ba" + integrity sha512-VIu7UGS9keYEHs0Y6AEOTGbNE9QI2rL1OKng4vV6yoTshW/lYcb+s3hGXI12i+WLMjDVm7ujhfdWrpKpvFZOkQ== + dependencies: + prosemirror-keymap "^1.0.0" + prosemirror-model "^1.0.0" + prosemirror-state "^1.0.0" + prosemirror-transform "^1.0.0" + prosemirror-view "^1.0.0" + +prosemirror-transform@^1.0.0, prosemirror-transform@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/prosemirror-transform/-/prosemirror-transform-1.1.3.tgz#28cfdf1f9ee514edc40466be7b7db39eed545fdf" + integrity sha512-1O6Di5lOL1mp4nuCnQNkHY7l2roIW5y8RH4ZG3hMYmkmDEWzTaFFnxxAAHsE5ipGLBSRcTlP7SsDhYBIdSuLpQ== + dependencies: + prosemirror-model "^1.0.0" + +prosemirror-utils@^0.7.5: + version "0.7.5" + resolved "https://registry.yarnpkg.com/prosemirror-utils/-/prosemirror-utils-0.7.5.tgz#11b477647b672ec8f10679ab298a5823dad6457a" + integrity sha512-F+63BUiBkUQb1S07c3rGHXjE4MDaZ5OjsNhmaO7eDdSh1lUNORTJJHrvlFEZKnLM7ChoDDXTIKhWNQwnCssQfA== + +prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.6.8: + version "1.6.8" + resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.6.8.tgz#33fc1a6e2731633e5d6dc1af1967378f15810b74" + integrity sha512-YWX3rfji77xsU5EErt4ZoecVytYW9/4oHBYhV1MUHGMYIcppe+QZEBgRlyPMBUuu0lxdZX4m3sq7fCsDvv/MlQ== + dependencies: + prosemirror-model "^1.1.0" + prosemirror-state "^1.0.0" + prosemirror-transform "^1.1.0" + proto-list@~1.2.1: version "1.2.4" resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" @@ -10078,6 +10216,11 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" +rope-sequence@^1.2.0: + version "1.2.2" + resolved "https://registry.yarnpkg.com/rope-sequence/-/rope-sequence-1.2.2.tgz#49c4e5c2f54a48e990b050926771e2871bcb31ce" + integrity sha1-ScTlwvVKSOmQsFCSZ3HihxvLMc4= + rsvp@^3.3.3: version "3.6.2" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" @@ -11057,6 +11200,57 @@ timsort@^0.3.0: resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= +tiptap-commands@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/tiptap-commands/-/tiptap-commands-1.4.0.tgz#0cfb3ac138ee3099de56114cb119abd841fbcbe7" + integrity sha512-ytO8jFXgufK5DziamTaVojzUTolWvL4m2xNXaLkAVJYy9CWXruMK7avqeLoFYPI4GZlhleMn5i4gzYTbD7e2jA== + dependencies: + prosemirror-commands "^1.0.7" + prosemirror-inputrules "^1.0.1" + prosemirror-schema-list "^1.0.1" + prosemirror-state "^1.2.2" + tiptap-utils "^1.1.1" + +tiptap-extensions@~1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/tiptap-extensions/-/tiptap-extensions-1.8.0.tgz#3067620a024f1a9e5fae4450790b143d7ebe4394" + integrity sha512-1JN9uk5QnA7DTID1j07gIBEqeOnRd6lwZ5rx/zqWXJLyreZu8VDPvP939tfP41GskO4oicGlhmsQ0aEnA5QYDw== + dependencies: + lowlight "^1.11.0" + prosemirror-history "^1.0.3" + prosemirror-state "^1.2.2" + prosemirror-tables "^0.7.10" + prosemirror-utils "^0.7.5" + prosemirror-view "^1.6.8" + tiptap "^1.8.0" + tiptap-commands "^1.4.0" + +tiptap-utils@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/tiptap-utils/-/tiptap-utils-1.1.1.tgz#e7aad3e84eb35f7abed704d15da0420029789d0d" + integrity sha512-yPIWwLFaL5a0GC7fcO7aoPlASnH3wOUQex0IlepNWbDCNycSL8shXhVx0HMN/tCnlp943zw1bwcYzpTW3wA4tw== + dependencies: + prosemirror-model "^1.6.4" + prosemirror-state "^1.2.2" + prosemirror-tables "^0.7.9" + prosemirror-utils "^0.7.5" + +tiptap@^1.8.0, tiptap@~1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/tiptap/-/tiptap-1.8.0.tgz#c671188075ffa5ee4f86470f95818fd9ce6f1040" + integrity sha512-zIcVY8U1Wgj4bg3R4pX5a2BCpZUw/dTCh259VZ9g5MtClnzdLW2XpKCcwqfa9iUBEs6MCPSnB3t8jGRtGciHJg== + dependencies: + prosemirror-commands "^1.0.7" + prosemirror-dropcursor "^1.1.1" + prosemirror-gapcursor "^1.0.3" + prosemirror-inputrules "^1.0.1" + prosemirror-keymap "^1.0.1" + prosemirror-model "^1.6.4" + prosemirror-state "^1.2.1" + prosemirror-view "^1.6.8" + tiptap-commands "^1.4.0" + tiptap-utils "^1.1.1" + title-case@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/title-case/-/title-case-2.1.1.tgz#3e127216da58d2bc5becf137ab91dae3a7cd8faa" @@ -11721,6 +11915,11 @@ w3c-hr-time@^1.0.1: dependencies: browser-process-hrtime "^0.1.2" +w3c-keyname@^1.1.8: + version "1.1.8" + resolved "https://registry.yarnpkg.com/w3c-keyname/-/w3c-keyname-1.1.8.tgz#4e2219663760fd6535b7a1550f1552d71fc9372c" + integrity sha512-2HAdug8GTiu3b4NYhssdtY8PXRue3ICnh1IlxvZYl+hiINRq0GfNWei3XOPDg8L0PsxbmYjWVLuLj6BMRR/9vA== + walker@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" From fbc9b4777d2341744c3936680ea7b8e2b72bf5c2 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Tue, 22 Jan 2019 15:54:14 +0100 Subject: [PATCH 02/46] Fixed portal-vue --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 33464ccc3..167735985 100644 --- a/package.json +++ b/package.json @@ -52,9 +52,9 @@ "nuxt": "^2.0.0", "nuxt-env": "^0.0.4", "nuxt-sass-resources-loader": "^2.0.5", + "portal-vue": "~1.5.1", "tiptap": "~1.8.0", "tiptap-extensions": "~1.8.0", - "portal-vue": "~1.5.1", "v-tooltip": "^2.0.0-rc.33", "vue-count-to": "^1.0.13", "vue-izitoast": "1.1.2", From b53152ee27999ed05bd5c1105df5f87ae0c7e23a Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Wed, 23 Jan 2019 21:35:49 +0100 Subject: [PATCH 03/46] Added editor icons --- styleguide/src/system/icons/svg/bold.svg | 5 +++++ styleguide/src/system/icons/svg/italic.svg | 5 +++++ styleguide/src/system/icons/svg/list-ol.svg | 5 +++++ styleguide/src/system/icons/svg/list-ul.svg | 5 +++++ styleguide/src/system/icons/svg/paragraph.svg | 5 +++++ styleguide/src/system/icons/svg/quote-right.svg | 5 +++++ 6 files changed, 30 insertions(+) create mode 100755 styleguide/src/system/icons/svg/bold.svg create mode 100755 styleguide/src/system/icons/svg/italic.svg create mode 100755 styleguide/src/system/icons/svg/list-ol.svg create mode 100755 styleguide/src/system/icons/svg/list-ul.svg create mode 100755 styleguide/src/system/icons/svg/paragraph.svg create mode 100755 styleguide/src/system/icons/svg/quote-right.svg diff --git a/styleguide/src/system/icons/svg/bold.svg b/styleguide/src/system/icons/svg/bold.svg new file mode 100755 index 000000000..c3516808d --- /dev/null +++ b/styleguide/src/system/icons/svg/bold.svg @@ -0,0 +1,5 @@ + + +bold + + diff --git a/styleguide/src/system/icons/svg/italic.svg b/styleguide/src/system/icons/svg/italic.svg new file mode 100755 index 000000000..81d29483c --- /dev/null +++ b/styleguide/src/system/icons/svg/italic.svg @@ -0,0 +1,5 @@ + + +italic + + diff --git a/styleguide/src/system/icons/svg/list-ol.svg b/styleguide/src/system/icons/svg/list-ol.svg new file mode 100755 index 000000000..f3fb101ac --- /dev/null +++ b/styleguide/src/system/icons/svg/list-ol.svg @@ -0,0 +1,5 @@ + + +list-ol + + diff --git a/styleguide/src/system/icons/svg/list-ul.svg b/styleguide/src/system/icons/svg/list-ul.svg new file mode 100755 index 000000000..d565a8064 --- /dev/null +++ b/styleguide/src/system/icons/svg/list-ul.svg @@ -0,0 +1,5 @@ + + +list-ul + + diff --git a/styleguide/src/system/icons/svg/paragraph.svg b/styleguide/src/system/icons/svg/paragraph.svg new file mode 100755 index 000000000..26365f984 --- /dev/null +++ b/styleguide/src/system/icons/svg/paragraph.svg @@ -0,0 +1,5 @@ + + +paragraph + + diff --git a/styleguide/src/system/icons/svg/quote-right.svg b/styleguide/src/system/icons/svg/quote-right.svg new file mode 100755 index 000000000..4e6469624 --- /dev/null +++ b/styleguide/src/system/icons/svg/quote-right.svg @@ -0,0 +1,5 @@ + + +quote-right + + From de1c758b8adbc2da1b2d29de9c7e13233bfe7847 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Wed, 23 Jan 2019 21:36:12 +0100 Subject: [PATCH 04/46] Improved ContentMenu --- components/ContentMenu.vue | 52 +++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/components/ContentMenu.vue b/components/ContentMenu.vue index 9ab85cb12..5eb1647fb 100644 --- a/components/ContentMenu.vue +++ b/components/ContentMenu.vue @@ -8,14 +8,19 @@ slot="default" slot-scope="{toggleMenu}" > - - - + + + +
{ + // eslint-disable-next-line vue/no-side-effects-in-computed-properties + return this.$router.push('/post/edit/p1') + // return this.$router.push(link) + }, + icon: 'edit' + }) + } + + if (!this.isAuthor) { + routes.push({ name: this.$t(`report.${this.context}.title`), callback: this.openReportDialog, icon: 'flag' - } - ] + }) + } + if (this.isModerator) { routes.push({ name: this.$t(`disable.${this.context}.title`), - callback: this.openDisableDialog, + callback: () => {}, icon: 'eye-slash' }) } From 83cc6e537794b5c664761d5bf6aa17252a250ab7 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Wed, 23 Jan 2019 21:36:29 +0100 Subject: [PATCH 05/46] Added more content menu translations --- locales/de.json | 4 ++++ locales/en.json | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/locales/de.json b/locales/de.json index b5d5be9c5..82fecfcc2 100644 --- a/locales/de.json +++ b/locales/de.json @@ -100,6 +100,10 @@ "reporter": "gemeldet von" } }, + "contribution": { + "edit": "Beitrag bearbeiten", + "delete": "Beitrag löschen" + }, "disable": { "user": { "title": "Nutzer sperren", diff --git a/locales/en.json b/locales/en.json index 023e34835..72e3f3380 100644 --- a/locales/en.json +++ b/locales/en.json @@ -100,6 +100,10 @@ "reporter": "reported by" } }, + "contribution": { + "edit": "Edit Contribution", + "delete": "Delete Contribution" + }, "disable": { "user": { "title": "Disable User", From 0673e0f8237c153f7bc9122a451b03f4f2f97fcb Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Wed, 23 Jan 2019 21:36:53 +0100 Subject: [PATCH 06/46] Improved Editor --- components/Editor/Editor.vue | 192 +++++++++++++++++++--- components/Editor/plugins/eventHandler.js | 33 ++++ 2 files changed, 205 insertions(+), 20 deletions(-) create mode 100644 components/Editor/plugins/eventHandler.js diff --git a/components/Editor/Editor.vue b/components/Editor/Editor.vue index c4bef2281..1401c5408 100644 --- a/components/Editor/Editor.vue +++ b/components/Editor/Editor.vue @@ -1,43 +1,152 @@ diff --git a/components/Editor/Editor.vue b/components/Editor/Editor.vue index 2a68da45a..fd136e770 100644 --- a/components/Editor/Editor.vue +++ b/components/Editor/Editor.vue @@ -262,7 +262,8 @@ export default { diff --git a/pages/post/_slug/edit/_id.vue b/pages/post/_slug/edit/_id.vue index 2366ab65f..1cd7f222f 100644 --- a/pages/post/_slug/edit/_id.vue +++ b/pages/post/_slug/edit/_id.vue @@ -4,25 +4,7 @@ gutter="base" > - - - - -
- - Speichern - -
-
+
  @@ -32,72 +14,20 @@ From 63925e404637a9076ec767ba7e4d514908a5ce28 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Mon, 4 Feb 2019 17:36:52 +0100 Subject: [PATCH 14/46] Throw error if the user is not the owner of the post while edit --- pages/post/_slug/edit/_id.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pages/post/_slug/edit/_id.vue b/pages/post/_slug/edit/_id.vue index 1cd7f222f..491fa004e 100644 --- a/pages/post/_slug/edit/_id.vue +++ b/pages/post/_slug/edit/_id.vue @@ -25,6 +25,9 @@ export default { if (!this.Post || !this.Post[0].id) { return } + if (this.Post[0].author.id !== this.$store.getters['auth/user'].id) { + throw new Error(`You can't edit that!`) + } return this.Post[0] } }, @@ -40,6 +43,9 @@ export default { createdAt slug image + author { + id + } tags { name } From bfb8afc662622971b7c0242974a679d6da7bbb46 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Tue, 5 Feb 2019 11:04:41 +0100 Subject: [PATCH 15/46] Improved post edit guard --- pages/post/_slug/edit/_id.vue | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pages/post/_slug/edit/_id.vue b/pages/post/_slug/edit/_id.vue index 491fa004e..f210e210d 100644 --- a/pages/post/_slug/edit/_id.vue +++ b/pages/post/_slug/edit/_id.vue @@ -21,14 +21,21 @@ export default { HcContributionForm }, computed: { + user() { + return this.$store.getters['auth/user'] + }, + author() { + return this.contribution ? this.contribution.author : {} + }, contribution() { - if (!this.Post || !this.Post[0].id) { - return - } - if (this.Post[0].author.id !== this.$store.getters['auth/user'].id) { + return this.Post ? this.Post[0] : {} + } + }, + watch: { + contribution() { + if (this.author.id !== this.user.id) { throw new Error(`You can't edit that!`) } - return this.Post[0] } }, apollo: { From a831f91314d27a592aff0047b9e2c0193cb14363 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Tue, 5 Feb 2019 17:12:49 +0100 Subject: [PATCH 16/46] fixed input field --- styleguide/src/system/components/data-input/shared/input.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/styleguide/src/system/components/data-input/shared/input.js b/styleguide/src/system/components/data-input/shared/input.js index 5ccf32b5b..954f52051 100755 --- a/styleguide/src/system/components/data-input/shared/input.js +++ b/styleguide/src/system/components/data-input/shared/input.js @@ -117,12 +117,12 @@ export default { } }, created() { - if (this.$parentForm) { + if (this.$parentForm && this.model) { this.$parentForm.subscribe(this.handleFormUpdate) } }, beforeDestroy() { - if (this.$parentForm) { + if (this.$parentForm && this.model) { this.$parentForm.unsubscribe(this.handleFormUpdate) } }, @@ -132,7 +132,7 @@ export default { }, input(value) { this.innerValue = value - if (this.$parentForm) { + if (this.$parentForm && this.model) { this.$parentForm.update(this.model, value) } else { /** From 31bc10842b4deb1c9f3073e89ee6d46f76fd1c95 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Tue, 5 Feb 2019 17:14:03 +0100 Subject: [PATCH 17/46] Improved linking in editor --- components/Editor/Editor.vue | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/components/Editor/Editor.vue b/components/Editor/Editor.vue index fd136e770..07b904564 100644 --- a/components/Editor/Editor.vue +++ b/components/Editor/Editor.vue @@ -2,6 +2,7 @@