fix: editor - show save button as saved when no modif

pull/1528/head
NGPixel 4 years ago
parent 2d06a1d9df
commit c5a22f6d13

@ -199,7 +199,7 @@ export default {
}
}
.dashboard-icon {
.v-icon.dashboard-icon {
position: absolute;
right: 0;
top: 12px;

@ -12,9 +12,11 @@
@click='save'
@click.ctrl.exact='saveAndClose'
:class='{ "is-icon": $vuetify.breakpoint.mdAndDown }'
:disabled='!isDirty'
)
v-icon(color='green', :left='$vuetify.breakpoint.lgAndUp') mdi-check
span.white--text(v-if='$vuetify.breakpoint.lgAndUp') {{ mode === 'create' ? $t('common:actions.create') : $t('common:actions.save') }}
span(v-if='$vuetify.breakpoint.lgAndUp && mode !== `create` && !isDirty') {{ $t('editor:save.saved') }}
span.white--text(v-else-if='$vuetify.breakpoint.lgAndUp') {{ mode === 'create' ? $t('common:actions.create') : $t('common:actions.save') }}
v-btn.animated.fadeInDown.wait-p1s(
text
color='blue'
@ -131,7 +133,18 @@ export default {
activeModal: sync('editor/activeModal'),
mode: get('editor/mode'),
welcomeMode() { return this.mode === `create` && this.path === `home` },
currentPageTitle: get('page/title')
currentPageTitle: get('page/title'),
isDirty () {
return _.some([
this.initContentParsed !== this.$store.get('editor/content'),
this.locale !== this.$store.get('page/locale'),
this.path !== this.$store.get('page/path'),
this.title !== this.$store.get('page/title'),
this.description !== this.$store.get('page/description'),
this.tags !== this.$store.get('page/tags'),
this.isPublished !== this.$store.get('page/isPublished')
], Boolean)
}
},
watch: {
currentEditor(newValue, oldValue) {
@ -284,7 +297,7 @@ export default {
}
},
async exit() {
if (this.initContentParsed !== this.$store.get('editor/content')) {
if (this.isDirty) {
this.dialogUnsaved = true
} else {
this.exitGo()

@ -36,19 +36,19 @@
},
"dependencies": {
"@aoberoi/passport-slack": "1.0.5",
"@azure/storage-blob": "12.0.2",
"@bugsnag/js": "6.5.0",
"@azure/storage-blob": "12.1.0",
"@bugsnag/js": "6.5.2",
"@exlinc/keycloak-passport": "1.0.2",
"@root/csr": "0.8.1",
"@root/keypairs": "0.9.0",
"@root/pem": "1.0.4",
"acme": "3.0.3",
"algoliasearch": "3.35.1",
"algoliasearch": "4.0.3",
"apollo-fetch": "0.7.0",
"apollo-server": "2.9.16",
"apollo-server-express": "2.9.16",
"apollo-server": "2.10.1",
"apollo-server-express": "2.10.1",
"auto-load": "3.0.4",
"aws-sdk": "2.610.0",
"aws-sdk": "2.624.0",
"azure-search-client": "3.1.5",
"bcryptjs-then": "1.0.1",
"bluebird": "3.7.2",
@ -57,15 +57,15 @@
"chalk": "3.0.0",
"cheerio": "1.0.0-rc.3",
"chokidar": "3.3.1",
"clean-css": "4.2.2",
"clean-css": "4.2.3",
"compression": "1.7.4",
"connect-session-knex": "1.5.0",
"cookie-parser": "1.4.4",
"cors": "2.8.5",
"custom-error-instance": "2.1.1",
"dependency-graph": "0.8.1",
"dependency-graph": "0.9.0",
"diff": "4.0.2",
"diff2html": "3.0.0-master.128204d",
"diff2html": "3.1.2",
"dotize": "0.3.0",
"elasticsearch6": "npm:@elastic/elasticsearch@6",
"elasticsearch7": "npm:@elastic/elasticsearch@7",
@ -73,32 +73,32 @@
"express": "4.17.1",
"express-brute": "1.0.1",
"express-session": "1.17.0",
"file-type": "13.1.2",
"filesize": "6.0.1",
"file-type": "14.1.2",
"filesize": "6.1.0",
"fs-extra": "8.1.0",
"getos": "3.1.4",
"graphql": "14.6.0",
"graphql-list-fields": "2.0.2",
"graphql-rate-limit-directive": "1.2.0",
"graphql-rate-limit-directive": "1.2.1",
"graphql-subscriptions": "1.1.0",
"graphql-tools": "4.0.6",
"graphql-tools": "4.0.7",
"he": "1.2.0",
"highlight.js": "9.18.0",
"i18next": "19.0.3",
"highlight.js": "9.18.1",
"i18next": "19.3.1",
"i18next-express-middleware": "1.9.1",
"i18next-node-fs-backend": "2.1.3",
"image-size": "0.8.3",
"js-base64": "2.5.1",
"js-base64": "2.5.2",
"js-binary": "1.2.0",
"js-yaml": "3.13.1",
"jsonwebtoken": "8.5.1",
"katex": "0.11.1",
"klaw": "3.0.0",
"knex": "0.20.8",
"knex": "0.20.10",
"lodash": "4.17.15",
"markdown-it": "10.0.0",
"markdown-it-abbr": "1.0.4",
"markdown-it-attrs": "3.0.1",
"markdown-it-attrs": "3.0.2",
"markdown-it-emoji": "1.4.0",
"markdown-it-expand-tabs": "1.0.13",
"markdown-it-external-links": "0.0.6",
@ -112,19 +112,19 @@
"mathjax-node": "2.1.1",
"mime-types": "2.1.26",
"moment": "2.24.0",
"moment-timezone": "0.5.27",
"mongodb": "3.5.2",
"moment-timezone": "0.5.28",
"mongodb": "3.5.3",
"ms": "2.1.2",
"mssql": "6.0.1",
"mssql": "6.1.0",
"multer": "1.4.2",
"mysql2": "2.1.0",
"nanoid": "2.1.10",
"nanoid": "2.1.11",
"node-2fa": "1.1.2",
"node-cache": "5.1.0",
"nodemailer": "6.4.2",
"objection": "2.1.2",
"nodemailer": "6.4.3",
"objection": "2.1.3",
"passport": "0.4.1",
"passport-auth0": "1.3.1",
"passport-auth0": "1.3.2",
"passport-azure-ad": "4.2.1",
"passport-cas": "0.1.1",
"passport-discord": "0.1.3",
@ -140,24 +140,24 @@
"passport-oauth2": "1.5.0",
"passport-okta-oauth": "0.0.1",
"passport-openidconnect": "0.0.2",
"passport-saml": "1.2.0",
"passport-saml": "1.3.3",
"passport-twitch": "1.0.3",
"pem-jwk": "2.0.0",
"pg": "7.17.1",
"pg": "7.18.2",
"pg-hstore": "2.3.3",
"pg-query-stream": "3.0.0",
"pg-query-stream": "3.0.3",
"pg-tsquery": "8.1.0",
"pug": "2.0.4",
"punycode": "2.1.1",
"qr-image": "3.2.0",
"raven": "2.6.4",
"remove-markdown": "0.3.0",
"request": "2.88.0",
"request": "2.88.2",
"request-promise": "4.2.5",
"safe-regex": "2.1.1",
"sanitize-filename": "1.6.3",
"scim-query-filter-parser": "2.0.4",
"semver": "7.1.1",
"semver": "7.1.3",
"serve-favicon": "2.5.0",
"simple-git": "1.131.0",
"solr-node": "1.2.1",
@ -167,7 +167,7 @@
"striptags": "3.1.1",
"subscriptions-transport-ws": "0.9.16",
"tar-fs": "2.0.0",
"twemoji": "12.1.4",
"twemoji": "12.1.5",
"uslug": "1.0.4",
"uuid": "3.4.0",
"validate.js": "0.13.1",
@ -176,8 +176,8 @@
"yargs": "15.1.0"
},
"devDependencies": {
"@babel/cli": "^7.8.3",
"@babel/core": "^7.8.3",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/plugin-proposal-export-namespace-from": "^7.8.3",
@ -188,11 +188,11 @@
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.8.3",
"@babel/polyfill": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@mdi/font": "4.8.95",
"@panter/vue-i18next": "0.15.1",
"@babel/preset-env": "^7.8.4",
"@mdi/font": "4.9.95",
"@panter/vue-i18next": "0.15.2",
"@requarks/ckeditor5": "12.4.0-wiki.14",
"@vue/babel-preset-app": "4.1.2",
"@vue/babel-preset-app": "4.2.2",
"animate-sass": "0.8.2",
"animated-number-vue": "1.0.0",
"apollo-cache-inmemory": "1.6.5",
@ -216,7 +216,7 @@
"chart.js": "2.9.3",
"clean-webpack-plugin": "3.0.0",
"clipboard": "2.0.4",
"codemirror": "5.51.0",
"codemirror": "5.52.0",
"copy-webpack-plugin": "5.1.1",
"core-js": "3.6.4",
"css-loader": "3.4.2",
@ -227,23 +227,23 @@
"eslint": "6.8.0",
"eslint-config-requarks": "1.0.7",
"eslint-config-standard": "14.1.0",
"eslint-plugin-import": "2.20.0",
"eslint-plugin-import": "2.20.1",
"eslint-plugin-node": "11.0.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-standard": "4.0.1",
"eslint-plugin-vue": "6.1.2",
"eslint-plugin-vue": "6.2.1",
"fibers": "4.0.2",
"file-loader": "5.0.2",
"filepond": "4.9.5",
"file-loader": "5.1.0",
"filepond": "4.11.0",
"filepond-plugin-file-validate-type": "1.2.4",
"filesize.js": "2.0.0",
"graphql-persisted-document-loader": "2.0.0",
"graphql-tag": "^2.10.1",
"graphql-tag": "^2.10.3",
"hammerjs": "2.0.8",
"html-webpack-plugin": "4.0.0-beta.8",
"html-webpack-pug-plugin": "2.0.0",
"i18next-chained-backend": "2.0.1",
"i18next-localstorage-backend": "3.0.0",
"i18next-localstorage-backend": "3.1.1",
"i18next-xhr-backend": "3.2.2",
"ignore-loader": "0.1.2",
"jest": "25.1.0",
@ -253,7 +253,7 @@
"offline-plugin": "5.0.7",
"optimize-css-assets-webpack-plugin": "5.0.3",
"postcss-cssnext": "3.1.0",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-flexbugs-fixes": "4.2.0",
"postcss-flexibility": "2.0.0",
"postcss-import": "12.0.1",
"postcss-loader": "3.0.0",
@ -282,7 +282,7 @@
"vue-clipboards": "1.3.0",
"vue-filepond": "6.0.2",
"vue-hot-reload-api": "2.3.4",
"vue-loader": "15.8.3",
"vue-loader": "15.9.0",
"vue-moment": "4.1.0",
"vue-router": "3.1.5",
"vue-status-indicator": "1.2.1",
@ -290,14 +290,14 @@
"vue2-animate": "2.1.3",
"vuedraggable": "2.23.2",
"vuescroll": "4.14.4",
"vuetify": "2.2.6",
"vuetify": "2.2.14",
"vuetify-loader": "1.4.3",
"vuex": "3.1.2",
"vuex-pathify": "1.4.1",
"vuex-persistedstate": "2.7.0",
"webpack": "4.41.5",
"vuex-persistedstate": "2.7.1",
"webpack": "4.41.6",
"webpack-bundle-analyzer": "3.6.0",
"webpack-cli": "3.3.10",
"webpack-cli": "3.3.11",
"webpack-dev-middleware": "3.7.2",
"webpack-hot-middleware": "2.25.0",
"webpack-merge": "4.2.2",
@ -305,7 +305,7 @@
"webpackbar": "4.0.0",
"whatwg-fetch": "3.0.0",
"write-file-webpack-plugin": "4.5.1",
"xterm": "4.3.0",
"xterm": "4.4.0",
"zxcvbn": "4.4.2"
},
"browserslist": [

@ -47,8 +47,7 @@ module.exports = {
*/
async query(q, opts) {
try {
const results = await this.index.search({
query: q,
const results = await this.index.search(q, {
hitsPerPage: 50
})
return {
@ -73,7 +72,7 @@ module.exports = {
* @param {Object} page Page to create
*/
async created(page) {
await this.index.addObject({
await this.index.saveObject({
objectID: page.hash,
locale: page.localeCode,
path: page.path,
@ -110,7 +109,7 @@ module.exports = {
*/
async renamed(page) {
await this.index.deleteObject(page.hash)
await this.index.addObject({
await this.index.saveObject({
objectID: page.destinationHash,
locale: page.destinationLocaleCode,
path: page.destinationPath,
@ -124,7 +123,7 @@ module.exports = {
*/
async rebuild() {
WIKI.logger.info(`(SEARCH/ALGOLIA) Rebuilding Index...`)
await this.index.clearIndex()
await this.index.clearObjects()
const MAX_DOCUMENT_BYTES = 10 * Math.pow(2, 10) // 10 KB
const MAX_INDEXING_BYTES = 10 * Math.pow(2, 20) - Buffer.from('[').byteLength - Buffer.from(']').byteLength // 10 MB
@ -171,7 +170,7 @@ module.exports = {
const flushBuffer = async () => {
WIKI.logger.info(`(SEARCH/ALGOLIA) Sending batch of ${chunks.length}...`)
try {
await this.index.addObjects(
await this.index.saveObjects(
_.map(chunks, doc => ({
objectID: doc.id,
locale: doc.locale,

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save