You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create 🏛template (use copy button in the top right corner):
- template:: extract to new block
template-shortcut::
template-version:: 2
plugin-version:: 4.2.2
link:: [Showroom](https://github.com/stdword/logseq13-full-house-plugin/discussions/50)
arg-insert-to-top?:: no
arg-insert-as-child?:: yes
arg-switch-focus?:: yes
-```javascript``{
var selection =cursor.selection()
var content = (awaitlogseq.Editor.getEditingBlockContent()) ||c.currentBlock.contentvar selectedContent =''if (selection)
selectedContent =content.slice(...selection)
var switchFocus = selection && (selection[0] !== selection[1]) ?c.args['switch-focus?'] :trueif (switchFocus) {
awaitlogseq.Editor.exitEditingMode()
awaitsleep(20)
}
if (c.args['insert-to-top?'])
if (c.args['insert-as-child?'])
blocks.spawn(selectedContent)
elseblocks.append(selectedContent)
elseawaitlogseq.Editor.insertBlock(c.currentBlock.uuid, selectedContent, {sibling:!c.args['insert-as-child?'], before:false})
if (selection) {
var [start, end] = selection
content =content.slice(0, start) +content.slice(end)
}
if (switchFocus)
return content
elsereturn''
}``
```
Reload the application (⌘R or Ctrl+R for Win) to register shortcut command
Got to Settings → Keymap (g s)
Bind any shortcut you want for command «Insert 🏛️template: "extract to new block"»
Reload the application again (⌘R or Ctrl+R for Win) to register just chosen shortcut
In the block Edit Mode (with or without text selection) or in the block Selection Mode use chosen shortcut to call the action.
Configuring
Creating blocks at the top or at the bottom of other child blocks
Use property arg-insert-to-top?:: to configure that. You can specify «yes» or «no».
Switching focus to newly created block
Use property arg-switch-focus?:: to configure that. You can specify «yes» or «no». Note: The focus always switches to empty blocks (despite of this property value).
Set different shortcuts for different options
Fill property arg-toggle-color with first color (ex: arg-toggle-color:: green)
Create another 🏛️template
- template:: extract to new (sibling-top) block
template-shortcut::
arg-insert-to-top?:: yes
arg-insert-as-child?:: no
arg-switch-focus?:: no
-``await layout('extract to new block')``
Reload the application (⌘R or Ctrl+R for Win) to register shortcut command
Got to Settings → Keymap (g s)
Bind any shortcut you want for command «Insert 🏛️template: "color header (red)"»
Reload the application again (⌘R or Ctrl+R for Win) to register just chosen shortcut
Now, you can use two different shortcuts for different option sets.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
inspired by incremental blocks plugin
Steps
🏛template
(use copy button in the top right corner):g s
)Configuring
Creating blocks at the top or at the bottom of other child blocks
Use property
arg-insert-to-top?::
to configure that. You can specify «yes» or «no».Switching focus to newly created block
Use property
arg-switch-focus?::
to configure that. You can specify «yes» or «no».Note: The focus always switches to empty blocks (despite of this property value).
Set different shortcuts for different options
arg-toggle-color
with first color (ex:arg-toggle-color:: green
)🏛️template
g s
)Additional info
Beta Was this translation helpful? Give feedback.
All reactions