Commit Graph

309 Commits (818e0046cb2a7deb0d0ab10d43aa3f42fb476608)

Author SHA1 Message Date
Tienson Qin c118271fdd refactor: property position support left/right/below
Removed the limitation that only properties with closed values can
have custom positions.
2024-05-23 20:48:04 +08:00
Tienson Qin 1cfc426486 enhance: properties ux
1. add icons to priorities
2. hide task properties so that blocks are not collapsable
3. block positions support end of block
2024-05-23 17:18:23 +08:00
Tienson Qin c862ad0d10 refactor: db/transact! as outliner op
The benefits:
1. all db transactions from the UI thread can be described in outliner
ops now.
2. batch undo/redo
2024-05-23 05:16:51 +08:00
Gabriel Horner 8de74ce654 fix: lint for large var 2024-05-22 17:03:00 -04:00
Gabriel Horner ceb3681cfe fix: nbb scripts updates :block/refs the same as app
nbb was only handling path-refs previously. Can remove hacky
managing of refs in create-graph. Still a TODO to fix schema graph
lazy loading bug. Related to LOG-2819
2024-05-22 16:51:50 -04:00
Gabriel Horner 67ff14038a enhance: add :config option to schema graph
also fix outliner lints
2024-05-22 13:37:40 -04:00
Tienson Qin d298567737 fix: wrong arguments for delete-blocks 2024-05-23 00:35:22 +08:00
Tienson Qin f218732b17 fix: property path-refs
1. :block/refs support to page properties
2. don't add built-in properties to refs
3. don't add current block or parents' other properties to :default blocks
2024-05-22 23:30:00 +08:00
Gabriel Horner 8b12e7f136 fix: property refs not calculating for file graphs
Fixes a bug where clicking a TODO in a file graph resulted in an error.
Bring back file graph implementation accidentally taken out in
d31b8cd5ae.
Also fixes related test
2024-05-22 10:42:44 -04:00
Gabriel Horner 04e71a9a23 Bump datascript for nbb-logseq 2024-05-22 09:37:16 -04:00
Tienson Qin f944dd2de9 fix: can't add existing :many property 2024-05-22 07:55:18 +08:00
Gabriel Horner cfe22e4acc fix: lints 2024-05-21 16:14:05 -04:00
Gabriel Horner fd5b90596b chore: remove nonexistent fix-tx 2024-05-21 11:00:11 -04:00
Tienson Qin 67bd6c6da3 fix: build refs for either pages or tagged blocks (objects) 2024-05-21 21:05:02 +08:00
Tienson Qin 8d959a7c8b chore: bump datascript 2024-05-21 20:51:22 +08:00
Tienson Qin db8d0c53df fix: datascript upsert db/ident 2024-05-21 19:29:21 +08:00
Tienson Qin d31b8cd5ae fix: add property named blocks values to :block/refs
related to LOG-2819
2024-05-21 16:35:39 +08:00
Tienson Qin ee35854498 fix: delete property value block when it's not used by other blocks 2024-05-21 07:49:33 +08:00
Gabriel Horner 33832f7941 fix: property names with invalid idents display an error notification
instead of silently failing in console. E.g. `123` as a property name
2024-05-20 17:21:56 -04:00
Tienson Qin e34af3412e enhance: delay creating new property until type specified 2024-05-20 13:07:21 +08:00
Tienson Qin 1c88d7cb00 fix: can't convert ref-type to non-ref (checkbox) 2024-05-18 06:39:47 +08:00
Gabriel Horner efab7f403e chore: Remove unnecessary catch and rethrow for notification
Just encode notification in original exception to make conversion
as reusable as possible. Also make properties readable with :original-name
as they are case sensitive
2024-05-17 17:25:53 -04:00
Gabriel Horner a17ed389e8 fix: can't delete a closed value being used
fixes LOG-3102
2024-05-17 15:37:52 -04:00
Gabriel Horner 4907f0eb74 fix: task related commands e.g. /Doing
Was broken by adding property ref value support to batch-set-property
2024-05-17 12:40:09 -04:00
Gabriel Horner 05b96d53fa fix: display notification when trying to delete built-in choice 2024-05-17 11:07:53 -04:00
Tienson Qin a50177096e chore: remove debug 2024-05-17 21:00:57 +08:00
charlie 3e37fb6b4a fix: typo 2024-05-17 11:25:10 +08:00
Gabriel Horner 3fdaf0474f fix: can't add a class schema or page property
Removed related unused upsert property code. This became unused with #11311.
Also fixed new page property not moving focus to property value
2024-05-16 17:47:49 -04:00
Gabriel Horner 8921767b69 fix: batch-set-property working with property value refs
Fixed batch-setting background-color. With this fix was then able
to migrate order-list-type to use :default. Also cleaned up
outdated assumptions in batch fn
2024-05-15 17:37:57 -04:00
Gabriel Horner e50d3eff21 fix: setting block properties with raw value
With this fix able to convert 2 built-ins to :default. Also cleaned
up set-block-property! which had outdated assumptions
2024-05-15 16:10:02 -04:00
Tienson Qin 244de2187e fix: quit batch tx mode even with errors
Also, throw errors and send notifications for apply-outliner-ops
2024-05-15 22:19:06 +08:00
Tienson Qin a689266931 fix: don't persist :block.temp/fully-loaded? 2024-05-15 20:41:17 +08:00
Gabriel Horner c554627041 fix: outliner lints
While fixing large vars, fixed needless circular dependency between
create-property-text-block and set-block-property
2024-05-14 15:11:29 -04:00
Gabriel Horner 4a7dab2763 fix: can't add or update closed values 2024-05-14 09:29:00 -04:00
Gabriel Horner 45bb11d28d fix: db tests and :op typo 2024-05-13 17:05:32 -04:00
Tienson Qin ce4cad2cc7
Refactor/move property handler to outliner dep (#11311)
The end goal is to get rid of `db/transact!` and send outliner ops to
the db worker.

Currently, some property ops are async, set-block-property! will also
need to be async because when setting a non-ref value (e.g. a number
str "2"), we need to query whether a block with the value exists, this
unfortunately, will be an async query, so we're risking turning more
functions to async in the future which makes it hard to reason about
the implementation.
2024-05-13 18:16:21 +08:00
Tienson Qin bccf999853 fix: tests 2024-05-09 08:51:49 +08:00
Tienson Qin bb5a3364e6 fix: outdent property child block replaces its parent
Fixes LOG-3141
2024-05-09 04:36:14 +08:00
Tienson Qin d6ffd16799 fix: can't move blocks up
Fixes LOG-3140
2024-05-09 04:36:14 +08:00
Tienson Qin 89afdcdd7b fix: outliner core tests 2024-05-08 01:29:23 +08:00
Gabriel Horner ead9f30f1b fix: typing hashtag sets heading
also remove unused var
2024-05-07 10:53:32 -04:00
Gabriel Horner 8a8dba6af8 fix: db graphs shouldn't have :block/marker at all
part of LOG-3042
2024-05-06 11:40:54 -04:00
Gabriel Horner 110813accd fix: deps and frontend lints 2024-05-06 10:45:40 -04:00
Gabriel Horner fe27ce9807 fix: remove handling file-graph specific marker 2024-05-06 09:39:02 -04:00
Tienson Qin 7aa3bd7d84 fix: issues of :default :one property 2024-05-03 09:59:20 +08:00
Tienson Qin 457a74343f refactor: no need to create parent && hidden page for :default value 2024-05-03 00:02:55 +08:00
Gabriel Horner 88e38b16f4 fix: more lints including removing dead code 2024-05-02 10:35:44 -04:00
Tienson Qin 89edb3af9a fix: can't remove Many values 2024-05-02 18:03:17 +08:00
Tienson Qin 1ec4796eff refactor: replace :block/left with :block/order
Finally no need to worry about parent-left conflicts and broken chain.
With :block/order, we only need to re-compute new orders for siblings
with same order (it can happens if there're bugs in our code, or
updates from rtc), but it doesn't break UI.

Another huge potential benefit after discussing with Zhiyuan is:
Ee might be able to simplify both RTC and undo/redo, currently, we
need to handle each new op for both of them, with recently
refactorings like properties being db attributes, :block/order
is a string instead of a ref, we can handle most property value
conflicts using last-write-wins, and others (e.g. :block/parent,
property with :default type) specifically.

I haven't fixed the issues of using :block/left in RTC and undo/redo,
because we might change both soon.
2024-05-02 01:12:22 +08:00
Gabriel Horner a35bc9b0d6 Bump nbb-logseq version for datascript and ordered-map changes 2024-04-30 10:10:11 -04:00
Tienson Qin 95eb0e7f4a Merge branch 'feat/db' into refactor/db-properties-schema 2024-04-29 15:55:23 +08:00
Tienson Qin 5d4ae66d86 revert: remove :block/properties 2024-04-28 19:44:53 +08:00
Gabriel Horner edca3049c0 chore: remove unused fn 2024-04-25 11:24:08 -04:00
Gabriel Horner 3681ac354b fix: move db-pipeline and datascript-report back to outliner dep
graph-parser is primarily a file graph dep that is maintained separately
from db graphs. We want to move as many namespaces out of it as
possible. Also moved differing count assertions to
their respective tests
2024-04-25 11:22:14 -04:00
Tienson Qin b84ea96160 fix: handle more non-consecutive cases 2024-04-25 20:39:15 +08:00
Tienson Qin 331aa50379 fix: delete blocks might be consecutive but reversed 2024-04-25 20:28:06 +08:00
Tienson Qin b55c064305 fix: move :block/path-res calculation to dep graph-parser 2024-04-25 16:50:04 +08:00
Tienson Qin fef4e896e1 fix: use existing property pair if exists 2024-04-24 19:13:48 +08:00
Tienson Qin 912ddd6ca2 Merge branch 'feat/db' into refactor/db-properties-schema 2024-04-22 23:57:57 +08:00
Gabriel Horner 543677ef32 fix: outliner lint 2024-04-22 11:14:14 -04:00
Gabriel Horner 0bee9b12c0 fix: frontend lints and remove dead code 2024-04-22 11:10:16 -04:00
Gabriel Horner 1b66755876 fix: outliner lint 2024-04-22 10:50:37 -04:00
Tienson Qin 44af2213ce Merge branch 'feat/db' into refactor/db-properties-schema 2024-04-21 13:22:37 +08:00
Tienson Qin b1bc1ca88a chore: remove debug 2024-04-19 20:17:53 +08:00
Tienson Qin 20006eafa8 fix: update :block/page when moving between pages 2024-04-19 20:16:39 +08:00
Tienson Qin 113ff4e669 fix: can't move blocks to empty page 2024-04-19 19:54:11 +08:00
Tienson Qin 0085accf70 refactor: batch tx
outliner-tx/transact! now operates outliner op one by one instead of
batching processing, the benefit is that we can safely rely on the ops
order, it simplifies code a lot too.
2024-04-19 16:11:42 +08:00
Tienson Qin 08c5cc18d0 refactor: simplify outliner move blocks
The new implementation doesn't rely on insert-blocks, instead, it
will move the blocks one by one, but using batch tx.
2024-04-19 16:11:42 +08:00
Gabriel Horner 0372cb6e62 fix: typing marker creates tasks e.g. DOING 2024-04-18 14:13:58 -04:00
Gabriel Horner 9bab096def fix: built-in string properties with internal :string type
Also fix a bug that caused numbered list to fail after first item
2024-04-18 09:06:10 -04:00
Tienson Qin f0920ac89b fix: another case of non-consecutive blocks move 2024-04-18 20:42:26 +08:00
Tienson Qin 40775e1f80 fix: move a child block to its parent's right sibling 2024-04-18 19:04:44 +08:00
Tienson Qin 2296eca383 chore: don't run fix non-consecutive when it's not needed 2024-04-18 18:43:16 +08:00
Tienson Qin 24e1aab914 fix: skip computing :block/left for non-consecutive blocks 2024-04-18 15:24:47 +08:00
Tienson Qin ca197c439a prn db transit if left/parent point to self detected 2024-04-18 14:24:53 +08:00
Tienson Qin 76248b4664 Add trace for debugging 2024-04-18 13:56:33 +08:00
Tienson Qin 9418607c50 Ensure :block/left and :block/parent not point to self 2024-04-18 13:52:05 +08:00
Tienson Qin 2a7e6accb0 refactor: force outliner.tree/-del to delete all children
Except the children have been moved.
2024-04-17 17:48:59 +08:00
Tienson Qin 1240052117 fix: undo redo
outliner.core/delete-blocks will filter top-level blocks first to
avoid deleting parent first and then children.
2024-04-17 14:54:31 +08:00
Gabriel Horner 0aa4bda66c fix: inlined db-based-graph? calls in db-property
Addressed fixmes for db-based-graph fns that were inlined to prevent
circular dependencies b/n db-property and sqlite-util.  Moved multi
graph fns to db-property-util and existing db-property-util to
db-property-build to address this
2024-04-16 14:43:28 -04:00
rcmerci 842efe5958 test(undo): add random outliner-ops testcase 2024-04-16 18:58:40 +08:00
rcmerci cf4e43e126 fix: remove wrong cond when delete-blocks 2024-04-16 18:58:40 +08:00
Gabriel Horner 8ac39b3cbb fix: adding new properties for some property actions
Also removed duplicate helper fn
2024-04-12 21:53:04 -04:00
Tienson Qin 1a9608bda1 fix: property handler with the new properties pair storage 2024-04-12 01:17:37 +08:00
Tienson Qin 210be5aaca fix: creating redundant pages when editing a block 2024-04-08 01:25:48 +08:00
Tienson Qin b9195e40e5 Merge branch 'refactor/db-properties-schema' into refactor/db-remove-block-name-unique 2024-04-06 07:59:06 +08:00
Gabriel Horner 514b5b5d56 fix: numbered list in db graphs 2024-04-05 15:00:17 -04:00
Tienson Qin 0bc8d1c3b1 Merge branch 'refactor/db-properties-schema' into refactor/db-remove-block-name-unique 2024-04-05 15:16:13 +08:00
Tienson Qin ac31842cec Revert "Remove :block/macros"
This reverts commit 21d550de12.
2024-04-05 15:12:56 +08:00
Tienson Qin bf539751a8 disable rtc merge tests for now 2024-04-04 15:57:49 +08:00
Tienson Qin c018f1517d perfer to use get-page instead of get-first-page-by-name 2024-04-04 15:57:48 +08:00
Tienson Qin 60d4fca0ba wip: remove :block/name uniqueness for db based graphs
This PR also remove supports for:
1. merge pages when renaming a page to existing page
2. namespaces such as a/b/c
3. nested page such as [[a [[nested page]]]]

Pages merge might be added back depends on RTC, but it should be
decoupled from renaming, otherwise it's too complex.

Namespaces and nested pages have been contributed some critical bugs
that lead data-loss, they're so complex together with page alias,
it's just impossible to have a good test coverage and ensure the app
is stable, especially when page rename and RTC.
2024-04-04 15:57:48 +08:00
Tienson Qin 7084b53dad Merge branch 'feat/db' into refactor/db-properties-schema 2024-04-03 20:29:11 +08:00
rcmerci a7c8451ce4 refactor(undo): update ns frontend.worker.undo-redo (wip) 2024-04-03 17:59:13 +08:00
Gabriel Horner 12c667fabb Update nbb-logseq to latest datascript 2024-04-02 09:36:28 -04:00
Tienson Qin 1987c455e7 Merge branch 'feat/db' into refactor/db-properties-schema 2024-04-01 15:47:43 +08:00
Tienson Qin d48e45eaa7 enhance: property db ident doesn't allow # 2024-04-01 14:53:25 +08:00
Tienson Qin 21d550de12 Remove :block/macros 2024-04-01 14:22:15 +08:00
Gabriel Horner f728b7b9f6 fix: multiple bugs with built-in pages, fixes LOG-3046
- file graph wasn't creating built in pages
- 3 places where db graphs were incorrectly using file graph built in
  page names
- file graphs creating default pages with incorrect format
2024-03-29 16:21:19 -04:00
Tienson Qin 30053d372b fix: can't edit block type property value after it's deleted 2024-03-30 04:20:42 +08:00
Tienson Qin 9d5008d0a4 bump datascript 2024-03-29 17:48:08 +08:00
Tienson Qin fe922ba035 fix: rename logseq.property/status to logseq.task/status 2024-03-29 16:22:45 +08:00
Tienson Qin 958507262e Merge branch 'feat/db' into refactor/db-properties-schema 2024-03-29 15:51:28 +08:00
Tienson Qin 872bc00216 fix: db ident 2024-03-29 13:04:50 +08:00
Gabriel Horner 9c5309da47 enhance: frontend consistently uses :db/ident
for fetching built-in properties instead of :block/name
2024-03-27 20:36:48 -04:00
Gabriel Horner 9b8540921e enhance: more property helper fns uses db-ident
instead of name
2024-03-25 16:34:51 -04:00
Tienson Qin 33f418b297 wip: properties refactor 2024-03-25 18:56:36 +08:00
Tienson Qin 98d2b92ab1 fix: schema && built-in properties 2024-03-25 10:59:09 +08:00
Tienson Qin 16a927ad00 Bump datascript
Which enables transacting schema like other tx-data.
2024-03-25 09:45:19 +08:00
Tienson Qin 1cad8aa9bd enhance: batch refresh UI after applying remote blocks change
Fixes LOG-3114
2024-03-21 17:38:36 +08:00
Tienson Qin c079f00daf fix: page/block refs lost after syncing from the server 2024-03-21 15:43:17 +08:00
Gabriel Horner 4ba9fea065 enhance: all default db idents are namespaced under logseq
Having consistent namespacing of core idents increases the
number of features they can be used for later
2024-03-18 22:57:24 -04:00
Tienson Qin cd1c71291b fix: conflict datoms from sqlite db and tail
Fixes LOG-3087.
Addressed by fc3645fa4a.
2024-03-17 12:05:44 +08:00
Gabriel Horner 67a7a0a3e9 enhance: Add default namespace of :logseq.property
for db/ident of built-in-properties. Namespacing block identities will
be important for future features. Adding namespacing also fixed some
hidden coupling between identity and name. Also converted a couple more
related :block/name queries to use :db/ident to slowly get us closer to
named blocks
2024-03-15 18:37:15 -04:00
Gabriel Horner 9cdf78ca6a enhance: use db/ident for classes
allows built-in class names to change
2024-03-15 09:22:35 -04:00
Gabriel Horner 96b35c0252 Update nbb-logseq to stub in cljs-bean.transit 2024-03-11 15:19:50 -04:00
Tienson Qin 22a9b61b32 fix: remove :block/metadata
Use built-in properties
2024-03-08 01:01:55 +08:00
Gabriel Horner c6e358c983 fix: outliner test failing b/c not nbb compatible
bumped to latest nbb-logseq which is
2024-03-06 11:06:18 -05:00
Tienson Qin 4c03e58b6c fix: disallow built-in page or property names from being edited
fixes LOG-3049
2024-03-06 21:29:22 +08:00
Tienson Qin eb1270fff9 perf: use datascript.transit instead of edn for ui<>worker messages 2024-03-06 16:48:50 +08:00
Tienson Qin 0bb2778f2b fix: unused macros shouldn't be handled in outliner/save
Fixes LOG-3065.

Deleting blocks could result in unused macros too, we probably should
do this by running periodically job to find and retract all unused
refs (macros, pages, hidden blocks, etc).
2024-03-05 20:18:15 +08:00
rcmerci 92625679b3 fix: fix :block/tags, reuse ref->eid 2024-03-05 19:48:00 +08:00
Tienson Qin 82d5fc6c00 fix: block marker lost in file graph
fixes LOG-2964
2024-02-29 18:35:45 +08:00
Tienson Qin 7be3421e99 fix: can't add tag 2024-02-29 01:30:15 +08:00
rcmerci 6fa4048299 fix: avoid [:block/uuid nil] err when transact 2024-02-28 21:26:01 +08:00
Tienson Qin b7f8a5eef8 fix: enter to create a tagged block 2024-02-24 23:29:12 +08:00
Tienson Qin 5dbaca8638 fix: wrong ns 2024-02-24 22:49:03 +08:00
Tienson Qin 8e5851f251 fix: adding a block property deletes tag ref
fixes LOG-3064
2024-02-24 22:03:49 +08:00
Tienson Qin b1aae957e0 fix: esc doesn't save tags 2024-02-24 16:21:03 +08:00
Tienson Qin 6580edf841 fix: undo/redo 2024-02-23 23:50:44 +08:00
Tienson Qin 6329f6e4e7 perf: async writes 2024-02-23 23:32:24 +08:00
Tienson Qin 86b70c1f6d fix: compute block/refs and block/path-refs after pulling remote 2024-02-23 21:35:11 +08:00
Gabriel Horner a0329fdfff fix: page properties are deleted when block content changes
Fixes LOG-3044. Also added more ref and property info to block data cmd
2024-02-14 12:09:37 -05:00
Gabriel Horner e8010de9c3 fix: outliner vars that should be private 2024-02-09 09:07:29 -05:00
Gabriel Horner 58b2888729 fix: test and lints
also remove unused binding not caught by linter b/c it's used
2024-02-07 12:23:14 -05:00
Tienson Qin 0a028ba235 fix: editor unit tests 2024-02-07 06:38:52 +08:00
Tienson Qin 7e8ab72494 Merge branch 'feat/db' into perf/lazy-load-data 2024-02-07 04:07:40 +08:00
Tienson Qin 140287e3ea perf: don't load properties and classes for initial data
This commit also fixed the issue that some pages such as "Status" will
be shown as lower cased.
2024-02-07 03:45:35 +08:00
Gabriel Horner 6a73ffa5f7 fix: lints and a docstring 2024-02-05 17:03:44 -05:00
Gabriel Horner 232dbf682b fix outliner lint 2024-02-05 14:04:54 -05:00
Tienson Qin d4add86e1d Merge branch 'feat/db' into perf/lazy-load-data 2024-02-05 09:52:35 +08:00
Tienson Qin 4e0a35fe87 fix: don't remove :block/tags from outliner-core/-save 2024-02-03 18:22:56 +08:00
Tienson Qin d00b2c1e47 avoid async queries if blocks are not rendered yet 2024-02-03 10:34:21 +08:00
Tienson Qin 2e1e3572df fix: add db requests for outliner core tx 2024-02-02 03:46:12 +08:00
Tienson Qin 7a4251856a Revert "fix: enable promise usage in outliner-ui/transact!"
This reverts commit 95cd7d51fc.
2024-02-02 00:20:41 +08:00
Tienson Qin 4b9b825101 refactor indent-and-outdent 2024-02-02 00:16:49 +08:00
Tienson Qin 95cd7d51fc fix: enable promise usage in outliner-ui/transact! 2024-02-01 20:07:39 +08:00
Tienson Qin 44dca4f506 wip: plugin api calls
Also avoid calls to worker if a block has been fully loaded
2024-01-31 21:51:52 +08:00
Tienson Qin 99b6d543f0 fix: more async queries and export to roam 2024-01-30 20:03:06 +08:00
Tienson Qin d9ff061436 fix: don't remove orphaned refs if content hasn't been changed 2024-01-26 22:14:55 +08:00