Comments (5)
We tested this API with some cases and it seems working. Do you minding providing a code snippet so that we could take a look into? :)
from webviewer-ui.
It seems to only work when the user switches to another leftpanel tab and then back to the notes.
What we try to accomplish is a toggle inside of the notes panels where the user can toggle between two different sortings.
This is the sort strategy:
var noFilter = function (notes) {
return notes;
}
var filterRevised = function (notes) {
return notes.filter(function (note) {
return !note.oxomiRevised && note.getContents();
});
}
var oxomiSortStrategy = {
getSortedNotes: function (notes) {
return oxomiSortStrategy.filter(notes).sort(function (a, b) {
// Sort by reading order (top to bottom left to right)
var verticalDiff = a.getY() - b.getY();
if (verticalDiff !== 0) {
return verticalDiff;
}
return a.getX() - b.getX();
});
},
shouldRenderSeperator: function (previous, current) {
return current.PageNumber !== previous.PageNumber;
},
getSeperatorContent: function (previous, current) {
return current.PageNumber;
},
filter: noFilter
};
And this is where we switch between the filters and reapply the sort strategy:
Config.showAllAnnotations = function () {
oxomiSortStrategy.filter = noFilter;
readerControl.setNotesPanelSort(oxomiSortStrategy);
}
Config.showOpenAnnotations = function () {
oxomiSortStrategy.filter = filterRevised;
readerControl.setNotesPanelSort(oxomiSortStrategy);
}
This is the current workaround:
Config.showAllAnnotations = function () {
oxomiSortStrategy.filter = noFilter;
readerControl.setSortNotesBy('position');
readerControl.setNotesPanelSort(oxomiSortStrategy);
}
from webviewer-ui.
After inspecting the code I fixed it by changing it to two separate sort strategies with names, registering them and switching by calling setSortNotesBy
and their name.
The issue I see here is that documentation for setNotesPanelSort
and the sort object (with methods getSortedNotes
, shouldRenderSeperator
, getSeperatorContent
and the name
field) is missing completely here: https://www.pdftron.com/documentation/web/guides/ui/apis
from webviewer-ui.
Good to hear you fixed it! We didn't mean to make this API public yet, that's why the documentation is missing in the APIs section. We were planning to squash new APIs and make them public with proper documentation in the next minor release. Sorry for the confusion, we made a mistake as we shouldn't merge this new API into master until the next release. We will be careful next time! Please note that we may also change the name of this API. We will let you know when we changed it
from webviewer-ui.
Thanks for the info and the heads up 👍
from webviewer-ui.
Related Issues (20)
- [Bug] Preview file: Cannot read properties of undefined (reading 'Annotations') version 10.4.0 HOT 1
- [Bug] Error when changing the document after update to 10.5.0 HOT 2
- [Feature Request] Custom Right Click Menu for Bookmarks HOT 1
- [Bug] Toolbar does not show up if 'header' is disabled HOT 3
- [Feature Request] Customize how a Datetime will appear in a note/comment HOT 1
- Fit Mode doesnt work for the second document HOT 1
- [Bug] Shift+Click thumbnails degraded behavior in 10.6 HOT 2
- Post-install run build/start is failing HOT 1
- Getting error after integrating pdfnet-node library in angular. HOT 1
- [Bug] Webviewer showing markReplaceTextToolButton in Read only mode HOT 1
- [Bug] TypeScript Error: Property 'customHandlerId' Not Recognized in '@pdftron/webviewer' Method 'instance.UI.loadDocument HOT 1
- PDF with 3d Data shows black page HOT 1
- [Bug] Keyboard shortcuts are not working after updated to 10.8 HOT 1
- [SECURITY] CVE-2023-26149 quill-mention HOT 6
- Running latest version project changes throws multiple scss errors HOT 2
- [Feature Request] expose options for instance.UI.print HOT 2
- [Bug] CustomStamps exports an invalid textColor in case of the default white text color HOT 1
- [Bug] instance.UI.setActiveLeftPanel not working in modular UI HOT 1
- [Bug] Unable to open context menu HOT 1
- [Bug] Unable to enter a multi-digit page number in modular UI page controls input HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webviewer-ui.