@konfuzio/document-validation-ui 0.1.4 → 0.1.5-automatic-document-splitting
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/dist/css/app.css +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.js +1 -1
- package/dist/js/app.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/images/MagicWandIcon.vue +16 -0
- package/src/assets/images/ServerImage.vue +3 -0
- package/src/assets/images/SplitZigZag.vue +47 -14
- package/src/assets/images/StarIcon.vue +16 -0
- package/src/assets/scss/document_category.scss +0 -1
- package/src/assets/scss/document_dashboard.scss +6 -0
- package/src/assets/scss/document_edit.scss +135 -46
- package/src/assets/scss/splitting_confirmation_modal.scss +41 -0
- package/src/assets/scss/variables.scss +63 -1
- package/src/components/App.vue +11 -1
- package/src/components/DocumentAnnotations/ActionButtons.vue +7 -0
- package/src/components/DocumentAnnotations/AnnotationContent.vue +3 -0
- package/src/components/DocumentAnnotations/AnnotationRow.vue +3 -0
- package/src/components/DocumentAnnotations/CategorizeModal.vue +24 -4
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +11 -3
- package/src/components/DocumentAnnotations/DocumentLabel.vue +2 -0
- package/src/components/DocumentAnnotations/EmptyAnnotation.vue +6 -1
- package/src/components/DocumentCategory.vue +39 -33
- package/src/components/DocumentDashboard.vue +39 -49
- package/src/components/DocumentEdit/DocumentEdit.vue +207 -69
- package/src/components/DocumentEdit/EditConfirmationModal.vue +54 -0
- package/src/components/DocumentEdit/EditPages.vue +30 -18
- package/src/components/DocumentEdit/EditSidebar.vue +95 -45
- package/src/components/DocumentEdit/SidebarButtons.vue +53 -0
- package/src/components/DocumentEdit/SplitInfoBar.vue +19 -0
- package/src/components/DocumentEdit/SplitOverview.vue +6 -5
- package/src/components/{DocumentError.vue → DocumentModals/DocumentErrorModal.vue} +3 -4
- package/src/components/{NotOptimizedViewportModal.vue → DocumentModals/NotOptimizedViewportModal.vue} +2 -2
- package/src/components/DocumentModals/SplittingSuggestionsModal.vue +121 -0
- package/src/components/DocumentPage/DocumentPage.vue +9 -3
- package/src/components/DocumentPage/DummyPage.vue +9 -7
- package/src/components/DocumentPage/ScrollingDocument.vue +8 -3
- package/src/components/DocumentThumbnails/DocumentThumbnails.vue +45 -8
- package/src/components/DocumentTopBar/DocumentName.vue +1 -0
- package/src/components/DocumentTopBar/DocumentTopBar.vue +2 -6
- package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +6 -20
- package/src/components/index.js +1 -0
- package/src/locales/de.json +15 -2
- package/src/locales/en.json +15 -1
- package/src/locales/es.json +14 -1
- package/src/store/display.js +8 -0
- package/src/store/document.js +83 -37
- package/src/store/edit.js +66 -48
- package/src/store/project.js +14 -14
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
<div :class="['document-edit', splitOverview && 'split-overview-component']">
|
|
3
3
|
<div v-if="!splitOverview" class="pages-section">
|
|
4
4
|
<EditPages
|
|
5
|
-
:
|
|
5
|
+
:splitting-lines="splittingLines"
|
|
6
|
+
:split-suggestions-enabled="splitSuggestionsEnabled"
|
|
6
7
|
@change-page="changePage"
|
|
7
8
|
@handle-splitting-lines="handleSplittingLines"
|
|
8
9
|
@check-move="checkMove"
|
|
9
10
|
@handle-drag-end="handleDragEnd"
|
|
10
11
|
/>
|
|
12
|
+
<div class="info-bar">
|
|
13
|
+
<SplitInfoBar v-if="splitSuggestionsEnabled" />
|
|
14
|
+
</div>
|
|
11
15
|
</div>
|
|
12
16
|
<div v-else class="split-overview-section">
|
|
13
17
|
<SplitOverview
|
|
@@ -22,8 +26,13 @@
|
|
|
22
26
|
@rotate-right="rotatePage"
|
|
23
27
|
@rotate-all-left="handleRotationsToTheLeft"
|
|
24
28
|
@rotate-all-right="handleRotationsToTheRight"
|
|
29
|
+
@handle-splitting-suggestions="applySplittingSuggestions"
|
|
30
|
+
:split-suggestions-enabled="splitSuggestionsEnabled"
|
|
25
31
|
/>
|
|
26
32
|
</div>
|
|
33
|
+
<div class="confirmation-modal-container">
|
|
34
|
+
<EditConfirmationModal @save-changes="saveEditChanges" />
|
|
35
|
+
</div>
|
|
27
36
|
</div>
|
|
28
37
|
</template>
|
|
29
38
|
<script>
|
|
@@ -31,6 +40,8 @@ import { mapState } from "vuex";
|
|
|
31
40
|
import EditSidebar from "./EditSidebar";
|
|
32
41
|
import SplitOverview from "./SplitOverview";
|
|
33
42
|
import EditPages from "./EditPages";
|
|
43
|
+
import SplitInfoBar from "./SplitInfoBar";
|
|
44
|
+
import EditConfirmationModal from "./EditConfirmationModal";
|
|
34
45
|
|
|
35
46
|
/**
|
|
36
47
|
* This component shows a document thumbnail grid view and sidebar, to be able to edit the document.
|
|
@@ -41,22 +52,29 @@ export default {
|
|
|
41
52
|
EditSidebar,
|
|
42
53
|
SplitOverview,
|
|
43
54
|
EditPages,
|
|
55
|
+
SplitInfoBar,
|
|
56
|
+
EditConfirmationModal,
|
|
44
57
|
},
|
|
45
58
|
data() {
|
|
46
59
|
return {
|
|
47
|
-
fileName:
|
|
60
|
+
fileName: null,
|
|
48
61
|
fileExtension: null,
|
|
49
|
-
|
|
62
|
+
splittingLines: [],
|
|
50
63
|
dragging: false,
|
|
51
64
|
prevPageAtIndex: null,
|
|
65
|
+
splitSuggestionsEnabled: false,
|
|
52
66
|
};
|
|
53
67
|
},
|
|
54
68
|
computed: {
|
|
55
|
-
...mapState("document", [
|
|
69
|
+
...mapState("document", [
|
|
70
|
+
"recalculatingAnnotations",
|
|
71
|
+
"selectedDocument",
|
|
72
|
+
"splittingSuggestions",
|
|
73
|
+
]),
|
|
56
74
|
...mapState("display", ["currentPage"]),
|
|
57
75
|
...mapState("edit", [
|
|
58
76
|
"editMode",
|
|
59
|
-
"
|
|
77
|
+
"pagesForPostprocess",
|
|
60
78
|
"updatedDocument",
|
|
61
79
|
"splitOverview",
|
|
62
80
|
"selectedPages",
|
|
@@ -65,6 +83,7 @@ export default {
|
|
|
65
83
|
watch: {
|
|
66
84
|
pages() {
|
|
67
85
|
if (!this.selectedDocument) return;
|
|
86
|
+
|
|
68
87
|
this.setPages();
|
|
69
88
|
},
|
|
70
89
|
splitOverview(newValue) {
|
|
@@ -72,9 +91,18 @@ export default {
|
|
|
72
91
|
this.splitFileNameFromExtension();
|
|
73
92
|
}
|
|
74
93
|
},
|
|
75
|
-
|
|
94
|
+
pagesForPostprocess(newValue) {
|
|
76
95
|
if (newValue) {
|
|
77
|
-
this.
|
|
96
|
+
this.saveUpdatedDocuments();
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
splittingLines(newValue) {
|
|
100
|
+
const aiSplit = newValue.find((item) => item.origin === "AI");
|
|
101
|
+
|
|
102
|
+
// If there are no AI suggestions left, because of being manually removed by the user
|
|
103
|
+
// the Smart Split switch should be turned off
|
|
104
|
+
if (!aiSplit) {
|
|
105
|
+
this.splitSuggestionsEnabled = false;
|
|
78
106
|
}
|
|
79
107
|
},
|
|
80
108
|
},
|
|
@@ -86,16 +114,30 @@ export default {
|
|
|
86
114
|
if (!this.selectedDocument) {
|
|
87
115
|
return;
|
|
88
116
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.$store.dispatch(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
this.activeSplittingLines = new Array(
|
|
95
|
-
this.selectedDocument.pages.length - 1
|
|
117
|
+
|
|
118
|
+
// set array of pages only with the data we need for postprocessing the document
|
|
119
|
+
this.$store.dispatch(
|
|
120
|
+
"edit/setPagesForPostprocess",
|
|
121
|
+
this.createPagesForPostprocess()
|
|
96
122
|
);
|
|
123
|
+
|
|
124
|
+
// Create array with placeholder data for the splitting points
|
|
125
|
+
if (this.selectedDocument.pages.length > 0) {
|
|
126
|
+
this.selectedDocument.pages.map((page) => {
|
|
127
|
+
if (page.number === this.selectedDocument.pages.length) {
|
|
128
|
+
this.setSplittingArray(page.number, null);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this.setSplittingArray(0, null);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
if (this.splittingSuggestions) {
|
|
135
|
+
this.splitSuggestionsEnabled = true;
|
|
136
|
+
this.setAutomaticSplitting();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
97
139
|
},
|
|
98
|
-
|
|
140
|
+
createPagesForPostprocess() {
|
|
99
141
|
return this.selectedDocument.pages.map((page) => {
|
|
100
142
|
return {
|
|
101
143
|
id: page.id,
|
|
@@ -137,12 +179,44 @@ export default {
|
|
|
137
179
|
},
|
|
138
180
|
|
|
139
181
|
/** SPLIT */
|
|
182
|
+
setAutomaticSplitting() {
|
|
183
|
+
// map over splitting suggestions to find the page number based on the page id
|
|
184
|
+
// to update the splittingLines array with this data
|
|
185
|
+
|
|
186
|
+
this.splittingSuggestions.map((item) => {
|
|
187
|
+
const firstPage = this.selectedDocument.pages.find(
|
|
188
|
+
(page) => page.id === item.pages[0].id
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
if (firstPage.number === 1) {
|
|
192
|
+
// only add the active splitting line from the 1st page of the second document
|
|
193
|
+
// since it's the first splitting point
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
this.handleSplittingLines(firstPage.number, "AI");
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
applySplittingSuggestions(value) {
|
|
201
|
+
// Show information bar
|
|
202
|
+
this.splitSuggestionsEnabled = value;
|
|
203
|
+
|
|
204
|
+
// Apply or remove split lines
|
|
205
|
+
this.setAutomaticSplitting();
|
|
206
|
+
},
|
|
207
|
+
setSplittingArray(pageNumber, splittingOrigin) {
|
|
208
|
+
// This function sets the splittingLines array
|
|
209
|
+
// based on splitting suggestions or no suggestions
|
|
210
|
+
this.splittingLines.push({
|
|
211
|
+
page: pageNumber,
|
|
212
|
+
origin: splittingOrigin,
|
|
213
|
+
});
|
|
214
|
+
},
|
|
140
215
|
splitFileNameFromExtension() {
|
|
141
216
|
if (!this.selectedDocument) return;
|
|
142
217
|
|
|
143
218
|
// Save the file name and the extension in different variables
|
|
144
219
|
// to be used in the next step of the splitting
|
|
145
|
-
|
|
146
220
|
if (this.selectedDocument.data_file_name) {
|
|
147
221
|
this.fileName = this.selectedDocument.data_file_name
|
|
148
222
|
.split(".")
|
|
@@ -156,57 +230,76 @@ export default {
|
|
|
156
230
|
.at(-1);
|
|
157
231
|
}
|
|
158
232
|
},
|
|
159
|
-
handleSplittingLines(page) {
|
|
160
|
-
//
|
|
161
|
-
// Add page number to specific index
|
|
162
|
-
// Or replace it with 0 (to keep the same index) if it exists
|
|
163
|
-
const found = this.
|
|
164
|
-
|
|
165
|
-
|
|
233
|
+
handleSplittingLines(page, origin) {
|
|
234
|
+
// To select and deselect the division lines
|
|
235
|
+
// Add page number & origin to specific index
|
|
236
|
+
// Or replace it with 0 (to keep the same index & array length) if it exists
|
|
237
|
+
const found = this.splittingLines.find((item) => item.page === page);
|
|
238
|
+
|
|
239
|
+
// new line added or removed based on the page clicked:
|
|
240
|
+
const newPage = { page: page, origin: origin };
|
|
241
|
+
const removedPage = { page: 0, origin: origin };
|
|
166
242
|
|
|
167
|
-
if (
|
|
168
|
-
this.
|
|
243
|
+
if (
|
|
244
|
+
page === this.splittingLines.length ||
|
|
245
|
+
(!this.splitSuggestionsEnabled && !found && origin === "AI")
|
|
246
|
+
) {
|
|
247
|
+
// check if it's the last item to keep unchanged
|
|
248
|
+
// Or if splitting is switched off, but some of the suggestion lines
|
|
249
|
+
// were removed manually
|
|
250
|
+
return;
|
|
251
|
+
} else if (this.splitSuggestionsEnabled && origin === "AI") {
|
|
252
|
+
// if manual suggestions were added but we enable automatic splitting,
|
|
253
|
+
// this last one takes over
|
|
254
|
+
this.splittingLines.splice(page - 1, 1, newPage);
|
|
255
|
+
} else if (found) {
|
|
256
|
+
// If splitting is switched off and we have manual splits,
|
|
257
|
+
// those should stay unchanged
|
|
258
|
+
if (!this.splitSuggestionsEnabled && found.origin !== origin) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
this.splittingLines.splice(page - 1, 1, removedPage);
|
|
169
263
|
} else {
|
|
170
|
-
this.
|
|
264
|
+
this.splittingLines.splice(page - 1, 1, newPage);
|
|
171
265
|
}
|
|
172
266
|
|
|
173
|
-
this.
|
|
267
|
+
this.saveUpdatedDocuments();
|
|
174
268
|
},
|
|
175
|
-
|
|
269
|
+
saveUpdatedDocuments() {
|
|
176
270
|
this.splitFileNameFromExtension();
|
|
177
271
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
(item) => item !== 0
|
|
272
|
+
const clickedLines = this.splittingLines.filter(
|
|
273
|
+
(item) => item.page !== 0
|
|
181
274
|
);
|
|
182
275
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
276
|
+
const newDocuments = this.createEachNewDocument(
|
|
277
|
+
clickedLines,
|
|
278
|
+
clickedLines.length
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
// // Set the state to the created array
|
|
282
|
+
this.$store.dispatch("edit/setUpdatedDocument", newDocuments);
|
|
283
|
+
},
|
|
284
|
+
createEachNewDocument(clickedLines, length) {
|
|
285
|
+
const documents = new Array(length);
|
|
286
|
+
|
|
287
|
+
for (let i = 0; i < length; i++) {
|
|
288
|
+
const newDocument = {
|
|
289
|
+
name: this.handleNewDocumentName(i),
|
|
290
|
+
category: this.handleNewDocumentCategory(i, clickedLines),
|
|
291
|
+
pages: this.handleNewDocumentPages(i, clickedLines),
|
|
194
292
|
};
|
|
195
293
|
|
|
196
|
-
//
|
|
197
|
-
|
|
294
|
+
// we replace the "undefined" with the created object
|
|
295
|
+
documents.splice(i, 1, newDocument);
|
|
198
296
|
}
|
|
199
297
|
|
|
200
|
-
|
|
201
|
-
this.$store.dispatch("edit/setUpdatedDocument", pageObjectArray);
|
|
298
|
+
return documents;
|
|
202
299
|
},
|
|
203
|
-
|
|
300
|
+
handleNewDocumentName(index) {
|
|
204
301
|
let newFileName;
|
|
205
302
|
|
|
206
|
-
// Return original file name,
|
|
207
|
-
// file name + copy,
|
|
208
|
-
// or file name + copy + number
|
|
209
|
-
// based on where the object will be located in the array
|
|
210
303
|
if (index === 0) {
|
|
211
304
|
newFileName = this.selectedDocument.data_file_name;
|
|
212
305
|
} else if (index === 1) {
|
|
@@ -216,50 +309,95 @@ export default {
|
|
|
216
309
|
}
|
|
217
310
|
return newFileName;
|
|
218
311
|
},
|
|
219
|
-
|
|
220
|
-
|
|
312
|
+
handleNewDocumentCategory(index, clickedLines) {
|
|
313
|
+
if (clickedLines[index].origin && clickedLines[index].origin === "AI") {
|
|
314
|
+
// get the index of the new document in the splitting suggestions
|
|
315
|
+
// to return its category
|
|
316
|
+
const i = this.indexOfSplittingSuggestion(index, clickedLines);
|
|
317
|
+
|
|
318
|
+
return this.splittingSuggestions[i].category;
|
|
319
|
+
} else {
|
|
320
|
+
return this.selectedDocument.category;
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
handleNewDocumentPages(index, clickedLines) {
|
|
324
|
+
// assign the correct pages to each new document
|
|
221
325
|
let pages;
|
|
222
326
|
|
|
223
327
|
if (index === 0) {
|
|
224
|
-
pages = this.
|
|
225
|
-
0,
|
|
226
|
-
splittingLine[index]
|
|
227
|
-
);
|
|
328
|
+
pages = this.pagesForPostprocess.slice(0, clickedLines[index].page);
|
|
228
329
|
} else {
|
|
229
|
-
if (!
|
|
230
|
-
pages = this.
|
|
231
|
-
splittingLine[index - 1]
|
|
232
|
-
);
|
|
330
|
+
if (!clickedLines[index].page) {
|
|
331
|
+
pages = this.pagesForPostprocess.slice(clickedLines[index - 1].page);
|
|
233
332
|
} else {
|
|
234
|
-
pages = this.
|
|
235
|
-
|
|
236
|
-
|
|
333
|
+
pages = this.pagesForPostprocess.slice(
|
|
334
|
+
clickedLines[index - 1].page,
|
|
335
|
+
clickedLines[index].page
|
|
237
336
|
);
|
|
238
337
|
}
|
|
239
338
|
}
|
|
339
|
+
|
|
240
340
|
return pages;
|
|
241
341
|
},
|
|
342
|
+
indexOfSplittingSuggestion(index, clickedLines) {
|
|
343
|
+
const foundPage = this.selectedDocument.pages.find(
|
|
344
|
+
(page) => page.number === clickedLines[index].page
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
const singleSplittingSuggestion = this.splittingSuggestions.find(
|
|
348
|
+
(item) => item.pages[0].id === foundPage.id
|
|
349
|
+
);
|
|
350
|
+
|
|
351
|
+
return this.splittingSuggestions.indexOf(singleSplittingSuggestion);
|
|
352
|
+
},
|
|
242
353
|
|
|
243
354
|
/** SORT */
|
|
244
355
|
checkMove(e) {
|
|
245
356
|
// Save the page placed originally where the page we are dragging will go
|
|
246
|
-
this.prevPageAtIndex = this.
|
|
357
|
+
this.prevPageAtIndex = this.pagesForPostprocess.find(
|
|
247
358
|
(page) =>
|
|
248
|
-
this.
|
|
359
|
+
this.pagesForPostprocess.indexOf(page) ===
|
|
249
360
|
e.draggedContext.futureIndex
|
|
250
361
|
);
|
|
251
362
|
},
|
|
252
363
|
handleDragEnd() {
|
|
253
364
|
// Update page numbers
|
|
254
|
-
const pages = this.
|
|
255
|
-
const index = this.
|
|
365
|
+
const pages = this.pagesForPostprocess.map((page) => {
|
|
366
|
+
const index = this.pagesForPostprocess.indexOf(page);
|
|
256
367
|
return {
|
|
257
368
|
...page,
|
|
258
369
|
number: index + 1,
|
|
259
370
|
};
|
|
260
371
|
});
|
|
261
372
|
|
|
262
|
-
this.$store.dispatch("edit/
|
|
373
|
+
this.$store.dispatch("edit/setPagesForPostprocess", pages);
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
/** SUBMIT CHANGES */
|
|
377
|
+
// Send update request to the backend
|
|
378
|
+
saveEditChanges() {
|
|
379
|
+
this.$store
|
|
380
|
+
.dispatch("edit/editDocument", this.updatedDocument)
|
|
381
|
+
.catch((error) => {
|
|
382
|
+
this.$store.dispatch("document/createErrorMessage", {
|
|
383
|
+
error,
|
|
384
|
+
serverErrorMessage: this.$t("server_error"),
|
|
385
|
+
defaultErrorMessage: this.$t("edit_error"),
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
this.closeEditMode();
|
|
390
|
+
},
|
|
391
|
+
|
|
392
|
+
closeEditMode() {
|
|
393
|
+
this.$store.dispatch("edit/disableEditMode");
|
|
394
|
+
this.$store.dispatch("edit/setSplitOverview", false);
|
|
395
|
+
this.$store.dispatch("edit/setUpdatedDocument", null);
|
|
396
|
+
this.$store.dispatch("edit/setSelectedPages", null);
|
|
397
|
+
this.$nextTick(() => {
|
|
398
|
+
// reset to first page
|
|
399
|
+
this.$store.dispatch("display/updateCurrentPage", 1);
|
|
400
|
+
});
|
|
263
401
|
},
|
|
264
402
|
},
|
|
265
403
|
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="edit-confirmation-modal">
|
|
3
|
+
<b-modal v-model="isModalActive" :can-cancel="[]" class="edit-modal">
|
|
4
|
+
<section class="modal-card-body">
|
|
5
|
+
<div class="header">
|
|
6
|
+
<p class="modal-title">{{ $t("confirm_splitting") }}</p>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="content">{{ $t("splitting_warning") }}</div>
|
|
9
|
+
</section>
|
|
10
|
+
<footer class="modal-card-foot">
|
|
11
|
+
<b-button @click="closeModal">
|
|
12
|
+
{{ $t("no") }}
|
|
13
|
+
</b-button>
|
|
14
|
+
<b-button type="is-primary" @click="confirmChanges">
|
|
15
|
+
{{ $t("yes") }}
|
|
16
|
+
</b-button>
|
|
17
|
+
</footer>
|
|
18
|
+
</b-modal>
|
|
19
|
+
</section>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import { mapState } from "vuex";
|
|
24
|
+
/**
|
|
25
|
+
* This component shows a modal to confirm the edit changes in the document
|
|
26
|
+
*/
|
|
27
|
+
export default {
|
|
28
|
+
name: "EditConfirmationModal",
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
isModalActive: false,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
computed: {
|
|
35
|
+
...mapState("edit", ["showEditConfirmationModal"]),
|
|
36
|
+
},
|
|
37
|
+
watch: {
|
|
38
|
+
showEditConfirmationModal(newValue) {
|
|
39
|
+
this.isModalActive = newValue;
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
methods: {
|
|
43
|
+
closeModal() {
|
|
44
|
+
this.isModalActive = false;
|
|
45
|
+
this.$store.dispatch("edit/setShowEditConfirmationModal", false);
|
|
46
|
+
},
|
|
47
|
+
confirmChanges() {
|
|
48
|
+
this.$emit("save-changes");
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<style scoped lang="scss" src="../../assets/scss/document_edit.scss"></style>
|
|
@@ -48,23 +48,29 @@
|
|
|
48
48
|
<div
|
|
49
49
|
:class="[
|
|
50
50
|
'splitting-lines',
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
splittingLines &&
|
|
52
|
+
splittingLines[index].page === page.number &&
|
|
53
53
|
'active-split',
|
|
54
54
|
]"
|
|
55
|
-
@click="handleSplittingLines(page)"
|
|
55
|
+
@click="handleSplittingLines(page.number, 'manual')"
|
|
56
56
|
>
|
|
57
57
|
<div class="scissors-icon">
|
|
58
58
|
<b-icon icon="scissors" class="is-small" />
|
|
59
59
|
</div>
|
|
60
60
|
<div
|
|
61
|
-
v-if="
|
|
62
|
-
activeSplittingLines &&
|
|
63
|
-
activeSplittingLines[index] === page.number
|
|
64
|
-
"
|
|
61
|
+
v-if="splittingLines && splittingLines[index].page === page.number"
|
|
65
62
|
class="lines"
|
|
66
63
|
>
|
|
67
|
-
<SplitZigZag
|
|
64
|
+
<SplitZigZag
|
|
65
|
+
:color="
|
|
66
|
+
splittingLines &&
|
|
67
|
+
splittingLines[index].origin &&
|
|
68
|
+
splittingLines[index].origin === 'AI' &&
|
|
69
|
+
splitSuggestionsEnabled
|
|
70
|
+
? 'green'
|
|
71
|
+
: 'dark'
|
|
72
|
+
"
|
|
73
|
+
/>
|
|
68
74
|
</div>
|
|
69
75
|
<div v-else class="lines">
|
|
70
76
|
<SplitLines />
|
|
@@ -98,8 +104,13 @@ export default {
|
|
|
98
104
|
draggable,
|
|
99
105
|
},
|
|
100
106
|
props: {
|
|
101
|
-
|
|
107
|
+
splittingLines: {
|
|
102
108
|
type: Array,
|
|
109
|
+
default: null,
|
|
110
|
+
},
|
|
111
|
+
splitSuggestionsEnabled: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false,
|
|
103
114
|
},
|
|
104
115
|
},
|
|
105
116
|
data() {
|
|
@@ -108,39 +119,41 @@ export default {
|
|
|
108
119
|
selected: null,
|
|
109
120
|
};
|
|
110
121
|
},
|
|
122
|
+
|
|
111
123
|
computed: {
|
|
112
124
|
...mapState("document", [
|
|
113
125
|
"pages",
|
|
114
126
|
"recalculatingAnnotations",
|
|
115
127
|
"selectedDocument",
|
|
128
|
+
"splittingSuggestions",
|
|
116
129
|
]),
|
|
117
130
|
...mapState("edit", [
|
|
118
131
|
"editMode",
|
|
119
|
-
"
|
|
132
|
+
"pagesForPostprocess",
|
|
120
133
|
"splitOverview",
|
|
121
134
|
"selectedPages",
|
|
122
135
|
"splitOverview",
|
|
123
136
|
]),
|
|
124
137
|
},
|
|
125
138
|
watch: {
|
|
126
|
-
|
|
139
|
+
pagesForPostprocess(newValue, oldValue) {
|
|
127
140
|
if (newValue !== oldValue) {
|
|
128
141
|
this.editPages = newValue;
|
|
129
142
|
}
|
|
130
143
|
},
|
|
131
144
|
editPages(newValue, oldValue) {
|
|
132
145
|
if (newValue !== oldValue) {
|
|
133
|
-
this.$store.dispatch("edit/
|
|
146
|
+
this.$store.dispatch("edit/setPagesForPostprocess", newValue);
|
|
134
147
|
}
|
|
135
148
|
},
|
|
136
149
|
splitOverview(newValue) {
|
|
137
150
|
if (newValue) {
|
|
138
|
-
this.editPages = this.
|
|
151
|
+
this.editPages = this.pagesForPostprocess;
|
|
139
152
|
}
|
|
140
153
|
},
|
|
141
154
|
},
|
|
142
155
|
mounted() {
|
|
143
|
-
this.editPages = this.
|
|
156
|
+
this.editPages = this.pagesForPostprocess;
|
|
144
157
|
},
|
|
145
158
|
methods: {
|
|
146
159
|
handlePageChange(pageNumber) {
|
|
@@ -183,11 +196,10 @@ export default {
|
|
|
183
196
|
},
|
|
184
197
|
getRotation(pageId) {
|
|
185
198
|
// rotate page
|
|
186
|
-
return this.
|
|
187
|
-
?.angle;
|
|
199
|
+
return this.pagesForPostprocess?.find((p) => p.id === pageId)?.angle;
|
|
188
200
|
},
|
|
189
|
-
handleSplittingLines(page) {
|
|
190
|
-
this.$emit("handle-splitting-lines", page);
|
|
201
|
+
handleSplittingLines(page, origin) {
|
|
202
|
+
this.$emit("handle-splitting-lines", page, origin);
|
|
191
203
|
},
|
|
192
204
|
checkMove(event) {
|
|
193
205
|
this.$emit("check-move", event);
|