Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Papermerge.Js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
Papermerge.Js
Commits
74b06862
Commit
74b06862
authored
Apr 11, 2022
by
Eugen Ciur
Browse files
Options
Downloads
Patches
Plain Diff
works very well for three pages document/simple scenarios
parent
0fba39f6
Loading
Loading
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/components/viewer/index.js
+27
-13
27 additions, 13 deletions
app/components/viewer/index.js
app/components/viewer/thumbnails/index.js
+1
-5
1 addition, 5 deletions
app/components/viewer/thumbnails/index.js
with
28 additions
and
18 deletions
app/components/viewer/index.js
+
27
−
13
View file @
74b06862
...
@@ -152,19 +152,33 @@ export default class ViewerComponent extends Component {
...
@@ -152,19 +152,33 @@ export default class ViewerComponent extends Component {
}
}
@
action
@
action
onThumbnailsPositionChanged
({
original_pos
,
page_ids
})
{
onThumbnailsPositionChanged
(
page_ids
)
{
let
all_pages
,
drop_placeholder_pos
;
/*
``page_ids`` will be moved to the new position
drop_placeholder_pos
=
this
.
pages
.
findIndex
(
item
=>
item
.
is_drop_placeholder
);
indicated by drop placeholder.
Page is drop placeholder if ``page.is_drop_placeholder`` is true.
console
.
log
(
`onThumbnailsPositionChanged drop_placeholder_pos=
${
drop_placeholder_pos
}
original_pos=
${
original_pos
}
page_ids=
${
page_ids
}
`
);
*/
//all_pages = this.pages;
let
pages_without_placeholder
,
//
drop_placeholder_pos
;
//this.pages = reposition_items({
// items: all_pages,
// learn where user wants to move pages by
// selected_ids: page_ids,
// findind drop placeholder position
// drop_pos: drop_placeholder_pos
drop_placeholder_pos
=
this
.
pages
.
findIndex
(
//});
item
=>
item
.
is_drop_placeholder
);
// remove placeholder from pages array
this
.
pages
.
splice
(
drop_placeholder_pos
,
1
);
pages_without_placeholder
=
this
.
pages
;
console
.
log
(
`repositioning items page_ids=
${
page_ids
}
`
);
console
.
log
(
`repositioning items drop_pos=
${
drop_placeholder_pos
}
`
);
// reposition pages
this
.
pages
=
reposition_items
({
items
:
pages_without_placeholder
,
selected_ids
:
page_ids
,
drop_pos
:
drop_placeholder_pos
});
}
}
@
action
@
action
...
...
This diff is collapsed.
Click to expand it.
app/components/viewer/thumbnails/index.js
+
1
−
5
View file @
74b06862
...
@@ -21,7 +21,6 @@ export default class ViewerThumbnailsComponent extends Component {
...
@@ -21,7 +21,6 @@ export default class ViewerThumbnailsComponent extends Component {
let
data
,
let
data
,
json_data
,
json_data
,
page_ids
,
page_ids
,
original_pos
,
drop_pos
,
drop_pos
,
source_doc_id
;
source_doc_id
;
...
@@ -33,15 +32,12 @@ export default class ViewerThumbnailsComponent extends Component {
...
@@ -33,15 +32,12 @@ export default class ViewerThumbnailsComponent extends Component {
}
}
json_data
=
JSON
.
parse
(
data
);
json_data
=
JSON
.
parse
(
data
);
original_pos
=
json_data
[
'
original_pos
'
]
page_ids
=
json_data
[
'
pages
'
].
map
(
page
=>
page
.
id
);
page_ids
=
json_data
[
'
pages
'
].
map
(
page
=>
page
.
id
);
source_doc_id
=
json_data
[
'
source_doc_id
'
];
source_doc_id
=
json_data
[
'
source_doc_id
'
];
if
(
source_doc_id
==
this
.
args
.
doc
.
id
)
{
if
(
source_doc_id
==
this
.
args
.
doc
.
id
)
{
// pages moved within same document
// pages moved within same document
this
.
args
.
onThumbnailsPositionChanged
({
this
.
args
.
onThumbnailsPositionChanged
(
page_ids
);
original_pos
,
page_ids
});
}
else
{
}
else
{
// pages moved to another document
// pages moved to another document
this
.
args
.
onIncomingPages
({
this
.
args
.
onIncomingPages
({
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment