@konfuzio/document-validation-ui 0.1.16-dev.2 → 0.1.16-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.1.16-dev.2",
3
+ "version": "0.1.16-dev.4",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  @import "./imports.scss";
2
2
 
3
- #labels-sidebar {
3
+ #document-annotations {
4
4
  font-family: $font-family;
5
5
  flex: 1;
6
6
  background-color: $background;
@@ -426,10 +426,12 @@
426
426
  }
427
427
  }
428
428
 
429
- .missing-button-container, .decline-button-container {
429
+ .missing-button-container,
430
+ .decline-button-container {
430
431
  background-color: transparent;
431
432
 
432
- .missing-btn, .decline-btn {
433
+ .missing-btn,
434
+ .decline-btn {
433
435
  color: $grey-blue !important;
434
436
  font-size: 14px !important;
435
437
  font-weight: 500;
@@ -1,6 +1,6 @@
1
1
  @import "./imports.scss";
2
2
 
3
- .document-edit {
3
+ #document-edit {
4
4
  display: flex;
5
5
  flex: 1;
6
6
  background-color: $light-grey-background;
@@ -1,6 +1,6 @@
1
1
  @import "./imports.scss";
2
2
 
3
- .toolbar-container {
3
+ #toolbar-container {
4
4
  position: absolute;
5
5
  width: fit-content;
6
6
  bottom: 20px;
@@ -304,4 +304,120 @@ describe("Document Annotations", () => {
304
304
  .find(".empty-annotation")
305
305
  .should("not.have.class", "missing-annotation");
306
306
  });
307
+
308
+ it("gets successfull response from the API when accepting annotation", () => {
309
+ cy.mount(DocumentAnnotations);
310
+
311
+ cy.get("#labels-sidebar")
312
+ .find(".label")
313
+ .find(".annotation-row")
314
+ .find(".not-revised")
315
+ .first()
316
+ .then(($element) => {
317
+ const annotationId = $element[0].id;
318
+
319
+ cy.intercept('PATCH', `**/annotations/${annotationId}/`).as('updateAnnotation');
320
+
321
+ cy.wrap($element)
322
+ .trigger("mouseover");
323
+
324
+ cy.wait(1000);
325
+
326
+ cy.get("#labels-sidebar")
327
+ .find(".label")
328
+ .find(".annotation-row")
329
+ .find(".action-buttons")
330
+ .find(".annotation-accept-btn")
331
+ .click();
332
+
333
+ cy.wait("@updateAnnotation").its("response.statusCode").should("eq", 200);
334
+ })
335
+ });
336
+
337
+ it("gets successfull response from the API when declining annotation", () => {
338
+ cy.mount(DocumentAnnotations);
339
+
340
+ cy.get("#labels-sidebar")
341
+ .find(".label")
342
+ .find(".annotation-row")
343
+ .find(".annotation")
344
+ .first()
345
+ .then(($element) => {
346
+ const annotationId = $element[0].id;
347
+
348
+ cy.intercept('DELETE', `**/annotations/${annotationId}/`).as('deleteAnnotation');
349
+
350
+ cy.wrap($element)
351
+ .trigger("mouseover");
352
+
353
+ cy.wait(1000);
354
+
355
+ cy.get("#labels-sidebar")
356
+ .find(".label")
357
+ .find(".annotation-row")
358
+ .find(".action-buttons")
359
+ .find(".decline-btn")
360
+ .click();
361
+
362
+ cy.wait("@deleteAnnotation").its("response.statusCode").should("eq", 204);
363
+ })
364
+ });
365
+
366
+ it("gets successfull response from the API when marking annotation as missing", () => {
367
+ cy.mount(DocumentAnnotations);
368
+
369
+ cy.get("#labels-sidebar")
370
+ .find(".label")
371
+ .find(".annotation-row")
372
+ .find(".empty-annotation")
373
+ .first()
374
+ .then(($element) => {
375
+ cy.intercept('POST', `**/missing-annotations/`).as('addMissingAnnotations');
376
+
377
+ cy.wrap($element)
378
+ .trigger("mouseover");
379
+
380
+ cy.wait(1000);
381
+
382
+ cy.get("#labels-sidebar")
383
+ .find(".label")
384
+ .find(".annotation-row")
385
+ .find(".action-buttons")
386
+ .find(".missing-btn")
387
+ .click();
388
+
389
+ cy.wait("@addMissingAnnotations").its("response.statusCode").should("eq", 201);
390
+ })
391
+ });
392
+
393
+ it("gets successfull response from the API when restoring missing annotation", () => {
394
+ cy.mount(DocumentAnnotations);
395
+
396
+ cy.get("#labels-sidebar")
397
+ .find(".label")
398
+ .find(".annotation-row")
399
+ .find(".empty-annotation")
400
+ .find(".missing-annotation")
401
+ .first()
402
+ .then(($element) => {
403
+
404
+ cy.getStore("document").then($document => {
405
+ cy.intercept('DELETE', `**/missing-annotations/${$document.missingAnnotations[0].id}/`).as('deleteMissingAnnotation');
406
+ })
407
+
408
+ cy.wrap($element)
409
+ .trigger("mouseover");
410
+
411
+ cy.wait(1000);
412
+
413
+ cy.get("#labels-sidebar")
414
+ .find(".label")
415
+ .find(".annotation-row")
416
+ .find(".action-buttons")
417
+ .find(".restore-btn")
418
+ .click();
419
+
420
+ cy.wait("@deleteMissingAnnotation").its("response.statusCode").should("eq", 204);
421
+ })
422
+ });
307
423
  });
@@ -1,13 +1,20 @@
1
1
  <template>
2
- <div id="labels-sidebar">
2
+ <div id="document-annotations">
3
3
  <!-- When extracting annotations after editing -->
4
4
  <div v-if="recalculatingAnnotations" class="extracting-data">
5
5
  <ExtractingData />
6
6
  </div>
7
7
 
8
8
  <!-- When document data is still loading -->
9
- <div v-else-if="!annotationSets || loading" class="document-annotations-loading">
10
- <div v-for="n in numberOfLoadingAnnotations" :key="n" class="loading-annotation-set">
9
+ <div
10
+ v-else-if="!annotationSets || loading"
11
+ class="document-annotations-loading"
12
+ >
13
+ <div
14
+ v-for="n in numberOfLoadingAnnotations"
15
+ :key="n"
16
+ class="loading-annotation-set"
17
+ >
11
18
  <LoadingAnnotations />
12
19
  </div>
13
20
  </div>
@@ -1,9 +1,7 @@
1
1
  <template>
2
2
  <div
3
- :class="[
4
- 'document-edit',
5
- renameAndCategorize && 'rename-and-categorize-component',
6
- ]"
3
+ id="document-edit"
4
+ :class="[renameAndCategorize && 'rename-and-categorize-component']"
7
5
  >
8
6
  <div v-if="!renameAndCategorize" class="pages-section">
9
7
  <EditPages
@@ -115,10 +113,15 @@ export default {
115
113
  this.saveEditChanges();
116
114
  },
117
115
  updatedDocument(newValue, oldValue) {
118
- if(newValue && oldValue && newValue.length !== oldValue.length && newValue.length === 1) {
116
+ if (
117
+ newValue &&
118
+ oldValue &&
119
+ newValue.length !== oldValue.length &&
120
+ newValue.length === 1
121
+ ) {
119
122
  this.saveUpdatedDocuments();
120
123
  }
121
- }
124
+ },
122
125
  },
123
126
  mounted() {
124
127
  this.setPages();
@@ -292,7 +295,10 @@ export default {
292
295
  const newDocument = {
293
296
  name: this.handleNewDocumentName(i),
294
297
  category: this.handleNewDocumentCategory(i, clickedLines),
295
- categories: this.handleNewDocumentCategoriesAndConfidence(i, clickedLines),
298
+ categories: this.handleNewDocumentCategoriesAndConfidence(
299
+ i,
300
+ clickedLines
301
+ ),
296
302
  pages: this.handleNewDocumentPages(i, clickedLines),
297
303
  };
298
304
 
@@ -315,7 +321,12 @@ export default {
315
321
  return newFileName;
316
322
  },
317
323
  handleNewDocumentCategory(index, clickedLines) {
318
- if (this.updatedDocument && this.updatedDocument.length > 1 && clickedLines[index].origin && clickedLines[index].origin === "AI") {
324
+ if (
325
+ this.updatedDocument &&
326
+ this.updatedDocument.length > 1 &&
327
+ clickedLines[index].origin &&
328
+ clickedLines[index].origin === "AI"
329
+ ) {
319
330
  // get the index of the new document in the splitting suggestions
320
331
  // to return its category
321
332
  const i = this.indexOfSplittingSuggestion(index, clickedLines);
@@ -326,7 +337,12 @@ export default {
326
337
  }
327
338
  },
328
339
  handleNewDocumentCategoriesAndConfidence(index, clickedLines) {
329
- if (this.updatedDocument && this.updatedDocument.length > 1 && clickedLines[index].origin && clickedLines[index].origin === "AI") {
340
+ if (
341
+ this.updatedDocument &&
342
+ this.updatedDocument.length > 1 &&
343
+ clickedLines[index].origin &&
344
+ clickedLines[index].origin === "AI"
345
+ ) {
330
346
  // get the index of the new document in the splitting suggestions
331
347
  // to return its category
332
348
  const i = this.indexOfSplittingSuggestion(index, clickedLines);
@@ -398,10 +414,10 @@ export default {
398
414
  this.waitingForSplittingConfirmation(this.selectedDocument)
399
415
  ) {
400
416
  // delete the document categories since the backend doesn't need them
401
- const documentToProcess = this.updatedDocument.map(document => {
417
+ const documentToProcess = this.updatedDocument.map((document) => {
402
418
  delete document.categories;
403
419
  return document;
404
- })
420
+ });
405
421
  this.$store
406
422
  .dispatch("edit/editDocument", documentToProcess)
407
423
  .catch((error) => {
@@ -0,0 +1,215 @@
1
+ import DocumentDashboard from "../DocumentDashboard.vue";
2
+
3
+ describe("Document Toolbar", () => {
4
+ beforeEach(() => {
5
+ cy.fetchDocument();
6
+ cy.setFullMode();
7
+ });
8
+
9
+ it("downloads the original file", () => {
10
+ cy.mount(DocumentDashboard).then(({ wrapper, component }) => {
11
+ component.onDocumentResize();
12
+ cy.get("#toolbar-container").find(".download-file").first().click();
13
+ cy.get("#toolbar-container").get(".original-file").click();
14
+
15
+ cy.getStore("document").then(($document) => {
16
+ cy.readFile(
17
+ `cypress/Downloads/${$document.selectedDocument.data_file_name}`,
18
+ { timeout: 20000 }
19
+ ).should("exist");
20
+ });
21
+ });
22
+ });
23
+
24
+ it("downloads the ocr file", () => {
25
+ cy.mount(DocumentDashboard).then(({ wrapper, component }) => {
26
+ component.onDocumentResize();
27
+ cy.get("#toolbar-container").find(".download-file").first().click();
28
+ cy.get("#toolbar-container").get(".ocr-file").click();
29
+
30
+ cy.getStore("document").then(($document) => {
31
+ const fileName = $document.selectedDocument.data_file_name.replace(
32
+ /(\.[\w\d_-]+)$/i,
33
+ "_ocr$1"
34
+ );
35
+ cy.readFile(`cypress/Downloads/${fileName}`, { timeout: 20000 }).should(
36
+ "exist"
37
+ );
38
+ });
39
+ });
40
+ });
41
+
42
+ it("zooms in the document", () => {
43
+ cy.resetFit();
44
+ cy.mount(DocumentDashboard).then(({ wrapper, component }) => {
45
+ component.onDocumentResize();
46
+ const previousZoom = component.scale;
47
+ const previousDocumentWidth =
48
+ component.$refs.scrollingDocument.$el.offsetWidth;
49
+ cy.get("#toolbar-container").should("be.visible");
50
+
51
+ // zoom in
52
+ cy.get("#toolbar-container").get(".zoom-in").click();
53
+
54
+ // check if percentage was updated
55
+ cy.get("#zoom-percentage")
56
+ .invoke("text")
57
+ .then(($text) => {
58
+ expect($text.trim()).to.not.eql("100%");
59
+ });
60
+
61
+ // check if width of document page has increased
62
+ cy.get("#scrolling-document")
63
+ .get(".scrolling-page")
64
+ .first()
65
+ .find(".pdf-page-container")
66
+ .invoke("width")
67
+ .then(($width) => {
68
+ expect($width).to.be.greaterThan(previousDocumentWidth);
69
+ });
70
+
71
+ // check if document scale has increased
72
+ cy.getStore("display").then(($display) => {
73
+ expect($display.scale).to.be.greaterThan(previousZoom);
74
+ expect($display.fit).to.eql("custom");
75
+ });
76
+ });
77
+ });
78
+
79
+ it("zooms out the document", () => {
80
+ cy.resetFit();
81
+ cy.mount(DocumentDashboard).then(({ wrapper, component }) => {
82
+ component.onDocumentResize();
83
+ const previousZoom = component.scale;
84
+ const previousDocumentWidth =
85
+ component.$refs.scrollingDocument.$el.offsetWidth;
86
+ cy.get("#toolbar-container").should("be.visible");
87
+
88
+ // zoom out
89
+ cy.get("#toolbar-container").get(".zoom-out").click();
90
+
91
+ // check if percentage was updated
92
+ cy.get("#zoom-percentage")
93
+ .invoke("text")
94
+ .then(($text) => {
95
+ expect($text.trim()).to.not.eql("100%");
96
+ });
97
+
98
+ // check if width of document page has decreased
99
+ cy.get("#scrolling-document")
100
+ .get(".scrolling-page")
101
+ .first()
102
+ .find(".pdf-page-container")
103
+ .invoke("width")
104
+ .then(($width) => {
105
+ expect($width).to.be.lessThan(previousDocumentWidth);
106
+ });
107
+
108
+ // check if document scale has decreased
109
+ cy.getStore("display").then(($display) => {
110
+ expect($display.scale).to.be.lessThan(previousZoom);
111
+ expect($display.fit).to.eql("custom");
112
+ });
113
+ });
114
+ });
115
+
116
+ it("fit document zoom", () => {
117
+ cy.resetFit();
118
+ cy.mount(DocumentDashboard).then(({ wrapper, component }) => {
119
+ component.onDocumentResize();
120
+ const previousZoom = component.scale;
121
+ const previousDocumentWidth =
122
+ component.$refs.scrollingDocument.$el.offsetWidth;
123
+ cy.get("#toolbar-container").should("be.visible");
124
+
125
+ // fit zoom
126
+ cy.get("#toolbar-container").get(".fit-zoom").click();
127
+
128
+ // check if percentage goes to half
129
+ cy.get("#zoom-percentage")
130
+ .invoke("text")
131
+ .then(($text) => {
132
+ expect($text.trim()).to.eql("50%");
133
+ });
134
+
135
+ // check if width of document page has decreased
136
+ cy.get("#scrolling-document")
137
+ .get(".scrolling-page")
138
+ .first()
139
+ .find(".pdf-page-container")
140
+ .invoke("width")
141
+ .then(($width) => {
142
+ expect($width).to.be.lessThan(previousDocumentWidth);
143
+ });
144
+
145
+ // check if document scale has decreased
146
+ cy.getStore("display").then(($display) => {
147
+ expect($display.scale).to.be.lessThan(previousZoom);
148
+ expect($display.fit).to.eql("all");
149
+ });
150
+ });
151
+ });
152
+
153
+ it("fit document zoom after zoom in", () => {
154
+ cy.resetFit();
155
+ cy.mount(DocumentDashboard).then(({ wrapper, component }) => {
156
+ component.onDocumentResize();
157
+ const previousZoom = component.scale;
158
+ const previousDocumentWidth =
159
+ component.$refs.scrollingDocument.$el.offsetWidth;
160
+ cy.get("#toolbar-container").should("be.visible");
161
+
162
+ // zoom in
163
+ cy.get("#toolbar-container").get(".zoom-in").click();
164
+ cy.wait(1000);
165
+ // fit zoom
166
+ cy.get("#toolbar-container").get(".fit-zoom").click();
167
+
168
+ // check if percentage goes to half
169
+ cy.get("#zoom-percentage")
170
+ .invoke("text")
171
+ .then(($text) => {
172
+ expect($text.trim()).to.eql("50%");
173
+ });
174
+
175
+ // check if width of document page has decreased
176
+ cy.get("#scrolling-document")
177
+ .get(".scrolling-page")
178
+ .first()
179
+ .find(".pdf-page-container")
180
+ .invoke("width")
181
+ .then(($width) => {
182
+ expect($width).to.be.lessThan(previousDocumentWidth);
183
+ });
184
+
185
+ // check if document scale has decreased comparing to the initial 100% state
186
+ cy.getStore("display").then(($display) => {
187
+ expect($display.scale).to.be.lessThan(previousZoom);
188
+ expect($display.fit).to.eql("all");
189
+ });
190
+ });
191
+ });
192
+
193
+ it("check if edit mode is available and open it", () => {
194
+ cy.mount(DocumentDashboard).then(({ wrapper, component }) => {
195
+ component.onDocumentResize();
196
+ cy.gettersStore().then(($getters) => {
197
+ if (
198
+ $getters["edit/isEditModeAvailable"] &&
199
+ !$getters["document/documentCannotBeEdited"]()
200
+ ) {
201
+ cy.get("#edit-mode-button").click();
202
+ cy.get("#document-annotations").should("not.exist");
203
+ cy.get("#document-edit").should("exist");
204
+ } else if ($getters["document/documentCannotBeEdited"]()) {
205
+ cy.get("#edit-mode-button").should(
206
+ "have.class",
207
+ "edit-mode-disabled"
208
+ );
209
+ } else {
210
+ cy.get("#edit-mode-button").should("not.exist");
211
+ }
212
+ });
213
+ });
214
+ });
215
+ });
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="toolbar-container">
2
+ <div id="toolbar-container">
3
3
  <div :class="['toolbar', recalculatingAnnotations && 'hidden']">
4
4
  <b-tooltip
5
5
  :label="tooltipInfo"
@@ -9,7 +9,8 @@
9
9
  class="top-aligned"
10
10
  >
11
11
  <div
12
- v-if="!editMode && !publicView && !isDocumentReviewed"
12
+ v-if="isEditModeAvailable"
13
+ id="edit-mode-button"
13
14
  :class="[
14
15
  'icons icons-left',
15
16
  editModeDisabled && 'edit-mode-disabled',
@@ -22,10 +23,7 @@
22
23
  <span class="edit-text">{{ $t("edit") }}</span>
23
24
  </div>
24
25
  </b-tooltip>
25
- <div
26
- v-if="!editMode && !publicView && !isDocumentReviewed"
27
- class="toolbar-divider"
28
- />
26
+ <div v-if="isEditModeAvailable" class="toolbar-divider" />
29
27
 
30
28
  <div v-if="!publicView" class="download-file icons">
31
29
  <b-dropdown aria-role="list" position="is-top-right" scrollable>
@@ -33,10 +31,14 @@
33
31
  <b-icon icon="download" size="small" class="download-file" />
34
32
  </template>
35
33
 
36
- <b-dropdown-item aria-role="listitem" @click="handleDownloadFile()">{{
37
- $t("original_file")
38
- }}</b-dropdown-item>
39
34
  <b-dropdown-item
35
+ class="original-file"
36
+ aria-role="listitem"
37
+ @click="handleDownloadFile()"
38
+ >{{ $t("original_file") }}</b-dropdown-item
39
+ >
40
+ <b-dropdown-item
41
+ class="ocr-file"
40
42
  aria-role="listitem"
41
43
  @click="handleDownloadFile('ocr')"
42
44
  >{{ $t("pdf_file") }}</b-dropdown-item
@@ -58,7 +60,7 @@
58
60
  <FitZoomIcon />
59
61
  </div>
60
62
  <div
61
- :class="['zoom-in', 'icon', isZoomInExceeding && 'zoom-disabled']"
63
+ :class="['zoom-in icon', isZoomInExceeding && 'zoom-disabled']"
62
64
  @click.prevent.stop="zoomIn"
63
65
  >
64
66
  <PlusIcon />
@@ -69,7 +71,7 @@
69
71
  >
70
72
  <MinusIcon />
71
73
  </div>
72
- <div class="percentage">
74
+ <div id="zoom-percentage" class="percentage">
73
75
  {{ `${currentPercentage}%` }}
74
76
  </div>
75
77
  </div>
@@ -106,13 +108,13 @@ export default {
106
108
  },
107
109
  computed: {
108
110
  ...mapState("display", ["scale"]),
109
- ...mapState("edit", ["editMode"]),
111
+ ...mapGetters("edit", ["isEditModeAvailable"]),
110
112
  ...mapState("document", [
111
113
  "selectedDocument",
112
114
  "recalculatingAnnotations",
113
115
  "publicView",
114
116
  ]),
115
- ...mapGetters("document", ["documentCannotBeEdited", "isDocumentReviewed"]),
117
+ ...mapGetters("document", ["documentCannotBeEdited"]),
116
118
  isZoomInExceeding() {
117
119
  return this.currentPercentage === this.maxPercentage;
118
120
  },
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div>
2
+ <div id="scrolling-document">
3
3
  <div
4
4
  ref="scrollingDocument"
5
5
  v-scroll.immediate="updateScrollBounds"
@@ -3,10 +3,10 @@ import DocumentThumbnails from "./DocumentThumbnails.vue";
3
3
  describe("Document Thumbnails", () => {
4
4
  beforeEach(() => {
5
5
  cy.fetchDocument();
6
+ cy.mount(DocumentThumbnails);
6
7
  });
7
8
 
8
9
  it("shows thumbnails for all document pages", () => {
9
- cy.mount(DocumentThumbnails);
10
10
  cy.get("#document-pages")
11
11
  .find(".document-thumbnail")
12
12
  .then(($elements) => {
@@ -20,7 +20,6 @@ describe("Document Thumbnails", () => {
20
20
 
21
21
  it("loads thumbnail pictures that are shown on screen", () => {
22
22
  cy.intercept("GET", "**/page/show-thumbnail/**").as("getThumbnail");
23
- cy.mount(DocumentThumbnails);
24
23
 
25
24
  cy.get("#document-pages")
26
25
  .find(".document-thumbnail")
@@ -32,7 +31,6 @@ describe("Document Thumbnails", () => {
32
31
  });
33
32
 
34
33
  it("displays page number correctly", () => {
35
- cy.mount(DocumentThumbnails);
36
34
  cy.get("#document-pages")
37
35
  .find(".document-thumbnail")
38
36
  .each(($row, index) => {
@@ -44,7 +42,6 @@ describe("Document Thumbnails", () => {
44
42
  });
45
43
 
46
44
  it("navigates to every document thumbnail", () => {
47
- cy.mount(DocumentThumbnails);
48
45
  cy.get("#document-pages")
49
46
  .find(".document-thumbnail")
50
47
  .each(($row, index) => {
@@ -22,6 +22,7 @@ describe("Document Top Bar", () => {
22
22
 
23
23
  it("Shows category dropdown if not edit mode or reviewed", () => {
24
24
  cy.mount(DocumentTopBar);
25
+ cy.dispatchAction("edit", "disableEditMode");
25
26
 
26
27
  cy.get("#document-top-bar-component")
27
28
  .find(".left-bar-components")
@@ -69,6 +70,7 @@ describe("Document Top Bar", () => {
69
70
 
70
71
  it("Shows keyboard icon", () => {
71
72
  cy.mount(DocumentTopBar);
73
+ cy.dispatchAction("edit", "disableEditMode");
72
74
 
73
75
  cy.get("#document-top-bar-component")
74
76
  .find(".right-bar-components")
@@ -78,6 +80,7 @@ describe("Document Top Bar", () => {
78
80
 
79
81
  it("Shows disabled finish review button", () => {
80
82
  cy.mount(DocumentTopBar);
83
+ cy.dispatchAction("edit", "disableEditMode");
81
84
 
82
85
  cy.get("#document-top-bar-component")
83
86
  .find(".right-bar-components")
@@ -502,14 +502,16 @@ const getters = {
502
502
  * or if it is Ready Only / Reviewed
503
503
  * and if so disable the option to edit the document
504
504
  */
505
- documentCannotBeEdited: (state) => (document) => {
506
- return (
507
- document.dataset_status === 1 ||
508
- document.dataset_status === 2 ||
509
- document.dataset_status === 3 ||
510
- document.is_reviewed
511
- );
512
- },
505
+ documentCannotBeEdited:
506
+ (state) =>
507
+ (document = state.selectedDocument) => {
508
+ return (
509
+ document.dataset_status === 1 ||
510
+ document.dataset_status === 2 ||
511
+ document.dataset_status === 3 ||
512
+ document.is_reviewed
513
+ );
514
+ },
513
515
 
514
516
  /**
515
517
  * If automatic splitting is enabled for the project
package/src/store/edit.js CHANGED
@@ -20,6 +20,13 @@ const state = {
20
20
  };
21
21
 
22
22
  const getters = {
23
+ isEditModeAvailable: (state, getters, rootState, rootGetters) => {
24
+ return (
25
+ !rootState.document.publicView &&
26
+ !rootGetters["document/isDocumentReviewed"] &&
27
+ !state.editMode
28
+ );
29
+ },
23
30
  isPageSelected: (state) => (id) => {
24
31
  return state.selectedPages.find((page) => page.id === id);
25
32
  },