Skip to content

fix(outliner): moving a property value up past the first value keeps it a value - #13677

Closed
yuxi-liu-wired wants to merge 3 commits into
logseq:masterfrom
yuxi-liu-wired:fix/move-property-value-up
Closed

yuxi-liu-wired wants to merge 3 commits into
logseq:masterfrom
yuxi-liu-wired:fix/move-property-value-up

Conversation

@yuxi-liu-wired

Copy link
Copy Markdown
Contributor

On a block with a many-valued property holding v1 and v2, Alt+Shift+Up on v2 does not swap the two values: v2 becomes an ordinary child block of the block, and the property keeps v1 only.

The up move (move-blocks-up-down) targets the block two above the first selected block, and when there is none it moves the selection into its parent as the first child. For a property value with only the first value above it, that is the parent block, and a block moved into its parent that way is not restored as a value of the property (move-block restores the property only when the target is itself a value, or when :created-from-property is passed). With three values, moving v3 up past v2 works (the target is v1, a value); moving it up again past v1 drops it the same way.

The fix: in that case the first value moves down after the moved values instead, a move between two values of the property, which keeps every value.

Tests in src/test/logseq/outliner/property_value_move_test.cljs (the app's test build: a property value finds its siblings through the entity's :block/_raw-parent, which the outliner library's nbb run does not compute): the second value moved up swaps with the first, both stay values and the block's ordinary children are untouched (fails on master: v2 drops out); v3 moved up twice ends first (fails on master at the second move); the first value moved down swaps as well. The outliner core, undo/redo, editor and property-value test namespaces pass with the change, as does the outliner library's suite.

yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 11, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 13, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 16, 2026
…it a value

With a many-valued property (values v1, v2 on a block), Alt+Shift+Up on v2 turned v2 into an ordinary child of the block and dropped it from the property: the up move targets the block two above, and with none it moves the block into its parent as the first child, and a block moved into its parent that way is not restored as a value of the property. The first value now moves down after the moved values instead, a move between two values of the property, which keeps both. With three values, v3 moved up past v2 already worked; moving it up again past v1 dropped it the same way.

Tests: src/test/logseq/outliner/property_value_move_test.cljs (in the app's test build: a value's siblings come from the entity's :block/_raw-parent, which only the compiled app computes): the second value moved up swaps with the first and both stay values, the block's ordinary children untouched; v3 moved up twice; the first value moved down.
Keeps move-blocks-up-down under the outliner's 55-line large-vars limit.
The first value moved up and the last value moved down stay in place and stay values; the block's ordinary children are untouched.
@yuxi-liu-wired

Copy link
Copy Markdown
Contributor Author

Combined with the other PRs that change the same files into #13783.

@yuxi-liu-wired
yuxi-liu-wired deleted the fix/move-property-value-up branch October 21, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant