* fix(pdf): WIP potential memory leaks
* enhance(pdf): sync page number in highlights metafile
* enhance(pdf): support preview highlight area image in a lightbox
* fix: clojurescript unit tests
* fix(pdf): page number overflow when more digits
Commit fixes a bug where block references (i.e. `:block/refs`
association in the db) are lost when the page containing the referenced
block is re-loaded due to an update of its underlying file.
Description of Bug:
The bug occurs because when a file is re-loaded to the DB from disk, all existing blocks
belonging to the file are deleted via `retractEntity`, and then blocks
from the parsed file are added. If the file had only had small changes,
the new block set will be very similar to the previous one, although
with different db/ids.
However, while new blocks with "id:: " properties will assume the UUID value
of the previous version of the block, any references to that block via
UUID will *not* be restored in the DB; they are deleted with the
retractEntity command. This results in an inconsistent DB state, where references that should
exist do not.
Description of Fix:
The 'delete-blocks-fn' passed to the graph_parser has been modified as
such:
- It now accepts a list of block uuids to *retain*; graph parser will
pass the blocks parsed from the new file content.
- For any blocks which match a UUID in the retain list, instead of
deleting via retractEntity, the individual attributes are deleted via
retractAttribute (the `retract-attributes` from schema.cljs is used
for this purpose).
- revert evel-string arguments into single arguments, current block are not passed into `eval-string`
- use metadata to detect if returned eval-result are hiccup.
add logseq-api and logseq-graph-parser into sci classes to make it avaliable in sci eval-string
add bindings custom-js to window object that can be defined in custom.js file as `customJs` object (for custom javascript function to be called from sci)