@konfuzio/document-validation-ui 0.1.6-pre-release-1 → 0.1.6-pre-release-2

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.
Files changed (53) hide show
  1. package/dist/css/app.css +1 -1
  2. package/dist/index.html +1 -1
  3. package/dist/js/app.js +1 -1
  4. package/dist/js/app.js.map +1 -1
  5. package/dist/js/chunk-vendors.js +2 -2
  6. package/dist/js/chunk-vendors.js.map +1 -1
  7. package/package.json +2 -1
  8. package/src/.DS_Store +0 -0
  9. package/src/assets/images/DraggableIcon.vue +14 -0
  10. package/src/assets/images/GridIcon.vue +16 -0
  11. package/src/assets/images/ServerImage.vue +11 -5
  12. package/src/assets/images/SettingsIcon.vue +14 -0
  13. package/src/assets/scss/ann_set_table_options.scss +26 -0
  14. package/src/assets/scss/annotation_details.scss +85 -73
  15. package/src/assets/scss/document_annotations.scss +47 -0
  16. package/src/assets/scss/document_dashboard.scss +1 -2
  17. package/src/assets/scss/document_edit.scss +2 -3
  18. package/src/assets/scss/main.scss +49 -12
  19. package/src/assets/scss/multi_ann_table_overlay.scss +38 -0
  20. package/src/assets/scss/variables.scss +2 -0
  21. package/src/components/App.vue +7 -2
  22. package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +31 -13
  23. package/src/components/DocumentAnnotations/AnnotationContent.vue +5 -3
  24. package/src/components/DocumentAnnotations/AnnotationDetails.vue +7 -3
  25. package/src/components/DocumentAnnotations/AnnotationRow.vue +31 -10
  26. package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +3 -3
  27. package/src/components/DocumentAnnotations/CategorizeModal.vue +5 -1
  28. package/src/components/DocumentAnnotations/DocumentAnnotations.vue +47 -17
  29. package/src/components/DocumentAnnotations/EmptyAnnotation.vue +5 -2
  30. package/src/components/DocumentEdit/DocumentEdit.vue +1 -1
  31. package/src/components/DocumentEdit/EditSidebar.vue +6 -6
  32. package/src/components/DocumentPage/AnnSetTableOptions.vue +109 -0
  33. package/src/components/DocumentPage/DocumentPage.vue +39 -10
  34. package/src/components/DocumentPage/DocumentToolbar.vue +6 -2
  35. package/src/components/DocumentPage/MultiAnnSelection.vue +92 -2
  36. package/src/components/DocumentPage/MultiAnnotationTableOverlay.vue +286 -0
  37. package/src/components/DocumentPage/MultiAnnotationTablePopup.vue +19 -46
  38. package/src/components/DocumentPage/NewAnnotation.vue +1 -1
  39. package/src/components/DocumentPage/ScrollingDocument.vue +6 -1
  40. package/src/components/DocumentTopBar/DocumentName.vue +6 -1
  41. package/src/components/DocumentTopBar/DocumentTopBar.vue +9 -9
  42. package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +4 -3
  43. package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +6 -2
  44. package/src/components/DocumentsList/DocumentsList.vue +11 -2
  45. package/src/locales/de.json +5 -1
  46. package/src/locales/en.json +5 -1
  47. package/src/locales/es.json +5 -1
  48. package/src/main.js +3 -0
  49. package/src/store/category.js +1 -1
  50. package/src/store/display.js +44 -0
  51. package/src/store/document.js +100 -7
  52. package/src/store/edit.js +6 -2
  53. package/src/utils/utils.js +13 -0
@@ -13,10 +13,10 @@
13
13
  <ScrollingPage
14
14
  v-for="page in editMode ? pagesForPostprocess : pages"
15
15
  :key="page.number"
16
+ ref="scrollingPage"
16
17
  :page="page"
17
18
  :client-height="clientHeight"
18
19
  :scroll-top="scrollTop"
19
- ref="scrollingPage"
20
20
  class="scrolling-page"
21
21
  @page-jump="onPageJump"
22
22
  />
@@ -27,6 +27,7 @@
27
27
  </div>
28
28
  <Toolbar v-if="showToolbar" />
29
29
  <ActionBar v-if="showActionBar" />
30
+ <MultiAnnotationTableOverlay v-if="showAnnSetTable" />
30
31
  </div>
31
32
  </template>
32
33
  <script>
@@ -35,12 +36,14 @@ import scroll from "../../directives/scroll";
35
36
  import ScrollingPage from "./ScrollingPage";
36
37
  import Toolbar from "./DocumentToolbar";
37
38
  import ActionBar from "./ActionBar";
39
+ import MultiAnnotationTableOverlay from "./MultiAnnotationTableOverlay";
38
40
 
39
41
  export default {
40
42
  components: {
41
43
  ScrollingPage,
42
44
  Toolbar,
43
45
  ActionBar,
46
+ MultiAnnotationTableOverlay,
44
47
  },
45
48
  directives: {
46
49
  scroll,
@@ -60,6 +63,7 @@ export default {
60
63
  "recalculatingAnnotations",
61
64
  "selectedDocument",
62
65
  "loading",
66
+ "annotationSets",
63
67
  ]),
64
68
  ...mapState("edit", [
65
69
  "editMode",
@@ -71,6 +75,7 @@ export default {
71
75
  "documentActionBar",
72
76
  "pageChangedFromThumbnail",
73
77
  "currentPage",
78
+ "showAnnSetTable",
74
79
  ]),
75
80
  ...mapGetters("display", ["visiblePageRange"]),
76
81
 
@@ -21,7 +21,11 @@
21
21
  </span>
22
22
  <div
23
23
  v-if="
24
- !publicView && showEditBtn && !editMode && !recalculatingAnnotations
24
+ !publicView &&
25
+ !documentIsReviewed &&
26
+ showEditBtn &&
27
+ !editMode &&
28
+ !recalculatingAnnotations
25
29
  "
26
30
  class="edit-btn btn"
27
31
  @click="handleEdit"
@@ -91,6 +95,7 @@ export default {
91
95
  "selectedDocument",
92
96
  "publicView",
93
97
  "recalculatingAnnotations",
98
+ "documentIsReviewed",
94
99
  ]),
95
100
  ...mapState("display", ["optimalResolution"]),
96
101
  ...mapState("edit", ["editMode"]),
@@ -5,21 +5,23 @@
5
5
  class="document-top-bar"
6
6
  >
7
7
  <div v-if="!recalculatingAnnotations" class="left-bar-components">
8
- <DocumentCategory v-if="categories && !editMode && !publicView" />
8
+ <DocumentCategory
9
+ v-if="categories && !editMode && !publicView && !documentIsReviewed"
10
+ />
9
11
  </div>
10
12
 
11
13
  <DocumentName :data-file-name="selectedDocument.data_file_name" />
12
14
 
13
15
  <div v-if="!recalculatingAnnotations" class="right-bar-components">
14
16
  <div
15
- v-if="!editMode && (!publicView || !selectedDocument.is_reviewed)"
17
+ v-if="!editMode && (!publicView || !documentIsReviewed)"
16
18
  class="keyboard-actions-info"
17
19
  >
18
20
  <KeyboardActionsDescription />
19
21
  </div>
20
22
 
21
23
  <div
22
- v-if="!editMode && (publicView || selectedDocument.is_reviewed)"
24
+ v-if="!editMode && (publicView || documentIsReviewed)"
23
25
  class="read-only-info"
24
26
  >
25
27
  <b-tooltip
@@ -27,7 +29,7 @@
27
29
  position="is-bottom"
28
30
  class="right-aligned width-184"
29
31
  >
30
- <span v-if="publicView && !selectedDocument.is_reviewed">
32
+ <span v-if="publicView && !documentIsReviewed">
31
33
  {{ $t("lite_mode") }}
32
34
  </span>
33
35
  <span v-else class="doc-reviewed">
@@ -36,15 +38,12 @@
36
38
  <b-icon
37
39
  :class="[
38
40
  'info-icon is-small',
39
- selectedDocument.is_reviewed && 'info-reviewed',
41
+ documentIsReviewed && 'info-reviewed',
40
42
  ]"
41
43
  icon="circle-info"
42
44
  />
43
45
  <template #content>
44
- <div
45
- v-if="!selectedDocument.is_reviewed"
46
- class="read-only-details"
47
- >
46
+ <div v-if="!documentIsReviewed" class="read-only-details">
48
47
  {{ $t("limited_functionalities") }}
49
48
  </div>
50
49
  <div v-else class="read-only-details">
@@ -96,6 +95,7 @@ export default {
96
95
  "publicView",
97
96
  "loading",
98
97
  "recalculatingAnnotations",
98
+ "documentIsReviewed",
99
99
  ]),
100
100
  ...mapState("category", ["categories"]),
101
101
  ...mapState("edit", ["editMode"]),
@@ -24,7 +24,7 @@
24
24
  </div>
25
25
 
26
26
  <div
27
- v-if="!editMode && !selectedDocument.is_reviewed && !publicView"
27
+ v-if="!editMode && !documentIsReviewed && !publicView"
28
28
  class="finish-review-button-container"
29
29
  >
30
30
  <b-tooltip
@@ -45,7 +45,7 @@
45
45
 
46
46
  <div v-else>
47
47
  <b-notification :closable="false" :class="['loading-background']">
48
- <b-loading :active="isLoading" :is-full-page="loadingOnFullPage">
48
+ <b-loading :active="isLoading" :is-full-page="false">
49
49
  <b-icon
50
50
  icon="spinner"
51
51
  class="fa-spin loading-icon-size spinner"
@@ -80,6 +80,7 @@ export default {
80
80
  "publicView",
81
81
  "finishedReview",
82
82
  "annotationSets",
83
+ "documentIsReviewed",
83
84
  ]),
84
85
  ...mapState("edit", ["editMode", "splitOverview", "updatedDocument"]),
85
86
  },
@@ -92,7 +93,7 @@ export default {
92
93
  this.finishDisabled = true;
93
94
  }
94
95
  },
95
- publicView(newValue) {
96
+ documentIsReviewed(newValue) {
96
97
  if (newValue) {
97
98
  this.finishDisabled = true;
98
99
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- v-if="!publicView && !selectedDocument.is_reviewed && !editMode"
3
+ v-if="!publicView && !documentIsReviewed && !editMode"
4
4
  class="keyboard-actions-description"
5
5
  >
6
6
  <section class="b-tooltips">
@@ -65,7 +65,11 @@ export default {
65
65
  },
66
66
  computed: {
67
67
  ...mapState("edit", ["editMode"]),
68
- ...mapState("document", ["selectedDocument", "publicView"]),
68
+ ...mapState("document", [
69
+ "selectedDocument",
70
+ "publicView",
71
+ "documentIsReviewed",
72
+ ]),
69
73
  },
70
74
  };
71
75
  </script>
@@ -71,6 +71,11 @@
71
71
  import { mapGetters, mapState } from "vuex";
72
72
  import ServerImage from "../../assets/images/ServerImage";
73
73
  import ErrorIcon from "../../assets/images/ErrorIcon";
74
+ import {
75
+ getURLQueryParam,
76
+ navigateToNewDocumentURL,
77
+ getURLPath,
78
+ } from "../../utils/utils";
74
79
 
75
80
  /**
76
81
  * This component creates a horizontal list of documents
@@ -105,8 +110,12 @@ export default {
105
110
  },
106
111
  methods: {
107
112
  changeDocument(documentId) {
108
- this.$store.dispatch("document/setDocId", documentId);
109
- this.$store.dispatch("document/fetchDocument");
113
+ if (getURLQueryParam("document") || getURLPath("docs")) {
114
+ navigateToNewDocumentURL(this.selectedDocument.id, documentId);
115
+ } else {
116
+ this.$store.dispatch("document/setDocId", documentId);
117
+ this.$store.dispatch("document/fetchDocument");
118
+ }
110
119
  },
111
120
  requestTrialAccess() {
112
121
  window.open("https://konfuzio.com", "_blank");
@@ -126,5 +126,9 @@
126
126
  "no": "Nein",
127
127
  "yes": "Ja",
128
128
  "split_modal_no_suggestions": "Do you need to split the document? <strong>We strongly recommend</strong> splitting it at this stage, otherwise all the progress you’ve made will be lost in the future.",
129
- "missing_from_document": "Fehlt im Dokument"
129
+ "missing_from_document": "Fehlt im Dokument",
130
+ "edit_label": "Edit label",
131
+ "delete_label": "Delete label",
132
+ "table": "Table",
133
+ "delete_table": "Delete table"
130
134
  }
@@ -128,5 +128,9 @@
128
128
  "yes": "Yes",
129
129
  "prepare_document": "Prepare the document",
130
130
  "split_modal_no_suggestions": "Do you need to split the document? <strong>We strongly recommend</strong> splitting it at this stage, otherwise all the progress you’ve made will be lost in the future.",
131
- "missing_from_document": "Missing from the document"
131
+ "missing_from_document": "Missing from the document",
132
+ "edit_label": "Edit label",
133
+ "delete_label": "Delete label",
134
+ "table": "Table",
135
+ "delete_table": "Delete table"
132
136
  }
@@ -125,5 +125,9 @@
125
125
  "no": "No",
126
126
  "yes": "Sí",
127
127
  "split_modal_no_suggestions": "Do you need to split the document? <strong>We strongly recommend</strong> splitting it at this stage, otherwise all the progress you’ve made will be lost in the future.",
128
- "missing_from_document": "Falta en el documento"
128
+ "missing_from_document": "Falta en el documento",
129
+ "edit_label": "Edit label",
130
+ "delete_label": "Delete label",
131
+ "table": "Table",
132
+ "delete_table": "Delete table"
129
133
  }
package/src/main.js CHANGED
@@ -8,6 +8,8 @@ import { Integrations } from "@sentry/tracing";
8
8
  import i18n from "./i18n";
9
9
  import store from "./store";
10
10
  import { library } from "@fortawesome/fontawesome-svg-core";
11
+ import VueObserveVisibility from "vue-observe-visibility";
12
+
11
13
  // internal icons
12
14
  import {
13
15
  faArrowUp,
@@ -55,6 +57,7 @@ Vue.use(Buefy, {
55
57
  defaultIconPack: "fas",
56
58
  defaultIconComponent: "vue-fontawesome",
57
59
  });
60
+ Vue.use(VueObserveVisibility);
58
61
 
59
62
  // Sentry config
60
63
  if (process.env.NODE_ENV != "development") {
@@ -54,7 +54,7 @@ const actions = {
54
54
  */
55
55
  fetchDocumentList: ({ commit, rootState }, categoryId) => {
56
56
  return HTTP.get(
57
- `documents/?category=${categoryId}&assignee=${rootState.project.currentUser}`
57
+ `documents/?category=${categoryId}&assignee=${rootState.project.currentUser}&limit=100`
58
58
  )
59
59
  .then((response) => {
60
60
  if (response.data.results) {
@@ -30,6 +30,7 @@ const state = {
30
30
  documentActionBar: null, // document action bar properties
31
31
  categorizeModalIsActive: false,
32
32
  pageChangedFromThumbnail: false,
33
+ showAnnSetTable: null,
33
34
  };
34
35
 
35
36
  const getters = {
@@ -60,6 +61,31 @@ const getters = {
60
61
  imageScale: (state) => (page) => {
61
62
  return new BigNumber(page.size[0]).div(page.original_size[0]).toNumber();
62
63
  },
64
+ bboxToPoint:
65
+ (state, getters) =>
66
+ (page, point, hasOffset = false) => {
67
+ const imageScale = getters.imageScale(page);
68
+ const { x, y } = point;
69
+ const pageHeight = new BigNumber(page.original_size[1]);
70
+ const newPoint = {
71
+ // left
72
+ x: new BigNumber(x)
73
+ .minus(hasOffset ? 1 : 0)
74
+ .times(state.scale)
75
+ .times(imageScale)
76
+ .div(PIXEL_RATIO)
77
+ .toNumber(),
78
+ // top
79
+ y: pageHeight
80
+ .minus(new BigNumber(y))
81
+ .minus(hasOffset ? 17.1 : 0)
82
+ .times(state.scale)
83
+ .times(imageScale)
84
+ .div(PIXEL_RATIO)
85
+ .toNumber(),
86
+ };
87
+ return newPoint;
88
+ },
63
89
  bboxToRect:
64
90
  (state, getters) =>
65
91
  (page, bbox, hasOffset = false) => {
@@ -207,6 +233,12 @@ const actions = {
207
233
  show ? { icon, text, action, loading } : null
208
234
  );
209
235
  },
236
+ showAnnSetTable({ commit }, tableSet) {
237
+ commit("SET_ANN_SET_TABLE", tableSet);
238
+ },
239
+ toggleAnnSetTable({ commit }, tableSet) {
240
+ commit("TOGGLE_ANN_SET_TABLE", tableSet);
241
+ },
210
242
  setCategorizeModalIsActive: ({ commit }, value) => {
211
243
  commit("SET_CATEGORIZE_MODAL_IS_ACTIVE", value);
212
244
  },
@@ -236,6 +268,18 @@ const mutations = {
236
268
  state.documentActionBar = actionBar;
237
269
  },
238
270
 
271
+ SET_ANN_SET_TABLE: (state, tableSet) => {
272
+ state.showAnnSetTable = tableSet;
273
+ },
274
+
275
+ TOGGLE_ANN_SET_TABLE: (state, tableSet) => {
276
+ if (state.showAnnSetTable) {
277
+ state.showAnnSetTable = null;
278
+ } else {
279
+ state.showAnnSetTable = tableSet;
280
+ }
281
+ },
282
+
239
283
  SET_CATEGORIZE_MODAL_IS_ACTIVE: (state, value) => {
240
284
  state.categorizeModalIsActive = value;
241
285
  },
@@ -3,6 +3,7 @@ import { sleep } from "../utils/utils";
3
3
 
4
4
  const HTTP = myImports.HTTP;
5
5
  const documentPollDuration = 1000;
6
+ export const table_reference_api = "api.v3.dvui.table";
6
7
 
7
8
  const state = {
8
9
  loading: true,
@@ -29,6 +30,7 @@ const state = {
29
30
  selectedEntities: null,
30
31
  serverError: false,
31
32
  splittingSuggestions: null,
33
+ documentIsReviewed: false,
32
34
  };
33
35
 
34
36
  const getters = {
@@ -158,6 +160,78 @@ const getters = {
158
160
  return state.annotationSets.find((annSet) => annSet.id === annotationSetId);
159
161
  },
160
162
 
163
+ /* Get annotation sets created in table */
164
+ annotationSetsInTable: (state) => () => {
165
+ const annotationSetsList = {};
166
+ state.annotationSets.forEach((annotationSet) => {
167
+ let addAnnotationSet = false;
168
+ if (annotationSet.labels) {
169
+ annotationSet.labels.forEach((label) => {
170
+ if (
171
+ label.annotations &&
172
+ label.annotations.find(
173
+ (annotation) =>
174
+ annotation.origin && annotation.origin === table_reference_api
175
+ )
176
+ ) {
177
+ addAnnotationSet = true;
178
+ return;
179
+ }
180
+ });
181
+ }
182
+ if (addAnnotationSet) {
183
+ // group by label set
184
+ if (annotationSetsList[`${annotationSet.label_set.id}`]) {
185
+ annotationSetsList[`${annotationSet.label_set.id}`].push(
186
+ annotationSet
187
+ );
188
+ } else {
189
+ annotationSetsList[`${annotationSet.label_set.id}`] = [annotationSet];
190
+ }
191
+ }
192
+ });
193
+ return annotationSetsList;
194
+ },
195
+
196
+ /* Get annotation sets without tables */
197
+ annotationSetsToShowInList: (state) => () => {
198
+ const annotationSetsList = [];
199
+ state.annotationSets.forEach((annotationSet) => {
200
+ let addAnnotationSet = true;
201
+ if (annotationSet.labels) {
202
+ annotationSet.labels.forEach((label) => {
203
+ if (
204
+ label.annotations &&
205
+ label.annotations.find(
206
+ (annotation) =>
207
+ annotation.origin && annotation.origin === table_reference_api
208
+ )
209
+ ) {
210
+ addAnnotationSet = false;
211
+ return;
212
+ }
213
+ });
214
+ }
215
+ if (addAnnotationSet) {
216
+ annotationSetsList.push(annotationSet);
217
+ }
218
+ });
219
+ return annotationSetsList;
220
+ },
221
+
222
+ /* Get annotations inside a list of annotation sets */
223
+ annotationsInAnnotationsSets: (state) => (annotationsSets) => {
224
+ const annotations = [];
225
+ annotationsSets.forEach((annotationSet) => {
226
+ annotationSet.labels.forEach((label) => {
227
+ label.annotations.forEach((annotation) => {
228
+ annotations.push(annotation);
229
+ });
230
+ });
231
+ });
232
+ return annotations;
233
+ },
234
+
161
235
  /* Process annotations and extract labels and sets */
162
236
  processAnnotationSets: (state, getters) => (annotationSets) => {
163
237
  // group annotations for sidebar
@@ -229,6 +303,7 @@ const getters = {
229
303
  });
230
304
  return found ? `${value + 1}` : "";
231
305
  }
306
+ return "";
232
307
  },
233
308
 
234
309
  /**
@@ -628,6 +703,9 @@ const actions = {
628
703
  setSplittingSuggestions: ({ commit }, value) => {
629
704
  commit("SET_SPLITTING_SUGGESTIONS", value);
630
705
  },
706
+ setDocumentIsReviewed: ({ commit }, value) => {
707
+ commit("SET_DOCUMENT_IS_REVIEWED", value);
708
+ },
631
709
 
632
710
  /**
633
711
  * Actions that use HTTP requests always return the axios promise,
@@ -658,11 +736,13 @@ const actions = {
658
736
  if (response.data.pages.length > 0) {
659
737
  dispatch("fetchDocumentPage", initialPage);
660
738
  }
739
+
661
740
  // set information on the store
662
741
  commit("SET_ANNOTATION_SETS", annotationSets);
663
742
  commit("SET_ANNOTATIONS", annotations);
664
743
  commit("SET_LABELS", labels);
665
744
  commit("SET_SELECTED_DOCUMENT", response.data);
745
+ commit("SET_DOCUMENT_IS_REVIEWED", response.data.is_reviewed);
666
746
  commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
667
747
 
668
748
  if (rootState.project.projectId) {
@@ -741,7 +821,7 @@ const actions = {
741
821
  id: annotation.id,
742
822
  span,
743
823
  page: span.page_index + 1,
744
- labelName: label.name,
824
+ labelName: label ? label.name : "",
745
825
  };
746
826
  commit("SET_DOCUMENT_ANNOTATION_SELECTED", value);
747
827
  },
@@ -1077,11 +1157,21 @@ const mutations = {
1077
1157
  (existingAnnotation) => existingAnnotation.id === annotation.id
1078
1158
  );
1079
1159
  if (indexOfAnnotationAnnotationSets > -1) {
1080
- label.annotations.splice(
1081
- indexOfAnnotationAnnotationSets,
1082
- 1,
1083
- annotation
1084
- );
1160
+ // checks if an annotation label was changed and add it to the new label
1161
+ if (annotation.label && annotation.label.id !== label.id) {
1162
+ label.annotations.splice(indexOfAnnotationAnnotationSets, 1);
1163
+
1164
+ const labelToAdd = annotationSet.labels.find(
1165
+ (labelToAdd) => labelToAdd.id === annotation.label.id
1166
+ );
1167
+ labelToAdd.annotations.push(annotation);
1168
+ } else {
1169
+ label.annotations.splice(
1170
+ indexOfAnnotationAnnotationSets,
1171
+ 1,
1172
+ annotation
1173
+ );
1174
+ }
1085
1175
  updatedAnnotation = true;
1086
1176
  return;
1087
1177
  }
@@ -1158,7 +1248,7 @@ const mutations = {
1158
1248
  },
1159
1249
  SET_SELECTED_DOCUMENT: (state, document) => {
1160
1250
  if (document.is_reviewed === true) {
1161
- state.publicView = true;
1251
+ state.documentIsReviewed = true;
1162
1252
  }
1163
1253
  state.selectedDocument = document;
1164
1254
 
@@ -1228,6 +1318,9 @@ const mutations = {
1228
1318
  SET_SPLITTING_SUGGESTIONS: (state, array) => {
1229
1319
  state.splittingSuggestions = array;
1230
1320
  },
1321
+ SET_DOCUMENT_IS_REVIEWED: (state, value) => {
1322
+ state.documentIsReviewed = value;
1323
+ },
1231
1324
  };
1232
1325
 
1233
1326
  export default {
package/src/store/edit.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import myImports from "../api";
2
- import { getURLQueryParam, navigateToNewDocumentURL } from "../utils/utils";
2
+ import {
3
+ getURLQueryParam,
4
+ navigateToNewDocumentURL,
5
+ getURLPath,
6
+ } from "../utils/utils";
3
7
 
4
8
  const HTTP = myImports.HTTP;
5
9
 
@@ -164,7 +168,7 @@ const actions = {
164
168
  dispatch("document/setSplittingSuggestions", null, { root: true });
165
169
 
166
170
  if (newId !== oldId) {
167
- if (getURLQueryParam("document")) {
171
+ if (getURLQueryParam("document") || getURLPath("docs")) {
168
172
  navigateToNewDocumentURL(oldId, newId);
169
173
  } else {
170
174
  await dispatch("document/setDocId", newId, {
@@ -5,12 +5,25 @@ export function sleep(duration) {
5
5
  export function getURLQueryParam(param) {
6
6
  const queryString = window.location.search;
7
7
  const urlParams = new URLSearchParams(queryString);
8
+
8
9
  if (urlParams.has(param)) {
9
10
  return urlParams.get(param);
10
11
  }
11
12
  return undefined;
12
13
  }
13
14
 
15
+ export function getURLPath(value) {
16
+ const path = window.location.pathname;
17
+
18
+ if (!path.includes(value)) return;
19
+
20
+ const id = path.split(value)[1].split("/")[1];
21
+
22
+ if (id === "") return;
23
+
24
+ return id;
25
+ }
26
+
14
27
  export function navigateToNewDocumentURL(oldId, newId) {
15
28
  const url = window.location.href;
16
29
  const newUrl = url.replace(oldId, newId);