fix(workspace): Enter keeps an empty bullet on its level when siblings follow
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m17s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m17s
Outdenting an empty bullet on Enter only happens when no bullet on the same level follows in the branch; otherwise a new bullet is added below. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b136e5dfad
commit
05355989a8
4 files changed
+50
-3
No files matched your search
@@ -106,6 +106,8 @@ export interface OutlinerBlockProps {
|
||||
onPasteMultiLines?: (blockId: string, textBefore: string, textAfter: string, rawLines: string[]) => void;
|
||||
/** Number or letter of a numbered-list item ("1.", "b.", "iii.") */
|
||||
listMarker?: string;
|
||||
/** Another bullet on the same level follows: Enter in this empty bullet adds a bullet instead of outdenting */
|
||||
siblingFollows?: boolean;
|
||||
lockedBy?: string; // someone else is editing this block
|
||||
canAppendBelow?: boolean; // the user may edit the note, so Enter in a locked block still adds one below
|
||||
onResolveConflict?: (blockId: string, accept: boolean) => void;
|
||||
@@ -155,6 +157,7 @@ export const OutlinerBlock: React.FC<OutlinerBlockProps> = ({
|
||||
registerTextareaRef,
|
||||
onPasteMultiLines,
|
||||
listMarker,
|
||||
siblingFollows = false,
|
||||
lockedBy,
|
||||
canAppendBelow,
|
||||
onResolveConflict,
|
||||
@@ -961,13 +964,13 @@ export const OutlinerBlock: React.FC<OutlinerBlockProps> = ({
|
||||
|
||||
const minLevel = levelOffset || 0;
|
||||
if (localContent === '') {
|
||||
if (Math.max(0, block.level || 0) > minLevel) {
|
||||
if (Math.max(0, block.level || 0) > minLevel && !siblingFollows) {
|
||||
flushDebounce(localContent);
|
||||
onIndentBlockRef.current(block.id, -1);
|
||||
return;
|
||||
}
|
||||
// Enter in an empty numbered item at the top ends the list
|
||||
if (block.type === 'numbered') {
|
||||
// Enter in an empty last numbered item at the top ends the list
|
||||
if (block.type === 'numbered' && !siblingFollows) {
|
||||
flushDebounce('', { type: 'text' });
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user