fix(revisions): connect safe restore UI and readable change history
This commit is contained in:
1 parent
2cbaa9342d
commit
96065d1e89
11 files changed
+166
-96
No files matched your search
+6
-1
@@ -252,6 +252,10 @@ window.PagesEditor = {
|
||||
if (this.saving) return false
|
||||
if (!this.dirty) return !this.paused
|
||||
if (!manual && this.paused) return false
|
||||
const messageField=document.getElementById('revision-message')
|
||||
const changeMessage=messageField?.value.trim()||''
|
||||
// A supplied message belongs to the next explicit save, not autosave.
|
||||
if (!manual && changeMessage) return false
|
||||
if (manual) this.mergeAttempts=0
|
||||
this.persist()
|
||||
this.saving = true
|
||||
@@ -261,11 +265,12 @@ window.PagesEditor = {
|
||||
try {
|
||||
body = await this.canonical(text,format)
|
||||
const data = await this.post('/_/api/v1/revisions/save',{
|
||||
object_uuid:this.value('object-uuid'),body,message:manual?'manual-save':'autosave',
|
||||
object_uuid:this.value('object-uuid'),body,message:manual?(changeMessage||'manual-save'):'autosave',
|
||||
lang:this.value('page-language')||'und',content_type:this.value('page-content-type'),filename:this.value('page-filename'),
|
||||
base_revision_uuid:this.baseRevision,editor_principal_uuid:this.owner,
|
||||
})
|
||||
if (!data.revision_uuid) throw {kind:'failed'}
|
||||
if (manual && messageField?.value.trim()===changeMessage) messageField.value=''
|
||||
this.baseRevision = data.revision_uuid
|
||||
this.baseBody = typeof data.body==='string' ? data.body : body
|
||||
this.initialText = text; this.initialFormat = format
|
||||
|
||||
Reference in new issue
Block a user