11import { BlockEntity , SettingSchemaDesc } from '@logseq/libs/dist/LSPlugin.user'
22
33import {
4- ICON , editNextBlockCommand , editPreviousBlockCommand , joinBlocksCommand ,
4+ ICON , editNextBlockCommand , editPreviousBlockCommand , joinAsSentences_Map , joinBlocksCommand ,
55 joinViaCommas_Attach ,
66 joinViaNewLines_Attach ,
77 joinViaNewLines_Map ,
8+ joinViaSpaces_Attach ,
89 lastChildBlockCommand , magicJoinCommand , magicSplit ,
910 moveToBottomOfSiblingsCommand ,
1011 moveToTopOfSiblingsCommand ,
@@ -13,7 +14,7 @@ import {
1314 parentBlockCommand ,
1415 previousSiblingBlockCommand ,
1516 reverseBlocksCommand , shuffleBlocksCommand , sortBlocksCommand , splitBlocksCommand ,
16- splitByLines , splitByWords , toggleAutoHeadingCommand ,
17+ splitByLines , splitBySentences , splitByWords , toggleAutoHeadingCommand ,
1718} from './commands'
1819import { getChosenBlocks , p , scrollToBlock } from './utils'
1920
@@ -150,24 +151,33 @@ async function main() {
150151 keybinding : { } ,
151152 } , ( e ) => splitBlocksCommand ( magicSplit , setting_storeChildBlocksIn ( ) , true ) )
152153
154+ logseq . App . registerCommandPalette ( {
155+ label : ICON + ' Split by sentences' , key : 'mc-5-split-7-by-sentences' ,
156+ // @ts -expect-error
157+ keybinding : { } ,
158+ } , ( e ) => splitBlocksCommand ( splitBySentences , setting_storeChildBlocksIn ( ) ) )
159+ logseq . App . registerCommandPalette ( {
160+ label : ICON + ' Split by sentences (with nested)' , key : 'mc-5-split-8-by-sentences-nested' ,
161+ // @ts -expect-error
162+ keybinding : { } ,
163+ } , ( e ) => splitBlocksCommand (
164+ splitBySentences , setting_storeChildBlocksIn ( ) , true ) )
165+
153166
154167 // Joining
155168 logseq . App . registerCommandPalette ( {
156169 label : ICON + ' Join via spaces' , key : 'mc-6-join-1-spaces' ,
157170 // @ts -expect-error
158171 keybinding : { } ,
159- } , ( e ) => joinBlocksCommand (
160- false ,
161- ( content , level , children ) => ( content ? content + ' ' : '' ) + children . join ( ' ' ) ,
162- ) )
172+ } , ( e ) => joinBlocksCommand ( false , joinViaSpaces_Attach ) )
163173
164174 logseq . App . registerCommandPalette ( {
165- label : ICON + ' Join selected together via commas (with respect to root block)' , key : 'mc-6-join-2-commas' ,
175+ label : ICON + ' Join together via commas (with respect to root block)' , key : 'mc-6-join-2-commas' ,
166176 // @ts -expect-error
167177 keybinding : { } ,
168178 } , ( e ) => joinBlocksCommand ( false , joinViaCommas_Attach ) )
169179 logseq . App . registerCommandPalette ( {
170- label : ICON + ' Join selected independently via commas (with respect to root block)' , key : 'mc-6-join-3-commas-independently' ,
180+ label : ICON + ' Join independently via commas (with respect to root block)' , key : 'mc-6-join-3-commas-independently' ,
171181 // @ts -expect-error
172182 keybinding : { } ,
173183 } , ( e ) => joinBlocksCommand ( true , joinViaCommas_Attach ) )
@@ -184,16 +194,28 @@ async function main() {
184194 } , ( e ) => joinBlocksCommand ( false , joinViaNewLines_Attach , joinViaNewLines_Map ) )
185195
186196 logseq . App . registerCommandPalette ( {
187- label : ICON + ' Magic Join selected together ' , key : 'mc-6-join-6-magic' ,
197+ label : ICON + ' Magic Join' , key : 'mc-6-join-6-magic' ,
188198 // @ts -expect-error
189199 keybinding : { } ,
190200 } , ( e ) => magicJoinCommand ( false ) )
191201 logseq . App . registerCommandPalette ( {
192- label : ICON + ' Magic Join selected independently' , key : 'mc-6-join-7-magic-independently' ,
202+ label : ICON + ' Magic Join ( independently) ' , key : 'mc-6-join-7-magic-independently' ,
193203 // @ts -expect-error
194204 keybinding : { } ,
195205 } , ( e ) => magicJoinCommand ( true ) )
196206
207+ logseq . App . registerCommandPalette ( {
208+ label : ICON + ' Join as sentences' , key : 'mc-6-join-8-sentences' ,
209+ // @ts -expect-error
210+ keybinding : { } ,
211+ } , ( e ) => joinBlocksCommand ( false , joinViaSpaces_Attach , joinAsSentences_Map , { shouldHandleSingleBlock : true } ) )
212+ logseq . App . registerCommandPalette ( {
213+ label : ICON + ' Join as sentences (independently)' , key : 'mc-6-join-9-sentences-independently' ,
214+ // @ts -expect-error
215+ keybinding : { } ,
216+ } , ( e ) => joinBlocksCommand ( true , joinViaSpaces_Attach , joinAsSentences_Map , { shouldHandleSingleBlock : true } ) )
217+
218+
197219
198220 // Navigation
199221 logseq . App . registerCommandPalette ( {
0 commit comments