|
@@ -10,7 +10,7 @@ import {
|
10
|
10
|
NewVersionBtn,
|
11
|
11
|
ArchiveDeleteContent,
|
12
|
12
|
SelectStatus
|
13
|
|
-} from 'tracim_lib'
|
|
13
|
+} from 'tracim_lib/src/index.js'
|
14
|
14
|
import { MODE, debug } from '../helper.js'
|
15
|
15
|
import {
|
16
|
16
|
getHtmlDocContent,
|
|
@@ -71,7 +71,10 @@ class HtmlDocument extends React.Component {
|
71
|
71
|
|
72
|
72
|
if (prevState.content.content_id !== state.content.content_id) this.loadContent()
|
73
|
73
|
|
74
|
|
- if (state.mode === MODE.EDIT) wysiwyg('#wysiwygNewVersion', this.handleChangeText)
|
|
74
|
+ if (state.mode === MODE.EDIT) {
|
|
75
|
+ tinymce.remove('#wysiwygNewVersion')
|
|
76
|
+ wysiwyg('#wysiwygNewVersion', this.handleChangeText)
|
|
77
|
+ }
|
75
|
78
|
|
76
|
79
|
if (!prevState.timelineWysiwyg && state.timelineWysiwyg) wysiwyg('#wysiwygTimelineComment', this.handleChangeNewComment)
|
77
|
80
|
else if (prevState.timelineWysiwyg && !state.timelineWysiwyg) tinymce.remove('#wysiwygTimelineComment')
|
|
@@ -240,6 +243,18 @@ class HtmlDocument extends React.Component {
|
240
|
243
|
}
|
241
|
244
|
|
242
|
245
|
handleClickShowRevision = revision => {
|
|
246
|
+ const { mode, timeline } = this.state
|
|
247
|
+
|
|
248
|
+ const revisionArray = timeline.filter(t => t.timelineType === 'revision')
|
|
249
|
+ const isLastRevision = revision.revision_id === revisionArray[revisionArray.length - 1].revision_id
|
|
250
|
+
|
|
251
|
+ if (mode === MODE.REVISION && isLastRevision) {
|
|
252
|
+ this.handleClickLastVersion()
|
|
253
|
+ return
|
|
254
|
+ }
|
|
255
|
+
|
|
256
|
+ if (mode === MODE.VIEW && isLastRevision) return
|
|
257
|
+
|
243
|
258
|
this.setState(prev => ({
|
244
|
259
|
content: {
|
245
|
260
|
...prev.content,
|
|
@@ -275,7 +290,7 @@ class HtmlDocument extends React.Component {
|
275
|
290
|
<PopinFixedOption customClass={`${config.slug}`} i18n={i18n}>
|
276
|
291
|
<div /* this div in display flex, justify-content space-between */>
|
277
|
292
|
<div className='d-flex'>
|
278
|
|
- <NewVersionBtn onClickNewVersionBtn={this.handleClickNewVersion} disabled={mode === MODE.REVISION} />
|
|
293
|
+ <NewVersionBtn onClickNewVersionBtn={this.handleClickNewVersion} disabled={mode !== MODE.VIEW} />
|
279
|
294
|
|
280
|
295
|
{mode === MODE.REVISION &&
|
281
|
296
|
<button
|
|
@@ -306,7 +321,10 @@ class HtmlDocument extends React.Component {
|
306
|
321
|
</div>
|
307
|
322
|
</PopinFixedOption>
|
308
|
323
|
|
309
|
|
- <PopinFixedContent customClass={`${config.slug}__contentpage`}>
|
|
324
|
+ <PopinFixedContent
|
|
325
|
+ customClass={`${config.slug}__contentpage`}
|
|
326
|
+ showRightPartOnLoad={mode === MODE.VIEW}
|
|
327
|
+ >
|
310
|
328
|
<HtmlDocumentComponent
|
311
|
329
|
mode={mode}
|
312
|
330
|
wysiwygNewVersion={'wysiwygNewVersion'}
|