tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
27
pulls
pipelines
add min-height on last block for readonly view padding
schlage.town
2 years ago
a35294d0
2dd2887d
+11
-11
1 changed file
expand all
collapse all
unified
split
components
Blocks
index.tsx
+11
-11
components/Blocks/index.tsx
···
23
23
let foldedBlocks = useUIState((s) => s.foldedBlocks);
24
24
25
25
let lastRootBlock = blocks.findLast(
26
26
-
(f) => !f.listData || f.listData.depth === 1,
26
26
+
(f) => !f.listData || f.listData.depth === 1
27
27
);
28
28
29
29
let lastVisibleBlock = blocks.findLast(
30
30
(f) =>
31
31
!f.listData ||
32
32
!f.listData.path.find(
33
33
-
(path) => foldedBlocks.includes(path.entity) && f.value !== path.entity,
34
34
-
),
33
33
+
(path) => foldedBlocks.includes(path.entity) && f.value !== path.entity
34
34
+
)
35
35
);
36
36
37
37
return (
···
53
53
type: "text",
54
54
position: generateKeyBetween(
55
55
lastRootBlock?.position || null,
56
56
-
null,
56
56
+
null
57
57
),
58
58
newEntityID,
59
59
});
···
75
75
!f.listData ||
76
76
!f.listData.path.find(
77
77
(path) =>
78
78
-
foldedBlocks.includes(path.entity) && f.value !== path.entity,
79
79
-
),
78
78
+
foldedBlocks.includes(path.entity) && f.value !== path.entity
79
79
+
)
80
80
)
81
81
.map((f, index, arr) => {
82
82
let nextBlock = arr[index + 1];
···
121
121
let editorState = useEditorStates((s) =>
122
122
props.lastBlock?.type === "text"
123
123
? s.editorStates[props.lastBlock.value]
124
124
-
: null,
124
124
+
: null
125
125
);
126
126
127
127
if (!entity_set.permissions.write) return null;
···
143
143
permission_set: entity_set.set,
144
144
position: generateKeyBetween(
145
145
props.lastBlock?.position || null,
146
146
-
null,
146
146
+
null
147
147
),
148
148
newEntityID,
149
149
});
···
181
181
let { rep } = useReplicache();
182
182
let entity_set = useEntitySetContext();
183
183
184
184
-
if (!entity_set.permissions.write) return <div className="h-4" />;
184
184
+
if (!entity_set.permissions.write) return <div className="h-4 min-h-4" />;
185
185
return (
186
186
<div
187
187
className="blockListClickableBottomArea shrink-0 h-[50vh]"
···
194
194
) {
195
195
focusBlock(
196
196
{ ...props.lastVisibleBlock, type: "text" },
197
197
-
{ type: "end" },
197
197
+
{ type: "end" }
198
198
);
199
199
} else {
200
200
// else add a new text block at the end and focus it
···
205
205
type: "text",
206
206
position: generateKeyBetween(
207
207
props.lastRootBlock?.position || null,
208
208
-
null,
208
208
+
null
209
209
),
210
210
newEntityID,
211
211
});